Has anyone put together something like this. I have no problem with the electronics but the code
is out of my expertise.
ARDUINO MULTIPLE ALARMS CLOCK
WITH 2 RELAY OUTPUT
- Arduino Uno
- LCD: LCD 1602 Module, white on blue
- 2 Channel relay module
- One external EEPROM (24LC256)
This is a sketch to output power from relay #1 for 250ms which will turn on the street lights by applying 24v dc to a latching relay. 2 1/2 hours later there will be a on command to relay #2 for 250ms which turns off the street lights.
I want to write a sketch that will turn on the street light though the year starting in January and ending in December. Each month there will be four different events, two events starting the first Wednesday, and two events on the third Wednesday. There will be three months (June, July, and August) the street lights will be turned on only on the first Wednesday (two events).
I will be polling the RTC for Date/Time (unix time) to be used with alarm time. The LCD will display the Date/Time. There will be a total of 42 different timed events in this sketch.
With the RTC having only two alarms I will have to use the body of the sketch to set the alarms. I will used unix time to do a comparison between Date/Time of day with Alarm time. All alarm times will be stored on the external EEPROM in 4 bytes unix time. When you get Date/Time equal to or greater than alarm time condition then there will be a output to turn the lights on/off.
I have two problems, 1 does the DS3231 RTC library output a unix time, and 2 if I have a power outage the sketch will start at day one (Jan.). and the lights will cycle on and off until RTC time gets close to alarm time. The street lights have a short warm up time.