Now that the hype is really building up around the Raspberry Pi 2 Model BRaspberry Pi 2 Model B, many of us are quickly

100_2071_small.jpg

snapping up available stock. However, one of the most asked questions is whether or not peripherals are compatible with the new Pi. So I decided to test out the PiFace Real Time Clock ShimPiFace Real Time Clock Shim board with both my classic Piclassic Pi, and my brand spanking new Pi 2.

 

One of the complaints Pi users have is that there's no built-in hardware clock on the Pi. According to the Raspberry Pi foundation, there's a couple reasons why they didn't include one: first, the board was aimed at education first, and embedded applications second. This is why we didn't see something like the Pi Compute module on release. Second, the increase to the cost of the board would have been too much, and the amount of board space required to mount a CR2032 or similar battery would have been prohibitive. It's understandable, as accurate clocks are not a big deal most of the time, and most Pis are connected to the Internet and have the NTP (Network Time Protocol) running, so they automatically update on boot.

 

However, in many applications including cryptography, software development (using Git or another version control system), or running a web server, time accuracy is crucial. RTC (Real-Time Clock) modules are a great solution. They provide very accurate timekeeping – some models have parts per billion accuracy – at quite a small cost. The PiFace RTC Shim PiFace RTC Shim is a good example. At around $12 on Newark, it's a great peripheral to add if you need it!

Originally designed for the Pi Model A and B, the header connector is not designed to be soldered to. Instead, four of the header pin holes are slightly offset, so when it is mounted on a header, the pressure created helps make good contact with the important pins. I've noticed that despite the pressure, it doesn't bend the pins at all – rather, it just hold the Shim in place. This allows a ribbon cable to be attached over the Pi, without interfering at all, hence the 'Shim' in the name. In my opinion, it's an excellent design, and an underrated product!

 

So, let's try it out. As mentioned, it fit snugly on the header pins without bending them. I was very impressed by how well it fits; it sits just high enough off of the board to not touch or short to anything, while also making the best use of space and still allowing a ribbon cable connector to go on top of the header. After attaching it to my original Pi, I at first had problems getting it set up. The website makes it look as simple as running one command:

 

sudo hwclock -r

 

However, for initial setup on Raspbian, you have to download a shell script and run it first. I highly recommend doing a quick update on Raspbian before installing -- just run sudo apt-get upgrade I believe this script activates the I2C module, and enables it on boot from then on. However, you can achieve the same effect by running

 

sudo raspi-config

 

and choosing I2C in the Advanced menu. Just tell it to load on boot automatically. I had done this before running the script, and I don't know if it made any difference. Even with the I2C module activated, it won't 'see' the RTC without running the script. After running the script, reboot your Pi and then use the following command format:

 

date -s "15 APR 2015 22:01"

 

This will set the time, and on reboot it writes this time into the RTC. After rebooting, running the date command will show you the system time has been restored. What an easy setup!

 

The beauty of this module is that it will keep time, even if you pull it off of the Pi, for up to two years. Remember that it requires a CR1220 battery, not the more common CR2032, which shouldn't be too hard to find. You can either order one with your Shim from Newark/element14order one with your Shim from Newark/element14, or find one at your local hardware store. Transferring between different Pis is easy – just be gentle when levering the Shim up off the header.

 

Now for the big test – will it fit onto and work with a new Pi 2? When I first looked at the images, I had doubts that it would, as the design was made to fit over the smaller, 26-pin header, not the new 40-pin one. However, when I had it in my hands I could see how close the board outline is to the header pin holes – thin enough to fit between two rows of the Raspberry Pi's header! So, I slid it onto my Pi 2 and voila! It worked like a charm. This is a huge plus for the Pi 2 – the increased performance, with an RTC added, makes it even more attractive as a basic desktop computer. With accurate timekeeping, it can be used more easily in embedded projects without needing internet connectivity, a huge plus when designing such projects. This is the type of accessory which can also help push the new Pi 2 into the small computer replacement market. Having accurate time, as I mentioned earlier, is very important in a lot of applications. Not to mention, being able to glance at the screen and have the correct time is not too shabby by itself!

 

100_2074_small.jpgTrue, if your Pi is always connected to the internet, it can use the NTP service to update the time on boot. However, many applications for the Pi use it without internet access, and in some projects I've seen the ethernet or wi-fi was only being used to set the time! This is an ideal application for this board, as it allows the Pi to stand alone offline.

 

The Raspberry Pi Foundation has put a great emphasis on compatibility between versions of the Pi. The RPF 'Hat' standard is attempting to standardize the layout and size of add-on boards, similar to Arduino's R3 shield system. This is a great move, as demonstrated by this board. Even when they add or remove header pins in the future, compatibility should be maintained. If you're interested, you can view the entire specification here:

 

https://github.com/raspberrypi/hats and some notes about the hat standard here:

 

https://www.raspberrypi.org/introducing-raspberry-pi-hats/

 

One of the new features is the addition of an EEPROM identifier chip on Pi hats which meet the standard. The Pi can then use this information to essentially make the board plug and play – automatically loading the needed modules and self-configuring as needed. This is a great idea, as it will allow first-time users and those inexperienced in working with Linux the ease of use that the Pi deserves to have.

 

Stay tuned for more testing of the new Raspberry Pi 2! I'm going to go through a few more of these accessories, to see which are forward compatible with the new Pi. This should be very interesting – if manufacturers follow the RPF Hat standard, we can save a few bucks by re-using our existing accessories with the new Pi!

 




Have you tried out any of your old hardware with the new Pi 2? Did it work? Did you have problems? Let me know in the comments!