# Adding a Real Time Clock to Raspberry Pi

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/143/407/medium800/pi_a___b___2__3_pi_rtc.png?1775152241 )

Info: This guide is for Pi models prior to the Pi5, which has a built in RTC. For Pi5 see here:
https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#real-time-clock-rtc

The Raspberry Pi is designed to be an ultra-low cost computer, so a lot of things we are used to on a computer have been left out. For example, your laptop and computer have a little coin-battery-powered 'Real Time Clock'&nbsp; (RTC) module, which keeps time even when the power is off, or the battery removed. To keep costs low and the size small, an RTC is not included with the Raspberry Pi. Instead, the Pi is intended to be connected to the Internet via Ethernet or WiFi, updating the time automatically from the global **ntp** (nework time protocol) servers  
  
For stand-alone projects with no network connection, you will not be able to keep the time when the power goes out. So in this project we will show you how to add a low cost battery-backed RTC to your Pi to keep time!

## RTC Options

Adafruit currently offers three different RTC options in the shop. As a general summary:

- PCF8523 is inexpensive
- DS3231 is most precise
- DS1307 is historically most common

While the DS1307 is historically the most common, it is not the best RTC chipset, we've found! However, any of these RTC options will function on a Raspberry Pi.

These RTC options also come in various form factors. The oldest style has only a row of headers and requires soldering. Newer style include STEMMA QT connectors to provide a solderless connection option. For the PCF8523 and DS3231, there are also a Pi specific version that will mount directly to the Pi's GPIO header.

## PCF8523
### Adafruit PiRTC - PCF8523 Real Time Clock for Raspberry Pi

[Adafruit PiRTC - PCF8523 Real Time Clock for Raspberry Pi](https://www.adafruit.com/product/3386)
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, time-stamping, timers and alarms, etc. Equipped with&nbsp; **PCF8523** &nbsp;RTC, it works great with the...

In Stock
[Buy Now](https://www.adafruit.com/product/3386)
[Related Guides to the Product](https://learn.adafruit.com/products/3386/guides)
![Angled shot of a Adafruit PiRTC - PCF8523 Real Time Clock for Raspberry Pi.](https://cdn-shop.adafruit.com/640x480/3386-07.jpg)

### Adafruit PCF8523 Real Time Clock Breakout Board

[Adafruit PCF8523 Real Time Clock Breakout Board](https://www.adafruit.com/product/5189)
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 data-logging, clock-building, time stamping, timers, and alarms, etc. Equipped...

In Stock
[Buy Now](https://www.adafruit.com/product/5189)
[Related Guides to the Product](https://learn.adafruit.com/products/5189/guides)
![Angled shot of PCF8523 Real Time Clock Breakout Board.](https://cdn-shop.adafruit.com/640x480/5189-00.jpg)

### Adafruit PCF8523 Real Time Clock Assembled Breakout Board

[Adafruit PCF8523 Real Time Clock Assembled Breakout Board](https://www.adafruit.com/product/3295)
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 datalogging, clock-building, time stamping, timers and alarms, etc. Equipped...

Out of Stock
[Buy Now](https://www.adafruit.com/product/3295)
[Related Guides to the Product](https://learn.adafruit.com/products/3295/guides)
![Angled shot of RTC breakout board.](https://cdn-shop.adafruit.com/640x480/3295-11.jpg)

## DS3231
### Adafruit PiRTC - Precise DS3231 Real Time Clock for Raspberry Pi

[Adafruit PiRTC - Precise DS3231 Real Time Clock for Raspberry Pi](https://www.adafruit.com/product/4282)
This is the best battery-backed real time clock (RTC) you can get that allows your Raspberry Pi project to keep track of time if the power is lost. Perfect for data-logging, clock-building, NTP servers, time-stamping, timers and alarms, etc. Equipped with **a genuine DS3231** RTC,...

In Stock
[Buy Now](https://www.adafruit.com/product/4282)
[Related Guides to the Product](https://learn.adafruit.com/products/4282/guides)
![Angled shot of a Adafruit PiRTC - Precise DS3231 Real Time Clock for Raspberry Pi. ](https://cdn-shop.adafruit.com/640x480/4282-08.jpg)

### Adafruit DS3231 Precision RTC - STEMMA QT

[Adafruit DS3231 Precision RTC - STEMMA QT](https://www.adafruit.com/product/5188)
&nbsp;

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 on the tin! This **Real Time Clock (RTC)** is the most precise you can get in a...

Out of Stock
[Buy Now](https://www.adafruit.com/product/5188)
[Related Guides to the Product](https://learn.adafruit.com/products/5188/guides)
![Angled shot of RTC breakout.](https://cdn-shop.adafruit.com/640x480/5188-05.jpg)

### Adafruit DS3231 Precision RTC Breakout

[Adafruit DS3231 Precision RTC Breakout](https://www.adafruit.com/product/3013)
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 on the tin! This **Real Time Clock (RTC)** is the most precise you can get in a small, low power...

In Stock
[Buy Now](https://www.adafruit.com/product/3013)
[Related Guides to the Product](https://learn.adafruit.com/products/3013/guides)
![Angled Shot of the Adafruit DS3231 Precision RTC Breakout.](https://cdn-shop.adafruit.com/640x480/3013-06.jpg)

## DS1307
### Adafruit DS1307 Real Time Clock Assembled Breakout Board

[Adafruit DS1307 Real Time Clock Assembled Breakout Board](https://www.adafruit.com/product/3296)
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 datalogging, clock-building, time stamping, timers and alarms, etc. The **DS1307** is the most...

In Stock
[Buy Now](https://www.adafruit.com/product/3296)
[Related Guides to the Product](https://learn.adafruit.com/products/3296/guides)
![Angled shot of a Adafruit DS1307 Real Time Clock Assembled Breakout Board.](https://cdn-shop.adafruit.com/640x480/3296-03.jpg)

## RTC Battery

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.

### CR1220 12mm Diameter - 3V Lithium Coin Cell Battery

[CR1220 12mm Diameter - 3V Lithium Coin Cell Battery](https://www.adafruit.com/product/380)
These are the highest quality & capacity batteries, the same as shipped with the iCufflinks,&nbsp;iNecklace, Datalogging and GPS Shields, GPS HAT, etc. One battery per order (you'll want one battery per cufflink or pendant.)  
  
Brand may vary but all battery brands are verified...

In Stock
[Buy Now](https://www.adafruit.com/product/380)
[Related Guides to the Product](https://learn.adafruit.com/products/380/guides)
![Angled shot of CR1220 12mm Diameter - 3V Lithium Coin Cell Battery - CR1220.](https://cdn-shop.adafruit.com/640x480/380-01.jpg)

- [Next Page](https://learn.adafruit.com/adding-a-real-time-clock-to-raspberry-pi/wiring-the-rtc-2.md)

## Featured Products

### Adafruit PiRTC - PCF8523 Real Time Clock for Raspberry Pi

[Adafruit PiRTC - PCF8523 Real Time Clock for Raspberry Pi](https://www.adafruit.com/product/3386)
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, time-stamping, timers and alarms, etc. Equipped with&nbsp; **PCF8523** &nbsp;RTC, it works great with the...

In Stock
[Buy Now](https://www.adafruit.com/product/3386)
[Related Guides to the Product](https://learn.adafruit.com/products/3386/guides)
### Adafruit PiRTC - Precise DS3231 Real Time Clock for Raspberry Pi

[Adafruit PiRTC - Precise DS3231 Real Time Clock for Raspberry Pi](https://www.adafruit.com/product/4282)
This is the best battery-backed real time clock (RTC) you can get that allows your Raspberry Pi project to keep track of time if the power is lost. Perfect for data-logging, clock-building, NTP servers, time-stamping, timers and alarms, etc. Equipped with **a genuine DS3231** RTC,...

In Stock
[Buy Now](https://www.adafruit.com/product/4282)
[Related Guides to the Product](https://learn.adafruit.com/products/4282/guides)
### Adafruit PCF8523 Real Time Clock Assembled Breakout Board

[Adafruit PCF8523 Real Time Clock Assembled Breakout Board](https://www.adafruit.com/product/3295)
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 datalogging, clock-building, time stamping, timers and alarms, etc. Equipped...

Out of Stock
[Buy Now](https://www.adafruit.com/product/3295)
[Related Guides to the Product](https://learn.adafruit.com/products/3295/guides)
### Adafruit DS1307 Real Time Clock Assembled Breakout Board

[Adafruit DS1307 Real Time Clock Assembled Breakout Board](https://www.adafruit.com/product/3296)
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 datalogging, clock-building, time stamping, timers and alarms, etc. The **DS1307** is the most...

In Stock
[Buy Now](https://www.adafruit.com/product/3296)
[Related Guides to the Product](https://learn.adafruit.com/products/3296/guides)
### ChronoDot - Ultra-precise Real Time Clock

[ChronoDot - Ultra-precise Real Time Clock](https://www.adafruit.com/product/255)
The **ChronoDot V3** is the latest version of macetech’s popular ChronoDot line of products. Designed during the Great Chip Shortage, it uses the newly-released MAX31328 temperature-compensated real-time clock chip. However, it remains pin- and code-compatible with the older...

In Stock
[Buy Now](https://www.adafruit.com/product/255)
[Related Guides to the Product](https://learn.adafruit.com/products/255/guides)
### Adafruit DS3231 Precision RTC Breakout

[Adafruit DS3231 Precision RTC Breakout](https://www.adafruit.com/product/3013)
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 on the tin! This **Real Time Clock (RTC)** is the most precise you can get in a small, low power...

In Stock
[Buy Now](https://www.adafruit.com/product/3013)
[Related Guides to the Product](https://learn.adafruit.com/products/3013/guides)
### CR1220 12mm Diameter - 3V Lithium Coin Cell Battery

[CR1220 12mm Diameter - 3V Lithium Coin Cell Battery](https://www.adafruit.com/product/380)
These are the highest quality & capacity batteries, the same as shipped with the iCufflinks,&nbsp;iNecklace, Datalogging and GPS Shields, GPS HAT, etc. One battery per order (you'll want one battery per cufflink or pendant.)  
  
Brand may vary but all battery brands are verified...

In Stock
[Buy Now](https://www.adafruit.com/product/380)
[Related Guides to the Product](https://learn.adafruit.com/products/380/guides)
### DS1307 Real Time Clock breakout board kit

[DS1307 Real Time Clock breakout board kit](https://www.adafruit.com/product/264)
**[We've upgraded this RTC breakout and made it even easier to use! Now available as a fully assembled board, it has the same components, chip, size, etc but you don't have to put it together. It's also less expensive! Check out...](https://www.adafruit.com/product/3296)**

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/264)
[Related Guides to the Product](https://learn.adafruit.com/products/264/guides)

## Related Guides

- [I2C Addresses and Troublesome Chips](https://learn.adafruit.com/i2c-addresses.md)
- [Plotting Offline Data - JSONL to CSV files, filters and graphs](https://learn.adafruit.com/plotting-offline-data-jsonl-to-csv-files-filters-and-graphs.md)
- [Digital Clock with CircuitPython](https://learn.adafruit.com/digital-clock-with-circuitpython.md)
- [NeoMatrix 8x8 Word Clock](https://learn.adafruit.com/neomatrix-8x8-word-clock.md)
- [NeoPixel 60 Ring Wall Clock](https://learn.adafruit.com/neopixel-60-ring-clock.md)
- [Metro Minimalist Clock](https://learn.adafruit.com/metro-minimalist-clock.md)
- [Adafruit PCF8523 Real Time Clock](https://learn.adafruit.com/adafruit-pcf8523-real-time-clock.md)
- [MacroPad 2FA TOTP Authentication Friend](https://learn.adafruit.com/macropad-2fa-totp-authentication-friend.md)
- [Blahaj Alarm and Lamp](https://learn.adafruit.com/blahaj-alarm.md)
- [Adafruit DS3231 Precision RTC Breakout](https://learn.adafruit.com/adafruit-ds3231-precision-rtc-breakout.md)
- [DS1307 Real Time Clock Breakout Board Kit](https://learn.adafruit.com/ds1307-real-time-clock-breakout-board-kit.md)
- [Raspberry Pi Wearable Time Lapse Camera](https://learn.adafruit.com/raspberry-pi-wearable-time-lapse-camera.md)
- [2.2" PiTFT HAT Enclosure](https://learn.adafruit.com/3d-printed-2-2-pitft-raspberry-pi-a-plus-enclosure.md)
- [How we designed an injection-molded case](https://learn.adafruit.com/how-we-designed-an-injection-molded-case-for-raspberry-pi.md)
- [Getting Started With Windows IoT Core on Raspberry Pi](https://learn.adafruit.com/getting-started-with-windows-iot-on-raspberry-pi.md)
