Arduino Based Universal Timer
This Project Aims to build a Timer for Main power supply cutoff or any other purpose which requires timer operation.
Using the keypad, the time can be adjusted and set a specific time period and execute the timer operation.
The LCD Display is used for easy guidance to select the required time range.
When a time period is entered into the system, the relay will operate and hold until the timer runs out.
Then the relay will release the live connection leaving the auxiliary supply power to be cutoff immediately.
This Timer circuit can be used for any domestic electrical equipment below 700W.(Please select the suitable current/voltage rated plug sockets,relays and wires)
Tools & Components
1 X Arduino Nano1 X 16x2 LCD Display
1 X 5VDC Relay
1 X 10k Ohm Potentiometer
1 X 3x1 Keypad
1 X Switch
1 X 230V Plug Socket
1 X 13A Fuse
1 X 5VDC Supply
Connecting Wires
Connecting Components
Override switch can be used to override the timer operation and keep the plug socket powered.
Push buttons can be used instead of the keypad.
Arduino Code
// 2020 CRAFTYBIN.BLOGSPOT.COM// Author : Chathura H.
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
#define Button A0
#define enter A1
int count = 0;
int val = 0;
int ok = 0;
void setup() {
pinMode(13, OUTPUT);
pinMode(Button, INPUT);
pinMode(enter, INPUT);
Serial.begin(9600);
lcd.begin(16, 2);
}
void loop() {
val = digitalRead(Button);
ok = digitalRead(enter);
if (val == HIGH) {
if(count < 24)
count++;
else
count = 0;
Serial.print("Hours : ");
Serial.println(count);
lcd.print("TIME: ");
lcd.print(count);
lcd.print("Hours ");
delay(100);
lcd.clear();
delay(1);
lcd.print("TIME: ");
lcd.print(count);
lcd.print("Hours ");
}
if (count == 0 ){
digitalWrite(13, 0);
}
if (count == 1 && ok == HIGH){
lcd.clear();
delay(1);
lcd.print("1Hr Selected:");
digitalWrite(13, 1);
delay(360000);
digitalWrite(13, 0);
lcd.clear();
delay(1);
}
if (count == 2 && ok == HIGH){
lcd.clear();
delay(1);
lcd.print("2Hrs Selected:");
digitalWrite(13, 1);
delay(7200000);
digitalWrite(13, 0);
lcd.clear();
delay(1);
}
if (count == 3 && ok == HIGH){
lcd.clear();
delay(1);
lcd.print("3Hrs Selected:");
digitalWrite(13, 1);
delay(10800000);
digitalWrite(13, 0);
lcd.clear();
delay(1);
}
if (count == 4 && ok == HIGH){
lcd.clear();
delay(1);
lcd.print("4Hrs Selected:");
digitalWrite(13, 1);
delay(14400000);
digitalWrite(13, 0);
lcd.clear();
delay(1);
}if (count == 5 && ok == HIGH){
lcd.clear();
delay(1);
lcd.print("5Hrs Selected:");
digitalWrite(13, 1);
delay(18000000);
digitalWrite(13, 0);
lcd.clear();
delay(1);
}if (count == 6 && ok == HIGH){
lcd.clear();
delay(1);
lcd.print("6Hrs Selected:");
digitalWrite(13, 1);
delay(21600000);
digitalWrite(13, 0);
lcd.clear();
delay(1);
}if (count == 7 && ok == HIGH){
lcd.clear();
delay(1);
lcd.print("7Hrs Selected:");
digitalWrite(13, 1);
delay(25200000);
digitalWrite(13, 0);
lcd.clear();
delay(1);
}
if (count == 8 && ok == HIGH){
lcd.clear();
delay(1);
lcd.print("8Hrs Selected:");
digitalWrite(13, 1);
delay(28800000);
digitalWrite(13, 0);
lcd.clear();
delay(1);
}if (count == 9 && ok == HIGH){
lcd.clear();
delay(1);
lcd.print("9Hrs Selected:");
digitalWrite(13, 1);
delay(32400000);
digitalWrite(13, 0);
lcd.clear();
delay(1);
}if (count == 10 && ok == HIGH){
lcd.clear();
delay(1);
lcd.print("10Hrs Selected:");
digitalWrite(13, 1);
delay(36000000);
digitalWrite(13, 0);
lcd.clear();
delay(1);
}if (count == 11 && ok == HIGH){
lcd.clear();
delay(1);
lcd.print("11Hrs Selected:");
digitalWrite(13, 1);
delay(39600000);
digitalWrite(13, 0);
lcd.clear();
delay(1);
}if (count == 12 && ok == HIGH){
lcd.clear();
delay(1);
lcd.print("12Hrs Selected:");
digitalWrite(13, 1);
delay(43200000);
digitalWrite(13, 0);
lcd.clear();
delay(1);
}
if (count == 13 && ok == HIGH){
lcd.clear();
delay(1);
lcd.print("13Hrs Selected:");
digitalWrite(13, 1);
delay(46800000);
digitalWrite(13, 0);
lcd.clear();
delay(1);
}
if (count == 14 && ok == HIGH){
lcd.clear();
delay(1);
lcd.print("14Hrs Selected:");
digitalWrite(13, 1);
delay(50400000);
digitalWrite(13, 0);
lcd.clear();
delay(1);
}
if (count == 15 && ok == HIGH){
lcd.clear();
delay(1);
lcd.print("15Hrs Selected:");
digitalWrite(13, 1);
delay(54000000);
digitalWrite(13, 0);
lcd.clear();
delay(1);
}
if (count == 16 && ok == HIGH){
lcd.clear();
delay(1);
lcd.print("16Hrs Selected:");
digitalWrite(13, 1);
delay(57600000);
digitalWrite(13, 0);
lcd.clear();
delay(1);
}if (count == 17 && ok == HIGH){
lcd.clear();
delay(1);
lcd.print("17Hrs Selected:");
digitalWrite(13, 1);
delay(61200000);
digitalWrite(13, 0);
lcd.clear();
delay(1);
}if (count == 18 && ok == HIGH){
lcd.clear();
delay(1);
lcd.print("18Hrs Selected:");
digitalWrite(13, 1);
delay(64800000);
digitalWrite(13, 0);
lcd.clear();
delay(1);
}if (count == 19 && ok == HIGH){
lcd.clear();
delay(1);
lcd.print("19Hrs Selected:");
digitalWrite(13, 1);
delay(68400000);
digitalWrite(13, 0);
lcd.clear();
delay(1);
}
if (count == 20 && ok == HIGH){
lcd.clear();
delay(1);
lcd.print("20Hrs Selected:");
digitalWrite(13, 1);
delay(72000000);
digitalWrite(13, 0);
lcd.clear();
delay(1);
}if (count == 21 && ok == HIGH){
lcd.clear();
delay(1);
lcd.print("21Hrs Selected:");
digitalWrite(13, 1);
delay(75600000);
digitalWrite(13, 0);
lcd.clear();
delay(1);
}if (count == 22 && ok == HIGH){
lcd.clear();
delay(1);
lcd.print("22Hrs Selected:");
digitalWrite(13, 1);
delay(79200000);
digitalWrite(13, 0);
lcd.clear();
delay(1);
}if (count == 23 && ok == HIGH){
lcd.clear();
delay(1);
lcd.print("23Hrs Selected:");
digitalWrite(13, 1);
delay(82800000);
digitalWrite(13, 0);
lcd.clear();
delay(1);
}if (count == 24 && ok == HIGH){
lcd.clear();
delay(1);
lcd.print("24Hrs Selected:");
digitalWrite(13, 1);
delay(86400000);
digitalWrite(13, 0);
lcd.clear();
delay(1);
}
}
Safety First !Always Connect the power supply if you are absolutely sure that the components are connected correctly without changing polarity and short circuited the wiring.Even if it seems nothing is wrong : DOUBLE CHECK EVERYTHING !!Your Feedback is very important to us.Please Leave a comment about how you feel about this project.
Post a Comment