Adding A DS3231 Real Time Clock
Living in a rural area, I get frequent internet outages. With the raspberry pi having no clock other than getting internet time, I decided adding a RTC module is my best action to keep reef pi operational.
Here is how I did it. I decided on a ds3231 based clock because they are accurate and cheap. Look on ebay and they are less than $2, I bought one. These modules are marked ZS-042.
These have a few quirks. They are meant for a lir2032 rechargeable battery but seldom ship with one because of the air mail restrictions on lithium ion batteries. Mine shipped with a cheap chinese CR2032. They work with a cr2032 coin cell but you must disable the "charger circuit" to use a standard coin cell. If you use this module with a cr2032 without disabling the charging circuit, IT CAN EXPLODE and possibly start a FIRE!!!
So all we have to do to make this useable is to remove the resistor marked 201 circled in the pic below. I used a soldering iron, you can cut a trace between it and the diode as well. This disables the charging circuit only. The clock chip is still backed up by the battery.
So I am going to remove the resistor, put in a decent battery and wire this.
This runs on the i2c bus and simply uses 5v to VCC, GND, SCL and SDA.
Here is the resistor removed
Here is a good battery installed.
Here is the module wired ready to be installed into my reef pi setup
Once wired into my pi, I followed this adafruit guide to get it working:
https://learn.adafruit.com/adding-a-real-time-clock-to-raspberry-pi/overview
Once its working, to check the status of clocks on your setup run the command:
timedatectl status
This screen shows up
Tells me everything I need to know about the clocks on the pi.
Using the adafruit guide your pi will use the RTC when an internet clock is not available and will periodically update the RTC(Im not a linux guru yet so im not sure how often).
Here is a schematic of the module for anyone interested