Arduino Clock with an UNO

Building a clock is easier then you think but there are some hurdles to overcome. Wiring up the unit was easy.  I purchased the DS1307 clock on ebay for about $4.  The board had a EEPROM chip and Temperature build right into the package as a bonus.  This unit was based on the I2C connection.  If you don’t know the Hex Address of the I2C device, look at my write up here to determine your address.  Without the address, communication to the device is not possible.

300px-IMGP9616 _DSC0999-900x600

The LCD was also based on the I2C connection.  This is great if pin out/ins are limited or needed for other purposes.  Being that it’s based on I2C, there are only 4 wires needed and all I2C units are connected to the same communication channel.  The 4 connection wires includes the positive (red wire 5v), negative (black wire), A4 to SDA (yellow wire) and A5 to SCL (green wire).  The LCD is connected to the same pins on the Arduino board.  Check out the diagram below for details.


There are addresses that need to be setup in order for the two unit to be able to communicate on the same lines (SDA & SCL).  I’ve determined the hex address by uploading a code to the Arduino UNO and reading the output from the serial window.  This will be added to my tutorials soon if you need to determine your hex address.  In my case the DS1307 Clock used the address 0x68.  The EEPROM chip that was a bonus with the clock uses the address 0x50.  Lastly the LCD used address 0x27.  Because they are all connected to the same line, the Arduino will probe for the address to make sure it’s aware that the Arduino is going to communicate with it. If your address differs from mine, you’ll need to change it to reflect your address.  I did not use the EEPROM for this tutorial so it is not used in this tutorial.  To change the LCD address, look for this code:

LiquidCrystal_I2C lcd(0x27,2,1,0,4,5,6,7,3,POSITIVE);

I have it set to 0x27.  You will need to change it to match your LCD I2C address.

For the DS1307 clock, you’ll need to make the change in the Library itself.  Open the RTClib.cpp file and make the change to your address.  Its on line 15.

#define DS1307_ADDRESS  0x68


The code is set to show the time on the Serial output screen.  If it’s not to be used, comment to all “Serial.print” lines with // in front of it.  Keep in mind that if you’re going to use the Serial.print, make sure that the baud rate is set correctly on the serial monitor.  I have it set for 9600 baud rate.



This is basic run down of the setup.  If you have any questions, feel free to comment below.  Make sure to upload all the libraries to your libraries folder and put the Clock-Project-ds1307 folder within your Arduino folder.


Video 1

Video 2

Sign Up to get updates on the latest article

Get the latest from my blog when you sign up.  Special offers are only offered to those who sign up.  Specific DIY are emailed to users when they become available.  Sign up today to get notified.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.