16x2 LCD Clock
Now, I will tech you how you can build a simple clock with date, time and day of the week using a 16x2 LCD display and a DS1302 RTC module. The current date and time is stored even after power outage so it will work, for example, when changing power supplies or moving to a different location. Some of the used parts were provided by Kuman.
Parts Needed
- Arduino board
- 9 x Jumper wires
- DS1302 module
- USB cable
You will be able to buy the components that I've used on allchips.ai
Their store will be up by the end of January. Stay tuned!
Connecting the Components
So, you need to make the following connections:
LCD | Arduino
- GND - GND
- VCC - 5V
- SDA - A4
DS1302 | Arduino
- VCC - 5V
- GND - GND
- DAT - 2
- RST - 3
- CLK - 4
Modifying and Uploading the Code
You can find the code that I've developed here. Take a look at the code which sets the date and time (for the first time). You need to modify it, upload the code and then to prevent it from overwritting the date and time which is beeing stored you can either comment-out the 3 lines or delete them. I've explained this in the code as well, using some comments. Feel free to modify it to your likings.