Unhook a Raspberry Pi from the mains and it forgets the time and date. It’ll only get them back again if you re-connect it to the Internet or enter the data manually. As a Pi user who doesn’t keep his kit connected – I usually wire and power it up when I need it – and doesn’t always bother with the Ethernet cable when he does, I’ve been after a decent real-time clock (RTC) add-on for quite a while. An RTC allows your Pi to keep time, even when the Pi’s power is cut.
I’ve tried several RTCs, but until now none of them have provided quite the right fit-and-forget functionality I wanted. They were either too bulky to fit into my Pi casing, or didn’t allow me to continue using the Pi’s GPIO ports. Others had an overly complex software install, sometimes requiring you to obtain an non-standard Linux distro.
Well, goodbye to all that nonsense. Now I have a real-time clock that fits the bill perfectly.
Ladies and Gentlemen, let me introduce you to the PiFace RTC.
You’ll have guessed from the name that it comes from Dr Andrew Robinson, the boffin behind the PiFace, an add-on that simplifies connecting all sorts of peripheral devices to the Pi. The PiFace is undoubtedly a clever bit of kit, but the PiFace RTC is an altogether smarter piece of design.
What Andrew clearly realised is that folk who need an RTC don’t expect it to be their Pi’s only add-on. He could have integrated an RTC into the PiFace, but a better approach was to design a separate unit that works alongside his main offering. And therefore, of course, with anything else you might want to connect to your Pi’s GPIO.
So, the PiFace RTC was designed to fit underneath other add-ons without restricting their access to the GPIO pins in any way, physically or electrically. What we have here is a board drops onto the Pi’s pins, which pass through holes in the board so that other kit can be clipped to them too.
The RTC’s back-up battery, a CR1220 coin cell, is small and the board itself incredibly thin, in order both to minimise the add-on’s vertical height but to ensure there is still plenty of pin left for devices placed on top of it. Pushed onto the pins, the PiFace RTC doesn’t even extend vertically as far as the Pi’s camera connector. Now, this thinness makes the PiFace RTC seem less than robust, but since it can be left in place on the Pi, that shouldn’t matter: it’s not a gadget you should be taking on and off.
You might be wondering how Dr Robinson has managed to make a Pi add-on without the customary chunky female GPIO connector. Other RTCs I’ve tried had just that: a thick plastic adaptor below and pass-through pins – usually much thinner and more readily bendable than the Pi’s own – above. Here comes the really clever bit: two of the PiFace RTC’s 26 metal-lined holes have been drilled fractionally off axis – you can just see this in in the photo at top. While the board still fits onto the Pi’s pins, it’s sufficiently distorted to force contact between each hole and its pin.
I’ve been using the PiFace RTC for about four months now, and I’ve not once had a mis-read when the Pi boots up and updates its own clock from the value proved by the battery backed board. Which communicates with the PI via I²C, by the way.
Software installation is easy: there’s no need to compile kernels or anything like that, just download and run a shell script to enable update the Pi’s system files to enable I²C and make it accessible to devices at start-up. Once the script has been run, you use the Unix date command to set the RTC’s own clock, reboot and… er… that’s it.
CR1220 batteries cost a pound or so and, says Dr Robinson, will last a couple of years in the RTC board. I’ve not had mine quite that long, so I’ll have to take his word for it. I can say it works as well with a Pi B+ is it does with a Pi. I’ll be trying it with a Pi 2 soon.
The PiFace RTC only costs £8.40 including VAT from Farnell/Element 14, which is cheaper than most other Pi RTCs. Even if it weren’t, the PiFace RTC would be worth a look for its ease of use and negligible impact on your ongoing use of your Pi.
I spotted the RTC quite a while back on the PiFace site. It had nothing but a ‘not yet available’ message, even though Farnell was selling the thing. This fact I discovered by accident. The PiFace site has since been updated, but the company should more of a noise about this small, useful, genius device.
Price £8.40 including VAT
More Info PiFace