Close

Building the Code

A project log for Digital Christmas Countdown

Over-engineering the countdown to Christmas

Scott ClandininScott Clandinin 3 days ago0 Comments

After testing the default program supplied with the display (attached to this project), I worked to modify the program to suit my needs. The first challenge that came up was that the software was intended to be used with the Arduino Uno, but for this project I needed to use something with more pins as there were none extra available for use with the Uno. The SPI pins of the shield lined up with the SPI headers of the Uno, which are different for the Arduino Mega. The fix for this was to bend out the display pins and reroute them to the appropriate headers on the Mega.

The only other pins I needed to use were the I2C communication pins for the RTC.

In order to best observe the real time and ensure leap years are accounted for, the RTC was needed. Using the library RTClib, I found a function that allowed for me to find out what the time and date would be at a certain point in the future. 

The method used to find out the days to Christmas was a very brute force method, but effective. I would continually add 60 seconds to the current time, and keep track of how many times I had to add 60 seconds to the time until the month and date equaled 12/25. Once that date was reached it would take the tallied number of minutes and translate that into days. The resulting day would be matched with the appropriate image file and displayed on the screen.

The software is linked to this project, as well as the images meant for the micro SD card. The only thing needed to get this working is to load up the micro SD card with the images, and use an RTC example sketch to set the current date and time.

Discussions