Using the Official RTC Battery with Raspberry Pi 5
Learn how to install, configure, test, and troubleshoot the official rechargeable RTC battery on Raspberry Pi 5.
What the Raspberry Pi 5 RTC does
An RTC, or Real-Time Clock, is low-power hardware that maintains the date and time independently of the main operating system. Raspberry Pi 5 includes RTC hardware on the board and provides a dedicated RTC battery connector for a compatible backup battery.
The RTC can continue counting time when the Raspberry Pi is disconnected from normal external power, but only when a suitable battery is connected. The battery powers the clock circuit, not the computer.
| Capability | RTC battery result |
|---|---|
| Keep RTC time while main power is absent | Yes |
| Run Raspberry Pi OS while unplugged | No |
| Power USB devices or HATs | No |
| Prevent data loss from an abrupt power cut | No |
| Replace network time synchronization permanently | No |
Why an RTC backup battery is useful
Without a network connection or an RTC battery, a Raspberry Pi may not know the correct time after being unplugged. This can produce inaccurate timestamps until the system synchronizes with a time source.
Accurate time matters for system logs, file timestamps, scheduled jobs, sensor records, and TLS certificate validation. It is particularly important for offline field systems, data loggers, and installations that must perform time-based work immediately after boot.
A network-connected Pi can normally synchronize its system clock using NTP, the Network Time Protocol. However, network access may not be available during startup, may take time to become usable, or may never be available in an offline deployment. The RTC supplies a useful starting time before network synchronization occurs.
The official Raspberry Pi 5 RTC battery
The supported accessory is the official Raspberry Pi 5 RTC battery, designed for the Raspberry Pi 5 RTC battery connector. It uses a Panasonic ML-2020, a rechargeable lithium manganese dioxide coin cell. The supplied lead and matching connector are important parts of the assembly, as is the adhesive backing used to secure the cell inside a compatible case.
| Property | Value |
|---|---|
| Cell model | Panasonic ML-2020 |
| Chemistry | Rechargeable lithium manganese dioxide |
| Nominal voltage | 3 V |
| Continuous standard drain | 0.12 mA |
| Nominal capacity | 45 mAh |
| Weight | Approximately 2.2 g |
Battery chemistry and compatibility safety
ML-series cells such as the ML-2020 are rechargeable lithium manganese dioxide batteries. The Raspberry Pi 5 RTC battery circuit is intended for this type of supported rechargeable cell.
Do not substitute a non-rechargeable CR-series coin cell, such as a CR2032, or connect a loose coin cell with improvised wiring. An incompatible battery can have unsuitable charging behavior, connector wiring, polarity, or physical protection. Use the official battery or a verified electrically and mechanically equivalent rechargeable RTC battery assembly.
- Confirm that the connector matches the Raspberry Pi 5 RTC battery connector.
- Check polarity and keep the insulation intact.
- Do not short the battery terminals or cable contacts.
- Never use a damaged, swollen, leaking, or modified battery.
- Do not install a battery if its cable or connector is crushed, cut, or exposed.
Before connecting the battery
- Shut down the operating system normally.
- Wait until shutdown has completed.
- Remove the USB-C power supply and any other external power sources.
- Work on a clean, dry, static-aware surface and avoid touching unnecessary board contacts.
Handling the board while it is powered can cause accidental shorts or connector damage. A normal shutdown also protects files and avoids confusing a battery test with an unsafe power interruption.
Locating and connecting the RTC battery
Locate the dedicated RTC battery connector on the Raspberry Pi 5 board. Use the board markings and current official Raspberry Pi board documentation to identify it rather than relying on a connector that merely appears to fit.
- Orient the battery plug so its keyed shape and contacts align with the board connector.
- Place the plug squarely against the connector.
- Insert it gently and evenly. Do not force it, twist it, or push at an angle.
- Inspect the connection to make sure the plug is seated and the cable is not under tension.
- Route the lead away from fan blades, sharp edges, exposed contacts, headers, and locations where a case could pinch it.
Do not attach the adhesive pad until you have checked the cable route and confirmed that the case will close without pressing on the cell or connector.
Installing the battery inside a case
Check the case clearance before sticking the battery in place. A suitable location has enough room for the cell and cable without bending the lead sharply or pressing the battery against the case lid.
Use the adhesive backing only on a clean, dry, nonconductive interior surface. Suitable spare space may be on an internal case wall or another flat area that does not obstruct ventilation. Keep the cell away from:
- Fan blades and other moving cooling parts
- Hot components and heat sources
- Exposed solder joints or electrical contacts
- Sharp edges
- Ventilation openings
- Case clips and seams that could pinch the cable
Some compact cases do not provide safe space for the battery. If the cable cannot be routed without pressure or the cell contacts a hazardous area, use a different compatible case rather than forcing the installation. See Raspberry Pi 5 Official Case and Raspberry Pi 5 Active Cooler when planning case and cooling compatibility.
Initial time setup and RTC operation
The system clock is the active date and time used by Linux. The hardware clock is the time held by the RTC hardware. During operation, the system clock is used by programs; the hardware clock provides a retained time source when the board starts without normal power.
The battery does not automatically make an unset clock correct. First provide an accurate system time, either through NTP or by entering it manually. The operating system and supported RTC configuration then need to read the RTC at boot and, when appropriate, write the correct system time back to it.
Check system time and synchronization
timedatectl status
dateRun these commands after boot to inspect the current system time and synchronization state. If networking is available, allow the system to obtain a known-correct time before testing the battery.
Read the hardware clock
sudo hwclock --showThis should return the RTC time when the RTC device and operating-system support are functioning. The exact display format may differ from the system clock output.
Offline initial setup
When NTP is unavailable, set the system clock from a trusted time source:
sudo timedatectl set-time "YYYY-MM-DD HH:MM:SS"
sudo hwclock --systohcUse hwclock --systohc only after the system time is accurate. Normal Raspberry Pi OS behavior and the available RTC support should be checked before treating this manual hardware-clock write as required.
Safe RTC retention test
A network can hide an RTC problem by correcting the clock immediately after startup. To test retention, prevent network time synchronization from changing the result, or perform the check before the network becomes available.
- Connect the official battery and inspect the installation.
- Boot Raspberry Pi 5 and set or synchronize the system time.
- Compare
dateandsudo hwclock --show. - Shut down safely:
sudo shutdown -h now- Wait until shutdown is complete.
- Disconnect USB-C power and leave the board without normal power for a period.
- Reconnect power and boot without allowing network synchronization to mask the result.
- Check
dateandsudo hwclock --showas soon as possible. - Reconnect the network afterward and allow normal time synchronization.
Do not remove power during normal operation solely to test the RTC. An abrupt power cut can corrupt data and does not test safe shutdown behavior.
Expected behavior and limits
The battery maintains the RTC time while Raspberry Pi 5 is disconnected from main power. It does not provide uninterrupted computing power, preserve unsaved work, keep services running, or prevent damage from an unsafe shutdown.
RTC accuracy and backup duration depend on cell condition, the RTC circuit, temperature, and elapsed time. A retained time value can slowly differ from a reference clock. Replace the supported battery assembly when the retained time becomes unreliable, and follow appropriate battery-handling and disposal practices.
Troubleshooting
| Symptom | Likely checks | Expected resolution |
|---|---|---|
| The date resets after unplugging | Check that the supported rechargeable battery is connected to the intended connector; reseat the plug; inspect the lead; confirm the clock was correct before shutdown and written to or synchronized with the RTC. | Correct the connection or replace the battery assembly if its condition is poor. |
| The time is correct only after internet access | Network synchronization may be correcting the clock before it is checked. Compare hwclock --show with date while disconnected from the network. | Repeat the test without network synchronization and investigate the RTC if the hardware clock is wrong. |
| The hardware-clock command cannot access an RTC device | Check the connector and Raspberry Pi 5 model; update Raspberry Pi OS and firmware using supported procedures; review current official operating-system documentation for RTC detection and support. | Resolve support or configuration issues, then repeat the hardware-clock check. |
| The battery installation does not fit the case | Inspect clearance, cable routing, fan movement, heat sources, exposed contacts, and pinch points. | Relocate the cell to a safe nonconductive surface or use a compatible case with adequate space. |
| The connector became unreliable after fitting the case | Check whether the case pressed on the plug or cable, loosened the connection, or damaged the lead. | Power down, remove external power, inspect and reseat the connector, and replace damaged parts. |
Practical examples
Offline field data logger
A sensor logger may have no internet access at a remote site. With the clock set before deployment, the RTC can preserve meaningful measurement timestamps across normal shutdowns and power outages.
Home server after an outage
After a mains interruption, retained RTC time gives logs and startup services a sensible timestamp before networking and NTP are ready.
Scheduled automation
A time-based project can start with a valid clock instead of waiting for a network time source before running scheduled jobs.
Case-mounted battery
The adhesive-backed cell can be secured inside a compatible case when there is clear space, while the lead is routed away from cooling hardware and pressure points.
Key points to remember
- Raspberry Pi 5 has onboard RTC hardware, but it needs a connected backup battery to retain time without external power.
- The official battery uses a rechargeable Panasonic ML-2020 lithium manganese dioxide cell rated at 3 V nominal voltage and 45 mAh nominal capacity.
- Do not substitute a CR-series non-rechargeable coin cell or an improvised battery connection.
- Install the connector with power removed, align it carefully, and never force it.
- Set accurate time before expecting the RTC to preserve it.
- Test without network synchronization hiding a failed or disconnected RTC battery.
- The battery maintains time only; it cannot run Raspberry Pi OS or protect against data loss.