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:
Component | Quantity |
---|---|
Resistor | |
10k 1/4 watt | 1 |
Semiconductors | |
Arduino Uno Board | 1 |
IC 7809 | 1 |
Transistor BC547 | 1 |
SPDT 12V Relay | 1 |
Diode 1N4007 | 1 |
Connector to Arduino | 1 |
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:
- Gather all the parts as shown in circuit diagram
- Arduino pin 3 connect to transistor base with 10k resistor.
- Transistor collector connect to one relay coil pin.
- Other coil pin goes to +12V.
- Transistor emitter goes to GND.
- Relay common pin connect to load.
- Choose NC or NO relay contact to turn load ON or OFF.
- Add 1N4007 diode across relay coil pins.
- Use IC 7809 to give stable 9V to Arduino board.
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.
Leave a Reply