Sequence timer is used in many manufacturing industries to turn ON and turn OFF processes one by one automatically. Sequence timer is at most required when there is chain of processes – means 1st process ends it triggers 2nd process, when 2nd ends it triggers 3rd process and so on (like chain reaction !!!….). The timings and durations of each process has to be set initially. Each process requires specific time duration. The time duration for each process in sequence is set (programmed) before the entire chain process starts. Then the 1st process is triggered. It runs for set duration and when it finishes, 2nd process starts and thus the chain starts. Each process runs for set duration and when it finishes, turns ON next process. This continues until last process. There may be several such processes. When last process finishes, the chain stops. If it’s in continuous or repeat mode, again 1st process will start and this cycle repeats continuously.
Example of such process can be found in metal fabrication or welding industries. In welding process there are four sub processes that should be triggered one after another. (1) the job (to be welded) is brought under electrodes through conveyor (or by any other means) (2) the electrodes squeeze the job to apply proper pressure (3) the contactor is switched ON to pass current through electrodes and job (4) finally the job is placed under pressure to be get welded properly. All these processes are triggered one after another and each process requires specific time duration. The time durations for each process are set initially and then process starts.
Here the given project demonstrates such sequence timer with real time clock chip. It uses arduino micro controller and DS1307 RTC chip to set real time and duration of processes. The process duration can be set in hour, minute and second. The process runs in real time as per the time given by RTC chip. There is 16×4 LCD in the project to display the process status, other different messages and real time. The user can set and program the starting time of process and duration of 3 different sub processes. In this demonstration 3 relays are turned ON and OFF in sequence and it is assumed that the relay will turn ON and OFF the process. So let us first see the circuit diagram and its operation followed by program.
Circuit diagram:
Circuit description:
As shown in above figure the circuit is build using RTC DS1307 chip module, 16×4 LCD, arduino UNO board and few other components like push buttons, relays, transistors, resistors etc
· RTC module has four wire interface Vcc, Gnd, SDA and SCL. Vcc and Gnd pins are connected to arduino board 5 V and Gnd respectively that gives it biasing voltage for its operation
· SCL and SDA pins are connected to arduino SCL and SDA pins. Arduino communicates with RTC DS1307 chip using these two pins
· Four push buttons are connected to arduino digital pins 1, 2, 3, and 4. All push buttons are pulled down to ground through 10 K resistors as shown. when any button is pressed, the respective arduino pin get logic 1 (HIGH) input
· Digital pins 5, 6 and 7 drives three 12 V relays through 3 NPN type transistors as shown. The relay coils are connected between external 12 V supply and collector terminals of transistor
· Three different devices (not shown in figure) are connected with relay contact terminals. Means the device is turned ON when relay is turned ON. The device reassembles any process of industry.
· Data pins D4-D7 of LCD are connected to arduino pins 10 – 13. Two control pins Rs and En are connected to pins 8 and 9 respectively. Control pins RW and VEE (contras control) are connected to ground
· Backlight LED of LCD is given 5V supply
Circuit operation:
· When the power is given to circuit through USB, initially all three relays and hence the devices are OFF. The person has to first set timings for each device (process)
· The initial message is display on LCD as “Set sequence start time”
· Now person has to set sequence start time# in hour, minute and second using push buttons. Given 4 push buttons has following functions.
. So by pressing button 1, button 2 and button 3, the person will set require hour, minute and second and then press enter button to set sequence start time
· The message is displayed on LCD as “Sequence start time is set to XX:XX:XX ” (this is the actual time when sequential process will start) ·
· Next, person is asked to enter duration of process 1 in hour, minute and second. The LCD displays message “Set process 1 duration 00:00:00”
· Again person has to enter total duration for process 1 in hour, minute and second – means for how much time the process 1 will run.
· The person has to set the duration* (not the time!!!!!) for process 1 using push buttons. When the duration is set and enter button is pressed the message is displayed on LCD as “Process 1 duration is XX hour XX minute and XX sec”
· Similarly, the person has to set duration for process 2 and process 3 also. When duration is set, similar message is displayed on LCD as “Process X duration is XX hour XX minute and XX sec”
· When all 3 process durations are set and enter button is pressed, the actual circuit operation starts
· Arduino reads current time from RTC module and displays it on LCD as “Time:- XX:XX:XX”. Along with this LCD also displays process 1 start time (the sequence start time that user has entered)
· Then it continuously compares current time and process 1 start time. When they match, it turns ON first relay and so the process 1 by sending HIGH logic (1) on digital pin 5. The message displayed on LCD as “process 1 starts”
· The LCD also displays message “process 2 start time xx:xx:xx” – that is the real time when process 1 will over and process 2 will start
· Now again arduino compares current time with process 2 start time. When both match, it first turns OFF 1st relay and turns ON 2nd relay. So the 2nd process starts. LCD displays “process 2 starts” and “Process 3 start time xx:xx:xx”
· Again when current time equals process 3 start time, 2nd relay is turned OFF and 3rd relay is turned ON to initiate 3rd process.
· The LCD displays “process 3 starts” and the last message on LCD is “process 3 end time xx:xx:xx”
· Finally when process 3 end time is reached, 3rd relay is also turned OFF and thus complete sequence is finished
# Note 1: sequence start time means user has to enter the actual time when the entire sequential process will start. He has to enter the desired real time like 10:00:00 (am) or 15:30:00 (pm) when he wants process to be start.
* Note 2 : duration for process means how much time the process will take to be finish. Here user has to enter duration of process not the time
This is how the sequential timer initiates process one by one as per the programmed time and duration. Here is the snap of circuit arrangement
You may also like:
Project Source Code
###
//Program to #include#include "RTClib.h" #include #include #define set_hr 1 #define set_min 2 #define set_sec 3 #define enter 4 #define device1 5 #define device2 6 #define device3 7 LiquidCrystal lcd(8, 9, 10, 11, 12, 13); RTC_DS1307 rtc; int hr=0, minut=0,sec=0,set_time_flag=1,sys_en_flag=0; int process1_time_flag=0,process2_time_flag=0,process3_time_flag=0; int process1_hr,process1_min,process1_sec; int process2_hr,process2_min,process2_sec; int process3_hr,process3_min,process3_sec; int strt_hr,strt_min,strt_sec,time_flag=1; void setup () { Serial.begin(9600); lcd.begin(16, 4); lcd.clear(); pinMode(set_hr,INPUT); pinMode(set_min,INPUT); pinMode(set_sec,INPUT); pinMode(enter,INPUT); pinMode(device1,OUTPUT); pinMode(device2,OUTPUT); pinMode(device3,OUTPUT); digitalWrite(device1,LOW); digitalWrite(device2,LOW); digitalWrite(device3,LOW); } void loop () { int hr_set_but,min_set_but,ent_but,sec_set_but; hr_set_but = digitalRead(set_hr); min_set_but = digitalRead(set_min); sec_set_but = digitalRead(set_sec); ent_but = digitalRead(enter); ///////////////// turn device ON or OFF //////////////////////////////// if(time_flag) { DateTime now = rtc.now(); lcd.print("current time is"); lcd.setCursor(0,1); lcd.print(now.hour()); lcd.print(':'); lcd.print(now.minute()); lcd.print(':'); lcd.print(now.second()); delay(3000); lcd.clear(); lcd.print("Set sequence "); lcd.setCursor(0,1); lcd.print("start time:"); lcd.setCursor(0,2); lcd.print("00:00:00"); time_flag=0; } if(sys_en_flag) { DateTime now = rtc.now(); ///////////// display current time on LCD ////////////////////////// lcd.setCursor(6,0); lcd.print(" "); lcd.setCursor(6,0); lcd.print(now.hour()); lcd.print(':'); lcd.print(now.minute()); lcd.print(':'); lcd.print(now.second()); if(now.hour()==EEPROM.read(11) && now.minute()==EEPROM.read(12) && now.second()==EEPROM.read(13)) { digitalWrite(device1,HIGH); lcd.setCursor(8,1); lcd.print('2'); lcd.setCursor(6,2); lcd.print(EEPROM.read(14)); lcd.print(':'); lcd.print(EEPROM.read(15)); lcd.print(':'); lcd.print(EEPROM.read(16)); lcd.setCursor(0,3); lcd.print("Process 1 starts"); } if(now.hour()==EEPROM.read(14) && now.minute()==EEPROM.read(15) && now.second()==EEPROM.read(16)) { digitalWrite(device1,LOW); digitalWrite(device2,HIGH); lcd.setCursor(8,1); lcd.print('3'); lcd.setCursor(6,2); lcd.print(EEPROM.read(17)); lcd.print(':'); lcd.print(EEPROM.read(18)); lcd.print(':'); lcd.print(EEPROM.read(19)); lcd.setCursor(0,3); lcd.print("Process 2 starts"); } if(now.hour()==EEPROM.read(17) && now.minute()==EEPROM.read(18) && now.second()==EEPROM.read(19)) { digitalWrite(device2,LOW); digitalWrite(device3,HIGH); lcd.setCursor(8,1); lcd.print("3 end "); lcd.setCursor(6,2); lcd.print(EEPROM.read(20)); lcd.print(':'); lcd.print(EEPROM.read(21)); lcd.print(':'); lcd.print(EEPROM.read(22)); lcd.setCursor(0,3); lcd.print("Process 3 starts"); } if(now.hour()==EEPROM.read(20) && now.minute()==EEPROM.read(21) && now.second()==EEPROM.read(22)) { digitalWrite(device3,LOW); lcd.setCursor(0,3); lcd.print("Process 3 ends "); } delay(1000); } ///////////// set ON time and OFF time for device /////////////////// if(hr_set_but) { if(hr<24) hr++; if(hr==24) hr=0; lcd.setCursor(0,2); lcd.print(" "); lcd.setCursor(0,2); lcd.print(hr); delay(200); } if(min_set_but) { if(minut<60) minut++; if(minut==60) minut=0; lcd.setCursor(3,2); lcd.print(" "); lcd.setCursor(3,2); lcd.print(minut); delay(200); } if(sec_set_but) { if(sec<60) sec++; if(sec==60) sec=0; lcd.setCursor(6,2); lcd.print(" "); lcd.setCursor(6 ,2); lcd.print(sec); delay(200); } if(ent_but) { if(set_time_flag==1) { strt_hr=hr; strt_min = minut; strt_sec = sec; EEPROM.write(11,strt_hr); EEPROM.write(12,strt_min); EEPROM.write(13,strt_sec); set_time_flag=0; process1_time_flag=1; lcd.setCursor(0,0); lcd.print("sequence start "); lcd.setCursor(0,1); lcd.print("time is set to "); lcd.setCursor(0,2); lcd.print(strt_hr); lcd.print(':'); lcd.print(strt_min); lcd.print(':'); lcd.print(strt_sec); delay(2000); lcd.setCursor(0,0); lcd.print("Set Process 1 "); lcd.setCursor(0,1); lcd.print("Time duration "); lcd.setCursor(0,2); lcd.print("00:00:00"); hr = 0; minut = 0; sec = 0; } else if(process1_time_flag==1) { process1_sec = sec + EEPROM.read(13); if(process1_sec>60) { process1_sec = process1_sec-60; minut++; } process1_min = minut+EEPROM.read(12); if(process1_min>60) { process1_min = process1_min-60; hr++; } process1_hr = hr+EEPROM.read(11); EEPROM.write(14,process1_hr); EEPROM.write(15,process1_min); EEPROM.write(16,process1_sec); process1_time_flag=0; process2_time_flag=1; lcd.setCursor(0,0); lcd.print("Process 1 time "); lcd.setCursor(0,1); lcd.print("duration is "); lcd.setCursor(0,2); lcd.print(hr); lcd.print(" Hr "); lcd.print(minut); lcd.print(" minute"); lcd.setCursor(0,3); lcd.print("and "); lcd.print(sec); lcd.print(" sec"); delay(2000); lcd.clear(); lcd.setCursor(0,0); lcd.print("Set Process 2 "); lcd.setCursor(0,1); lcd.print("Time duration "); lcd.setCursor(0,2); lcd.print("00:00:00"); hr = 0; minut = 0; sec = 0; } else if(process2_time_flag==1) { process2_sec = sec + EEPROM.read(16); if(process2_sec>60) { process2_sec = process2_sec-60; minut++; } process2_min = minut+EEPROM.read(15); if(process2_min>60) { process2_min = process2_min-60; hr++; } process2_hr = hr+EEPROM.read(14); EEPROM.write(17,process2_hr); EEPROM.write(18,process2_min); EEPROM.write(19,process2_sec); process2_time_flag=0; process3_time_flag=1; lcd.setCursor(0,0); lcd.print("Process 2 time "); lcd.setCursor(0,1); lcd.print("duration is "); lcd.setCursor(0,2); lcd.print(hr); lcd.print(" Hr "); lcd.print(minut); lcd.print(" mn "); lcd.setCursor(0,3); lcd.print("and "); lcd.print(sec); lcd.print(" sec"); delay(2000); lcd.clear(); lcd.setCursor(0,0); lcd.print("Set Process 3 "); lcd.setCursor(0,1); lcd.print("Time duration "); lcd.setCursor(0,2); lcd.print("00:00:00"); hr = 0; minut = 0; sec = 0; } else if(process3_time_flag==1) { process3_sec = sec + EEPROM.read(19); if(process3_sec>60) { process3_sec = process3_sec-60; minut++; } process3_min = minut+EEPROM.read(18); if(process3_min>60) { process3_min = process3_min-60; hr++; } process3_hr = hr+EEPROM.read(17); EEPROM.write(20,process3_hr); EEPROM.write(21,process3_min); EEPROM.write(22,process3_sec); process3_time_flag=0; lcd.setCursor(0,0); lcd.print("Process 3 time "); lcd.setCursor(0,1); lcd.print("duration is "); lcd.setCursor(0,2); lcd.print(hr); lcd.print(" Hr "); lcd.print(minut); lcd.print(" mn "); lcd.setCursor(0,3); lcd.print("and "); lcd.print(sec); lcd.print(" sec"); delay(2000); lcd.clear(); lcd.print("Time:-"); lcd.setCursor(0,1); lcd.print("Process 1 Start "); lcd.setCursor(0,2); lcd.print("Time: "); lcd.print(strt_hr); lcd.print(':'); lcd.print(strt_min); lcd.print(':'); lcd.print(strt_sec); sys_en_flag=1; } } } ###
Circuit Diagrams
Project Video
Filed Under: Electronic Projects
Filed Under: Electronic Projects
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.