Arduino Variable Timer Relay

Some electronic or electrical appliances needs time limited power supply, or usage of some devices are depends on limitted time. To automate electrical devices depends on time simple and robust solution given based on arduino. By using this Arduino Variable timer relay we can control high voltage electrical appliances or electronic devices.

To indicate the time duration and status 16×2 LCD display is included in this design, once the program uploaded to the Arduino then it can work independent with some external battery power source.

Connection Diagram

Construction and Working 

In this project arduino uno board is used to control SPDT (Single pole double throw) Relay and 16 x 2 character LCD indicates the time duration status. Digital pins D2 to D7 are connected to the LCD display. VR1 varible resistor helps to control the contrast of LCD display, Transistor Q1 BC547 reacts as a Switching device and controls the power supply to the Relay coil depends on arduino output.

There are three push buttons are placed to set different time durations, S1 Switch makes the count start, S2 changes the Hours and S3 changes the Minutes of time duration. Output signal from the Arduino is taken from D8 pin and it drives the Relay through transistor.

After making the connection, upload the following arduino sketch and pretest the operation with real timer clock.

Note:- Candle with extreme care if you using High voltage supply at the Relay end.

Arduino Code for Variable timer Relay


#include <LiquidCrystal.h>
LiquidCrystal lcd(7,6,5,4,3,2);
const int set = 9;
int hours=10;
int start=11; 
int relay=8;
int b=0,h=0,t=0;
int buttonState = 0; 
int lastButtonState = 0;
void setup() {
  lcd.print("Adjustable Timer");  
int timer( int b,int h)
void loop() 
         buttonState = digitalRead(set);
       if (buttonState != lastButtonState)
       if(buttonState == HIGH)
           lcd.print("Set time in min:");
         lastButtonState = buttonState;

      if (digitalRead(hours)== HIGH)

              lcd.print("Set time in hours");

             lcd.print("Timer is set for");
             while(digitalRead(start) == HIGH );


  1. Tur June 5, 2018 Reply
  2. ruftas October 13, 2018 Reply

Add a Comment

Your email address will not be published. Required fields are marked *