Site icon Circuit Ideas for You

Arduino 2-Step Programmable Timer Circuit with Independent Output Delay Adjustment

This project for Arduino 2-Step Programmable Timer Circuit with Independent Output Delay Adjustment uses Arduino microcontroller to make simple timer.

Not like normal timer with two outputs as this one uses only one output.

It switch between two states.

And each state have delay which we can change for different use.

#include <Arduino.h>

// Define pins
const int outputPin = 9;
const int relayDriverPin = 3;  // Adjust for your relay driver

// Define delay values (in milliseconds)
unsigned long delayTime1 = 5000;
unsigned long delayTime2 = 3000;

// Variables to track timer states
unsigned long previousMillis = 0;
int outputState = LOW;

void setup() {
  pinMode(outputPin, OUTPUT);
  pinMode(relayDriverPin, OUTPUT);

  // Initialize relay driver (if necessary)
  // ...
}

void loop() {
  unsigned long currentMillis = millis();

  if (currentMillis - previousMillis >= delayTime1 + delayTime2) {
    previousMillis = currentMillis;
    outputState = !outputState;
  }

  digitalWrite(outputPin, outputState);
  digitalWrite(relayDriverPin, outputState); // Control relay if used
}

Circuit Working:

Parts List:

ComponentQuantity
Resistor
10k 1/4 watt1
Semiconductors
Arduino Uno Board1
IC 78091
Transistor BC5471
SPDT 12V Relay1
Diode 1N40071
Connector to Arduino1

Arduino Timer and Relay:

Arduino set output pin and relay driver pin if needed.

Inside loop() Arduino check time from last change.

If total time is same or more than both delays added then output switch like HIGH to LOW or LOW to HIGH.

Output pin and relay pin are if used then follow the current output state.

How It Work with 2 Step Timer:

One output pin and one timer are used to make two steps.

Output change between HIGH and LOW.

One full cycle time = delayTime1 + delayTime2.

How to Set Time for Each Step:

Use previousMillis1 and previousMillis2 to track time.

Arduino check time for each delay.

After delayTime1 then output goes HIGH.

After delayTime2 then output goes LOW again.

How to Make Relay Driver with Transistor and Arduino:

Conclusion

This Arduino 2-Step Programmable Timer Circuit with Independent Output Delay Adjustment gives easy and flexible way to make 2-step timer using one output.

We can change delay time to set ON and OFF time as needed.

Relay driver help to control big power load with same circuit.

References:

How to generate two signals with time delay?

Exit mobile version