To keep costs low, the Raspberry Pi does not include a Real Time Clock module. Instead, users are expected to have it always connected to WiFi or Ethernet and keep time by checking the network. Since we want to include an external module, we'll have to wire one up.

We have three different RTC we suggest, PCF8523 is inexpensive, DS1307 is most common, and DS3231 is most precise. Any of them will do!

While the DS1307 is historically the most common, its not the best RTC chipset, we've found!

Angled shot of a Adafruit PiRTC - PCF8523 Real Time Clock for Raspberry Pi.
This is a great battery-backed real time clock (RTC) that allows your Raspberry Pi project to keep track of time if the power is lost. Perfect for data-logging, clock-building,...
$7.50
In Stock
Angled shot of RTC breakout board.
This is a great battery-backed real time clock (RTC) that allows your microcontroller project to keep track of time even if it is reprogrammed, or if the power is lost. Perfect for...
$6.95
In Stock
Angled shot of a Adafruit DS1307 Real Time Clock Assembled Breakout Board.
This is a great battery-backed real time clock (RTC) that allows your microcontroller project to keep track of time even if it is reprogrammed, or if the power is lost. Perfect for...
$7.50
In Stock
Angled shot of the battery cell slot on a Adafruit DS3231 Precision RTC Breakout.
The datasheet for the DS3231 explains that this part is an "Extremely Accurate I²C-Integrated RTC/TCXO/Crystal". And, hey, it does exactly what it says...
$17.50
In Stock

Don't forget to also install a CR1220 coin cell. In particular the DS1307 wont work at all without it and none of the RTCs will keep time when the Pi is off and no coin battery is in place.

Angled shot of CR1220 12mm Diameter - 3V Lithium Coin Cell Battery - CR1220.
These are the highest quality & capacity batteries, the same as shipped with the iCufflinks, iNecklace, Datalogging and GPS Shields, GPS HAT, etc. One battery per order...
Out of Stock

Wiring is simple:

  1. Connect VCC on the breakout board to the 5.0V pin of the Pi (if using DS1307)
    Connect VCC on the breakout board to the 3.3V pin of the Pi (if using PCF8523 or DS3231)
  2. Connect GND on the breakout board to the GND pin of the Pi
  3. Connect SDA on the breakout board to the SDA pin of the Pi
  4. Connect SCL on the breakout board to the SCL pin of the Pi

This guide was first published on Aug 31, 2012. It was last updated on Mar 08, 2024.

This page (Wiring the RTC) was last updated on Mar 08, 2024.

Text editor powered by tinymce.