Back to Hardware

Assembly Instructions

22 Apr 2019

This is the instruction manual for assembling the Precision Clock Kit.

Click here for the lengthy writeup explaining how the clock was developed.

Contents

These instructions follow exactly the same steps as the video I posted, but with a bit more annotated detail. In these pictures, the PCB has "Rev 3" printed on it.

Some general soldering advice:

Tools needed

List of components in the kit

One ATtiny microcontroller (either an ATtiny2313, ATtiny2313A, or an ATtiny4313):

One 20-pin dual-in-line socket:

Two MAX7219 display drivers:

Two 2N5401 PNP Transistors:

One 1uF Ceramic Capacitor:

Three 100nF Ceramic Capacitors:

One LDR (light dependent resistor):

One 20k Resistor:

One 10M resistor:

One 50k Potentiometer (trimpot):

Nine 3mm red LEDs (note – they may have a clear plastic housing, but don't worry, they will still light up to be red):

One 5.5mm x 2.1mm Barrel Jack:

One 5-pin header:

One 2-pin right-angled header:

One pin jumper:

One GPS module, with antenna:

Eighteen one-inch common cathode 7-segment displays:

One USB power cable:

Nine laser-cut parts, of varying thicknesses:

And of course the most important part, one big red PCB:

Steps

The order of soldering everything together isn't too important, the only thing to remember is that the digits, and the colon LEDs that sit in a laser cut frame, should all be left until the very end. Other than that, it's best to start with the smallest components, because they're the fiddliest.

1.

Start with the right-angle header for DST enable. If you live in region that does not have daylight saving time at all, you can skip this step if you like.

I used the jumper to help hold the part in place as I put the PCB upside down. This makes sure there is enough room to slide the jumper on and off the header later.

2.

Next fit the three 100nF capacitors. Ceramic capacitors do not have a polarity, so it doesn't matter which way round you fit them.

You can bend the legs outwards a bit, which will help to hold it in place as you solder. As with all of the through-mounted parts in this kit, you should cut the legs shorter after soldering the parts in place. You're allowed to leave all of them long until the very end, and cut them all at once, but I find it easier to cut them as I go.

3.

Fit the 1uF capacitor. Again it's a ceramic capacitor so there's no polarity to worry about.

If we were going to fit the optional MCP1700 regulator, we would need to populate both of the 1uF footprints, but without the regulator only one capacitor is needed. You can fit it into either footprint, it doesn't make any difference.

4.

Fit the DIL (or DIP) socket to hold the ATtiny. The reason we are using a socket is so that it's easy to take the ATtiny out later, if we want to update the firmware. It also could potentially function as an expansion slot for a daughterboard to connect to!

There is a small D-shaped cutout at one end of the socket, which you should line up with the mark on the silkscreen printed on the PCB.

I tend to solder the corner pins first, so that everything is held in place for the rest of the joints.

5.

For the MAX7219 chips, you will need to bend the legs inwards slightly. The best way to do this is to press them gently against the desk. There's a knack to doing this neatly. Even if it's not too neat, as long as you can eventually fit the part into the holes in the PCB, you should be fine.

Make sure to line up the D-shaped cutout with the outline on the board. Double-check this before you solder it in place. If you fit the chip the wrong way around, the clock won't work!

6.

Fit the PNP transistors. The flat side needs to match the flat side of the outline on the PCB. Sometimes the transistors are made with straight legs, so you have to bend them outwards a bit to fit into the footprint.

7.

Fit the 10M resistor. This sets the minimum brightness of the clock. If you don't fit this part, at night time the display will go so dark you won't be able to read it.

8.

Fit the LDR. This is the light sensor that controls the brightness of the display. I bend the legs so that the LDR faces sideways off the edge of the board, which I find works well when the clock is against a wall. If you have a place in mind for the clock, it might make sense to point it in a different direction, or leave the legs longer so you can decide later.

9.

Fit the 50K trimpot. This controls the maximum brightness of the display.

After you've fitted it, you can adjust this using a screwdriver (or your fingers if you're dexterous). I suggest leaving this in the middle though. I mostly wanted this to be adjustable so that you can turn the brightness down if it's annoying.

10.

Fit the barrel jack.

These holes are huge, and the pins are very flat, so it will take a lot of solder to fill up the gap.

Patience is important, you want the joint to be nice and clean because this is where all the power to the board comes in. It's also good if it can withstand the mechanical strain of someone violently yanking the cable out. It could happen!

11.

Fit the 20K resistor and the 3mm LED to the "GPS Fix" indicator. You can skip this step if you want, since the GPS fix is also indicated by the colons blinking. I like to have this little LED though, because the colons are controlled through software, but this LED is hard-wired to the PPS signal. It will light up at the start of a second with an accuracy of within 50 nanoseconds.

LEDs have a polarity: you need to fit them the right way around. The long leg is the anode (the positive side), and the short leg is the cathode (the negative side). There is also a flat spot on the LED moulding itself next to the cathode, so even if the legs are trimmed down you can still work out which side is which.

12.

Fit the 5-pin header to the GPS footprint. If you are planning on experimenting more with the GPS unit, you may want to attach it using some wires instead of this header, as that'll be easier to desolder, if you want to do that later. Another option is to fit a female header connector to the GPS module, and then you'd be able to hot-swap them.

Before you solder the GPS unit in place, I recommend you fit the antenna to it. In the video I forgot to do that until the end. You need to align the tiny coax connector and press down firmly until it snaps into place.

You can then solder the module in place. For it to look neat, I solder one leg first, then gently melt the join as I lift the module to be parallel to the board underneath. Then once that joint has cooled, you can let go and solder the rest.

13.

It's time for the other side of the board! First up are the four LEDs which illuminate the timezone indicator. Remember to get the polarity right: long leg is +.

These can be soldered flush to the board.

Before we fit the digits, it's important to look at each one and straighten the legs. They always arrive with most of the legs squashed, and you need to gently bend them back with tweezers or pliers, otherwise you'll have a hard time fitting them into the PCB.

You also need to peel off all of the protective films (trust me, it's a lot easier to do this before they're soldered down).

Fitting all of the digits is quite tedious, and if you're not careful it's easy to accidentally turn it upside down and most of them will fall out. Make sure that the decimal point is at the bottom, just like the outlines printed on the PCB.

Finally there's the mammoth task of soldering all 180 pins. It doesn't take all that long really, and it's excellent practice for getting nice clean solder joints.

14.

For the colon LEDs, as an optional step, you may want to file down the top of them. You can do this with sandpaper or a needle file. It's not too important (I didn't do it in the video) but it will improve the viewing angle and make them flush to the board. If you want to do this, it's much easier to do it before soldering the LEDs in place.

Before we can solder the colon LEDs, we need to glue the laser-cut parts together. There are two sets of three plywood pieces. The black-painted piece needs to go at the top, and has holes that the LEDs can poke through snuggly. The other parts need to be glued behind it, with the wider holes lining up.

The video shows how to do this, but if you are not used to using super-glue, I advise you to use very little of it. Shake the container before you pour it out so that it's mixed properly (often, cheap glue is diluted, and if it separates you'll pour out a liquid that doesn't glue things together well at all).

When you stick the pieces together, keep pressing on the sides and the top, so that the boards are not mis-aligned. You want to be sure that it will fit between the digits on the PCB.

When the glue is set, you can slide the LEDs into the board (again, check the polarity) and push the laser-cut frame over it. Then, push the LEDs forwards so that they poke out a bit, and solder the legs in place.

When you're soldering the LEDs, be careful that when you turn the board over you don't push them out of alignment. I used the handle of my wire cutters to support the board as I soldered this step, so the LEDs weren't pressing against the table.

15.

The timezone marker is comparatively easy to glue together. Just be sure that the pieces line up to be able to fit inside the gap between the digits.

The last thing to do is fit the ATtiny into its socket. Make sure to line up the D-shaped cutout with the marking on the board (and the cutout in the socket). If you're in doubt, the text on the chip that says "ATTINY" should be the same way up as the text on the PCB underneath it.

An optional extra last step: if you don't like the GPS antenna to be dangling off the end, you can tape it on top, like this. I don't think it has any effect on the signal strength as far as I can tell.

16.

It's time to power up the circuit! Plug in the 5V power cable and connect it to a suitable supply (such as a USB power adapter). The display should light up with hyphens all the way across, and the seconds/centiseconds should start ticking.

You now need to leave the clock to do its first-time warm-up, which will take anything between ten minutes and a few hours.

Usually the display will suddenly update to have the time and date within about 20 minutes. I recommend leaving the clock near a window, or even better to take it outdoors. Lots of electronics like TVs and computers can give off electromagnetic noise which can interfere with the GPS signals.

Eventually, it will have found enough of the satellites to have a GPS fix, and this will be shown by the colons flashing on and off each second. Also, the "GPS fix" LED on the back will be blinking once a second. The time will now be exactly right.

Troubleshooting

I will fill out this section further when I have some examples of what might go wrong. If you have a problem, post in the forum and I will try to respond within a day.

How to change the timezone

You will need a way of loading new code onto the ATtiny microcontroller. The way I do this is with a USBASP adapter, which costs about £1.50. I believe you can also use an Arduino as a programmer instead, so if you already have one of those that might be easier.

I have a special test clip which I've wired up to reprogram these chips without taking them off the board, but if you're not doing this all the time it's probably easier to stick the chip into a breadboard.

Power off the clock, and remove the ATtiny from its socket. Don't be tempted to use your fingers, it always ends with the legs getting bent. Use a screwdriver to lever it up from one side, then the other side, and keep working it until it comes out.

Use some male-to-female jumpers to connect the USBASP to the breadboard.

There's a little jumper on the USBASP board that sets the voltage. Either 5v or 3.3v is fine, just make sure the chip is powered.

In the source code repository I've included a build folder which has pre-built hex files for different time zones. If the one you want isn't there, let me know!

You need to install the "avrdude" software to load this file onto the chip. On some platforms, you may also need a driver (such as libusb) to use the USBASP. I can give more detailed instructions if anyone needs them, or you can try googling for it – there's a lot of information about doing this out there.

The command to flash the chip to US Eastern Time would be:

avrdude -c USBASP -p t2313 -U flash:w:us_eastern.hex:i

Or if your ATtiny chip is actually an ATtiny4313:

avrdude -c USBASP -p t4313 -U flash:w:us_eastern.hex:i

Then stick the chip back into the clock, and see if it works! For timezones which don't have daylight saving, you will want to have the "DST enable" jumper not fitted, or it'll be permanently an hour ahead.

Optional Steps

Fit LDO

All of the GPS modules I could find now have their own 3.3V regulator on board, so they can run straight from the 5V supply. The module I used in the original clock would only run from 3.3V though, so I originally planned to have a regulator on board.

If you want to use a different GPS module that only supports 3.3V, you can fit the regulator here. You need to cut the trace between the "in" and "out" legs on the board for it to work.

You also need to add another 1uF capacitor in the remaining footprint.

Fit Crystal

You can solder an 8MHz crystal into the footprint next to the ATtiny to give it a more stable oscillator. The footprints on either side are for load capacitors, which will need to be matched to the crystal, with values of a few picofarads. By carefully selecting the load capacitance, you can adjust the crystal's frequency slightly, and dial it in to a perfect value. (But it will still vary with temperature, of course.)

There is not much point in doing this normally, because the interpolation tracks the PPS signal from the GPS very accurately. If the GPS loses its signal, and the PPS signal stops, the GPS unit continues to spit out what it thinks the time is, which will eventually drift away from what the ATtiny is displaying.

In the picture, I left the leads long, so I can edit the capacitance if needed.

If you fit the crystal you will, at the very least, need to change the fuse settings on the ATtiny to tell it to use the crystal as a clock source. (Set the low fuse to 0xCF) You will also probably want to use a slightly modified firmware image, that ignores the GPS data if it is not giving a PPS signal.

A better option would be to fit a temperature-compensated clock source, but I am still researching the best solution here. I may release an expansion board that augments the "offline" behaviour of the clock.

Extra Capacitors

I'm not convinced this makes much of a difference, but you may want to add some big electrolytic capacitors to the power rails near the MAX7219 chips. When running at full brightness they're switching a fairly substantial current, which is potentially causing electromagnetic interference (EMI). An alternative version of the display driver chips from Maxim is specifically slew-rate limited to reduce EMI, so they clearly thought this was a problem.

Adding a 10uF in parallel with the 100nF capacitors already there may help to reduce the noise on the power line.

If you find it too tricky to solder multiple capacitors to the power rails around the MAX7219 chips, another option would be to stick a big capacitor (say, 47uF or 100uF) in the remaining 1uF footprint. Note the polarity if you do that – the pin connected to the ground plane (copper pour) is of course the ground pin.

The reason not to add too much capacitance is that it goes against the USB specification. Lots of capacitance causes a large inrush current when it's first plugged in, which can cause a USB hub to think there's a short and cut the power entirely. If you're only powering the clock from a mains-to-USB adapter then this probably isn't a concern.

Battery Backup

The provided GPS module has a small supercapacitor which is supposed to allow the module to keep time and maintain its volatile memory while powered off. But in my experience these things are extremely unreliable, and go flat in anything between a few minutes and a few hours. (To contrast, the original MkII clock that I built had a module which is no longer available, but that one seems to remember the time even after a few weeks of being powered off.) The real benefit of keeping the module powered is that it can do a warm start. With the clock on my windowsill, I can power it on and it will usually have a full GPS fix within about ten seconds.

If you want to power off the clock for more than a few minutes at a time, the best thing to do is to replace the crappy supercap with a 3V coin cell battery.

The supercap is located on the corner of the GPS module. Ignore the extra wires in these pictures, I'm doing this to my debugging clock which has been victim to several experiments.

To remove the supercap you can either use a heatgun or a soldering iron. It's quite fiddly with a soldering iron but you're less likely to desolder everything else in the process. Just melt one edge, lift it up slightly, and melt the other. You could also simply use a razor blade to remove the supercap, but be careful not to cut the traces on the board.

The rectangular pad is the ground pin, the triangular pad is the positive pin. I decided to stick the coin cell holder on top, which isn't particularly elegant. The stiff wires hold it in place. With some planning, you could glue the battery holder somewhere else on the back, and use longer wires.

With this, it's possible to take the clock outside until it gets a GPS fix, then power it off and take it indoors, where it will find the fix much sooner than it would have done otherwise.

NTP time source instead of GPS

If you really can't get a GPS fix indoors, you may want to consider ditching GPS entirely. If you desolder the module and connect a USB-serial adapter in its place, you can send fake NMEA strings to the clock from either a desktop computer or a raspberry pi. Network time is generally accurate to within 50 milliseconds which should be plenty good enough for most uses.

Only three wires need connecting: Ground, PPS and TX. The TX on the USB-serial adapter should connect straight to the TX pin on the PCB (the labels are there to match the footprint of the GPS unit, there is no need to worry about cross-over). The PPS signal should be connected to RTS on the USB-serial adapter.

In the source code repo there is a simple python script which will synchronize the clock very accurately to align with the system clock of the device running the script. Of course, make sure that the network time service is actually enabled and running on your device if you want it to be accurate.

Even better time sources

The reason for upgrading to a "better" (more expensive) GPS unit is not for accuracy, but for reliability. If you have the budget for it, there's an entire spectrum of GPS units intended for accurate timekeeping. Most of these devices are aimed at the high-speed stocks trading industry, where reliability is paramount. Using a marine style antenna will give a generally better GPS signal. Some of the more advanced units are specifically built to be immune to GPS jamming.

Another extremely accurate time source is PTP, the Precision Time Protocol. This replaces NTP, again aimed at high-speed trading, and uses dedicated network hardware to compensate for routing delays to give a time pulse with picosecond accuracy.

If you happen to own a device like this, it's very easy to use it with the Precision Clock. Pretty much every accurate timekeeper is able to output NMEA strings at 9600 baud. By connecting this serial data and the PPS signal between the devices, the Precision Clock will simply function as a big precision display for the rack-mounted timekeeper. If anyone does this, please let me know, I'd be interested to hear about it.