Arduino Real Time Clock

This year, I spent much of my time programming and wiring the Arduino Real Time Clock (RTC) This Arduino is a microcontroller, a small computer that, depending on what you connect to the Arduino board and what code you upload to it, can blink a light, display something on a screen or even sense your location.The RTC allows the Arduino to keep accurate time, allowing it to display a timer, the current time, and it can keep time so the Arduino can do something at a specific time. Originally, I thought that we were just going to use the RTC to show the current time and that we were going to use a different method, the Arduino “CountUpDownTimer” library to display a stopwatch. Getting the RTC to show the current time only took a few weeks. Here’s a great Adafruit tutorial that I used. However, there are a few issues with the code it gives you. You must make every mention of “rtc” lowercase. I did not realize how case-sensitive coding was. The other important thing is to make sure to uncomment this line “RTC.adjust(DateTime(__DATE__, __TIME__));”.   That line is crucial, as it is what allows the Arduino to display the accurate current time. When I started using the RTC, I did not realize that it could be used as a timer as well as a clock. I wasted three months using the CountUpDownTimer library, and it never worked well. Here is the library for the RTC that I used. In order to write a code for the timer, I had to learn about reading a header file and how to understand the different types of commands that you can use in the code. I also learned that it causes horrible lags to have the RTC update seconds for three timers at once. When I tried doing that, all of the timers were running on a three second delay. Another lesson that I learned is that it is very difficult to use the RTC with the LCD_I2C because they require the same pins. It is easier to wire the LCD the long way, so you can decide what pins it will use. Perhaps the most important lesson I learned through this process is that you MUST NOT wire the Arduino while it is being powered. When I did this by accident, electrostatic discharge occurred and I ended up with a lovely red bump on my thumb for a few weeks after shocking myself by touching the RTC while wiring it.

–By Marc Szechter Class of 2018

Leave a Reply

Your email address will not be published. Required fields are marked *