Hardware Reference
In-Depth Information
Chapter 8
Adding an RTC
When I first looked at the Raspberry Pi there was one missing piece of hardware that stood out to me. This little piece
of hardware has been on pretty much every system you may have used, especially in recent years. What exactly is this
missing piece of hardware? It's the real-time clock, or RTC for short. In most modern computer systems you would
be hard-pressed not to find the RTC with a quick glance. What you would notice is that little silver coin - shaped
battery. Why would the RTC chip need a battery? The main function of the RTC is to keep the current time and date,
which has been set into the RTC chip.
This little chip then needs a very small power source in order to keep the RTC counting up. You know by now
there is no battery anywhere on the Raspberry Pi. Not all systems have a visible battery though. Take, for example,
Figure 8-1 : this is an RTC/NVRAM combo chip often seen on early SPARC systems.
Figure 8-1. A Sun SPARC RTC/NVRAM package
This RTC/NVRAM package will do more than just keep the date. It would also store system serial numbers and
MAC addresses. The battery is built in to this unit, making for fun times when the RTC does go flat. One thing you will
soon find out from this chapter is that the overall circuit and parts needed for an RTC have not shrunk much over the
years. Sure, you may now have a surface-mount technology (SMT) RTC package but your battery is still quite large
when compared to the modern SMT package (I'll cover SMT in this chapter, so don't worry if you're new to it).
There also is one small extra component you must have for the RTC to function. This is a crystal oscillator, and its
main task is to provide a timing source for the RTC. Unfortunately, crystals are not the most accurate timing devices.
Over time you will notice that your RTC will drift slightly. An RTC is never as accurate as a well-configured NTP
daemon. RTCs take up a lot of space, add complexity, and are not as accurate as NTP, so why would you want one?
Well, for the most part, you don't need it if your Raspberry Pi will always be connected to a network: NTP will be a
better option. What about when your Raspberry Pi never gets used on a network? Let's say, for example, you attach a
nice little LCD and use the GPIO pins to do something like read the temperature. Every time you reboot you're going
to have issues logging in because your system date and time will have drifted too far back in time. If you had added a
 
Search WWH ::




Custom Search