This is a very simple countdown timer I build with my daughter every year in the fall to make 16x2 countdown timers for Halloween, Thanksgiving, Christmas, and her birthday. I used the schematic from makerguides.com. The gist of it is captured in this diagram from makerguies.com: .
- Set the constant
nameOfDay
to the name of the event you're counting down to. You may have to abbrevaite if it's not fitting on the screen. - Set the constant
daysPreset
to the number of whole days until the event. - Set the constant
secondsPreset
to represent the number of seconds left in the day today.
Note: You can filldaysPreset
andsecondsPreset
in based on another countdown timer such as Halloween, Thanksgiving, or Christmas.
Nothing new here, just open the file in the Arduino IDE and upload it (Reference). Every time you reboot this, it will reset the countdown to start from the presets defined above, so be ready to change those 😅.
Since the millis()
timer elapsed time is stored in an unsigned long
, this timer will only work for 2^32 -1 (4,294,967,295) milliseconds which is about 49.7 days. After that time, you will have to load new preset times and restart the device.
If I had any sense, I would have written down some troubleshooting tips as they occurred. Needless to say... I did not. If the LCD has a row of white boxes, the wiring is not correct. If you get some jumbled up mess on the screen, also probably not wired correctly. Don't forget to adjust the potentiometer until it looks right!
This of course would benefit greatly from a realtime clock, but most of this code would be useless if you had one.