Raspberry Pi Project
Installing a RTC (Real Time Clock) For Hardware Time TrackingThe raspberry pi is an awesome lil computer....however it lacks a hardware clock and as such its date and time can drift. One of my Pi's I use for logging and battery backup monitoring. This is not mission critial but I would like to know specific times and dates of events. So I installed a RTC clock...and this is the process of installing and configuring it
I purchased the RTC board from DX..CLICK HERE TO PURCHASE IT
Now to set up for the hardware installation... run the following
Select Advanced options then select i2c. When asked if you want i2c interface to be enabled select yes. When asked about kernel module loaded by default select yes.
Power off the pi. and connect the RTC to the pins as shown below...
Note the RTC board in the yellow border....its pin layout and position in relation to the raspberry pi board
Once booted up again log in and lets check to see if the pi see's the new board
You should get a screen like the following...the 68 is an indication of the hardware address of the RTC chip
Now we do some module loading and let the OS know to use it
If this is the first time the module has been used, it will report back Jan 1 2000, and you'll need to set the time to the current time.
Run the date command to check your system date is correct...and if so then you can transfer the system date to the RTC chip via..
To make sure everything went ok we now read the date and time off the hardware clock.
And it should spit out the correct time.
Now everything works...but we need to set everything such that it will work on boot up and wihout network connectivity (in case a network time server is not available)
Open the modules file
At the end of the file put the following:
Open up rc.local for editing...
And add the following 3 lines to the bottom of the file just before the exit (very last line)
Finally we need to remove a software package which can cause issues...
To test this out, shutdown your Pi, unplug any ethernet cable or wifi dongle then power on the pi....run the date command to check the time is correct
Now, the next time you reboot your Pi it will read the time from the Real Time Clock.