Raspberry Pi 5 has a Real-Time Clock. So What?

Real-Time Clock Title Image

One of the big features of Raspberry Pi 5 that is getting a lot of attention is the Real-Time Clock (RTC). On almost every device these days, from smartphones and laptops to washing machines and cars, you’ll find an RTC.

But Raspberry Pi 5 is the first flagship product to come with an RTC. (The Pico has an RTC!)

I’ve got to be honest with you for a second, we actually sell some RTC add-ons for Raspberry Pi at our sister company. And I never even looked at one closely before the announcement of Raspberry Pi 5.

I never really thought about them. Who needs an RTC? I certainly haven’t needed an RTC in any of my projects.

So, I was a bit surprised that people were so enthusiastic. And thus I decided to do some research and get to the bottom of my burning question: Who actually needs an RTC on a Raspberry Pi?

Our Raspberry Pi 5

Of Clocks and Crystals

So, first things first, what’s a Real-Time Clock?

For Raspberry Pi 5, the RTC is a hardware component that keeps track of the current time and date independently of the main processor. It consists of a low-power clock circuit. You can power this circuit with the standard 5V supply or with the RTC battery.

Raspberry Pi 5 RTC battery

It’s a Panasonic ML-2020 Lithium Manganese Dioxide battery and it allows the RTC to operate even when the Raspberry Pi is powered off. The battery is rechargeable, of course.

And, I should mention, the battery has a double-sided adhesive pad. So you can stick it to a wall or surface. Or, it’ll even fit inside the official case.

Anyway, the RTC module includes a crystal oscillator that generates a stable clock signal (32 kHz). This signal is divided to provide accurate seconds, minutes, hours, days, months, and years.

When the Raspberry Pi 5 boots up, it reads the time and date information from the RTC module.

The RTC continues to keep track of time, ensuring that the system always has an accurate reference, even if there are power interruptions or reboots. And this works even if it’s not hooked up to the internet or a Network Time Protocol Server.

However, if you’re relying on the battery alone, then you should know that it’s likely going to last around 6 months.

RTC on RPi 5

The RTC on Raspberry Pi 5 is controlled by the Power Management Integrated Circuit on the bottom left of the board.

Power Management IC

This integrated circuit was actually a custom-designed Power Management IC for Raspberry Pi 5. And it’s worth talking about a bit in detail.

It’s I2C-controlled.

It’s got eight Buck Switched-Mode Power Supply regulators and three Low Drop-Out regulators. Buck SMPS regulators are efficient in reducing voltage from a higher level to a lower level, while LDOs maintain a stable voltage output with a minimal voltage drop.

It’s also in control of the HDMI 5V switch, the USB-PD PHY, the power button, and, of course, the RTC.

If you look at the picture above, you’ll see the little yellowish port labeled “BAT” – which is where the RTC battery plugs in.

So much for hardware.

On the software side, the RTC communicates with the system via firmware mailbox interface.

Additionally, the RTC can often be programmed to generate alarms or wake-up signals at specific times.

This feature is useful for triggering events or waking up the Raspberry Pi from a low-power state to perform scheduled tasks.

Moreover, The RTC driver autoloads at bootup, following normal Linux hwclock behavior. So the RTC driver automatically loads during startup and it behaves according to standard hardware clock behavior in Linux.

So What?

Now we arrive at what all the hubbub is really about. Because this is all very well and good, but what does it matter?

Well, as I already indicated above, an RTC is important for applications where you want your Pi to fall asleep, wake up, and then fall asleep again. This is really valuable for energy efficiency.

First, one of the most obvious examples I’ve found is with security cameras or animal cams.

You can hook up a camera to the Pi and then give it a sensor. When it senses movement, it can wake up, snap a photo, and then go back to sleep. So this would then be useful with bird cams and squirrel cams or even a wildlife conservation project.

Second, another application that also involves animals would be a cat/dog recognition camera for a pet door.

I have to admit that, being a pet-less person, I’m not sure on how this would work. But someone suggested it on the Raspberry Pi forums – a pet door that uses a camera to recognize the animal before opening. I guess this would keep random animals from entering your home.

Comment below if you have any clue to how this might work!

Third, you could use the RTC to synchronize time across a fleet of Raspberry Pis.

Because RTCs enable timestamping even when your Raspberry Pi 5 is offline, you can guarantee accurate data-logging. I think there are probably an unlimited number of scientific and industrial applications for something like that.

Fourth, and finally, it helps ensure the operating system runs properly, even when your Pi is offline. And while this one is ultra mundane, it’s maybe the most important case normal people will use the RTC.

Obviously, if the clock on an operating system is incorrect or even just begins to drift, then the whole thing can go haywire. So, by using the RTC, the Raspberry Pi OS is also going to function better. It’s not going to run into potential security issues, for example.

Also, the operating system will be able to guarantee timestamps, log files, and scheduled tasks.

I have to admit that after reading more about it, I’ve become convinced that they should’ve included an RTC on flagship products a long time ago.

And I’m not alone – Eben himself (at 6:28 in the video below) exclaims, “Congratulations: so after twelve years of Raspberry Pi we finally have an RTC and a power button!”

Before you go, check out our contest!

Contest & Newsletter

We know how frustrating it is to have to wait until October 23rd for a Raspberry Pi 5.

So we wanted to make it possible for you to play around with one as soon as possible.

So we’ve set up a contest: What’s the craziest thing you can come up with for Raspberry Pi 5?

Raspberr Pi 5 Contest

Provided your idea doesn’t destroy it, you can send us your idea and we’ll enact it on ours – and write an article about it!

We’ll announce the winner here and on buyzero.de on October 23rd.

The winning idea (determined by us) will win a full Raspberry Pi 5 kit – including with a 27W USB-C Power Delivery (PD) Power Supply, a Raspberry Pi 5 case, an SD card, and a Raspberry Pi 5. All with free shipping within the EU.

The runner-up will win a Raspberry Pi 5 with free shipping within the EU.

So be sure to send in your ideas – you can go to the following link for more information: WIN A FREE RASPBERRY PI 5!

Conclusion

So there are some applications you can do with an RTC on Raspberry Pi 5!

Do you have any ideas on what you’ll use the RTC for? Comment below!

And be sure to check out our other articles on Raspberry Pi 5:

1 Comments

  1. John on February 27, 2024 at 10:10 pm

    The RTC + battery comes in handy for offline media servers. Kodi keeps track of what you watched and when. My RPi4/Kodi media server is offline 99.99999% of the time and only allowed out once an eve for NTP (firewall rules keeps it honest). This requires an manual step for me to sync every eve. Will be upgrading to the RPi5 just for the battery & RTC.

Leave a Comment