Phone

    00852-6915 1330
  • Contents

Summary

Some electornic 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.Today let's make a arduino variable time relay together.By using this arduino variable timer relay we can control high voltage electrical appliances or electronic devices.Now let me share the process.

 

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

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

 

#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() {

  

  pinMode(set,INPUT);

  pinMode(hours,INPUT);

  pinMode(relay,OUTPUT);

  pinMode(start,INPUT);

  lcd.begin(16,2);

  lcd.setCursor(0,0);

  lcd.print("Adjustable Timer");  

}

int timer( int b,int h)

{

         if(b<=9)

           {

            lcd.setCursor(3,1);

            lcd.print(0);

            lcd.setCursor(4,1);

            lcd.print(b);

          }

     else{lcd.setCursor(3,1);lcd.print(b);}

         lcd.setCursor(2,1);

         lcd.print(":");

     if(h<=9)

           {

            lcd.setCursor(0,1);

            lcd.print(0);

            lcd.setCursor(1,1);

            lcd.print(h);

          }

     else{lcd.setCursor(0,1);lcd.print(h);}

  

  }

void loop() 

      {

  

         buttonState = digitalRead(set);

                  

       if (buttonState != lastButtonState)

       {  

        

       if(buttonState == HIGH)

         {

            

           lcd.clear();

           lcd.print("Set time in min:");

            

          ++b;

           timer(b,h);

                            

       }

          

         lastButtonState = buttonState;

          }

 

      if (digitalRead(hours)== HIGH)

 

         {

              lcd.clear();

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

              ++h;

              timer(b,h);

              while(digitalRead(hours)==HIGH);

             

             

          }  

 

          if(digitalRead(start)==HIGH)

          {

             lcd.clear();

             t=((h*60)+(b))*1000;

             lcd.print("Timer is set for");

             timer(b,h);

             digitalWrite(relay,HIGH);

             delay(t);

             digitalWrite(relay,LOW);

             while(digitalRead(start) == HIGH );

                        

           }

             

     

      }

 

Have you make it successfully? 

 

Kynix

Kynix was founded in 2008, specializing in the electronic components distribution business. We adhere to honesty and ethics as our business philosophy and have gradually established an excellent reputation and credibility in our international business. With the accurate quotation, excellent credit, reasonable price, reliable quality, fast delivery, and authentic service, we have won the praise of the majority of customers.

Join our mailing list!

Be the first to know about new products, special offers, and more.

Leave a Reply

We'd love to hear from you! Feel free to share your thoughts and comments below. Rest assured, your email address will remain private.

Name *
Email *
Captcha *
Rating:

Kynix

  • How to purchase

  • Order
  • Search & Inquiry
  • Shipping & Tracking
  • Payment Methods
  • Contact Us

  • Tel: 00852-6915 1330
  • Email: info@kynix.com
  • Follow Us

authentication

Kynix

© 2008-2026 kynix.com all rights reserved.