Real-time clock for pi-top

From Spivey's Corner
Jump to: navigation, search

This is a very simple real-time clock with only four components, built on the pi-topPROTO board.

RTC Front.jpg

RTC Back.jpg


With Farnell/CPC order codes:

2515371  IC1  DS1307 real time clock
1652573  X1   32kHz watch crystal
2395773  C1   0.1μF ceramic capacitor
BT00449  B1   1220 Lithium Cell 3V nom.

BT06066       Through-hole battery holder
SC14383       pi-topPROTO board

RTC Circuit.jpg

RTC Layout.jpg


  1. Make track breaks at H11 and H12. These reduce the capacitative load on the crystal, improving accuracy and noise immunity.
  2. Add the wire links. The link from J9 to Gnd sits under the battery holder and can be bare wire. Both the other links (A8 to 5V and D8 to D12) pass over other holes, and need to be made in insulated wire.
  3. Add the crystal. Plated-through holes mean you can poke it into the holes and solder it in from the top of the board. Trim any excess from the leads underneath.
  4. Add the capacitor C1, bending its legs out carefully to span the holes. Be careful that strain on the legs does not separate them from the capacitor chip inside the bead.
  5. Add the integrated circuit IC1 with pin 1 at F12. Leave pins 4, 5 and 6 unsoldered for now. If you are not confident with soldering, you can use a socket; but I find they cause as many problems as they solve. It's best to solder one leg of the IC first, then check that it is sitting level before soldering the rest of the pins.
  6. Use a small piece of wire to link F7, F8 and F9 on the back of the board. This connects the ground pin of the IC with the decoupling capacitor and the negative terminal of the battery.
  7. Add the battery holder, with the negative pin at I7 and the positive pin (connecting to the top of the cell) at I10.
  8. Either use fine insulated wire (approx. 24AWG) on the back of the board to link pin 5 of the IC at E9 to pin 3 of the Raspberry Pi header, and pin 6 of the IC at E10 to pin 5 of the header. The RPi header pins are connected to numbered holes along the sides of the board. (This is my preferred mode of construction: it looks neat on the top of the board, and the fine wire is easy to strip with a thumbnail and wrap around the pins of a component.) Or connect C9 to header pin 3 and C10 to header pin 5 with thicker insulated wire on the top side of the board.
  9. Use a multimeter (preferably with an audible continuity indication) to check for shorts between adjacent IC pins, across the battery terminals, and between power and ground.
  10. Insert the Lithium cell into the holder.


  1. Follow the instructions on the AdaFruit site to install the needed software. The instructions refer to Raspbian Jessie, but work on Stretch too.
  2. If the chip is new, then the oscillator may not start until the state has been initialised. After that, it's possible to see an oscillation of about 1V P-to-P at pin 2 of the IC with the oscilloscope.
  3. To verify that everything is working well, you can disable WiFi, turn off the Pi-Top and reboot after 10 minutes. If the clock comes up accurate, then it looks like the RTC is doing its job.