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 and it also switch between two states and each state have delay which we can change for different use.

Arduino Code:

#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:

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

Parts List:

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

How It Work with 2 Step Timer:

The circuit uses one output pin and one timer to create two steps, it switches the output between HIGH and LOW states.

One full cycle time = delayTime1 + delayTime2.

How to Set Time for Each Step:

Use previousMillis1 and previousMillis2 to track time and then Arduino check time for each delay.

After delayTime1 then output goes HIGH and after delayTime2 then output goes LOW again.

How to Make Relay Driver with Transistor and Arduino:

Conclusion

Overall, 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.

Also, we can change delay time to set ON and OFF time as needed and relay driver help to control big power load with same circuit.

Exit mobile version