Throughout this project, I have been saying that the oscillator I am using, the DS32kHz, is accurate to 7.5 parts per million, or 4 minutes per year. Having run the clock continuously for about 3 weeks now I would expect the clock to have drifted by approximately 14 seconds. However, measuring the clock against the clock on my phone I have found that it has drifted by approximately only two seconds.
The clock is controlled by an ATTiny87 which has three main jobs:
- Counting the pulses from the Maxim DS32kHz
- Controlling the display via the shift registers (read more)
- Interacting with the user via the reed switches to produce a user interface
Each of these jobs will be discussed separately below as well as the main code to bring it all together in a power efficient way. Full code can be found at my GitHub.
As discussed in the previous article, the display is controlled by a number of shift registers. Shift registers can be controlled directly by a SPI bus, which is useful as most microcontrollers (including our ATtiny87) have a built in SPI bus peripheral. This means that writing a byte to the shift register is almost as easy as just writing a byte to a register.
My Nixie tubes have 11 active pins each: a common anode and one cathode per digit (ten in total). The anode is connected to +180V via a 47k current-limiting resistor and each cathode is connected to the collector of a high voltage bipolar transistor (MPSA42) so that current can be controlled through each of them via the base of the transistor. This gives a total of 29 transistors that need to be individually controlled (24 hour clock requires 3 possible numbers for the first digit, 10 for the second, 6 for the third and 10 for the fourth). I chose to do this by using four 8-bit shift registers, connected in series to make one, 32-bit shift register.
One big change since I did the first version of the clock is my access to professionally made PCBs. At the time, I was only able to produce PCBs via hand etching or using my home-made PCB mill. A board like this requires at least a double sided design which is not easy using the above methods and so I used veroboard. This is painfully slow and messy.
For the new version I will use a professionally made two layer PCB.
I really like my Nixie Clock that I built two years ago – but I don’t like to leave it on when I’m not around. The reason for this is that the Nixie tubes are powered directly from the mains which means that touching the Nixie tubes could result in a dangerous electric shock. While the tubes are protected under glass I don’t like the thought of someone accidentally tripping over it and getting electrocuted. So I decided to redesign the clock.
I am going to power the clock from a 9V wall supply and boost that voltage up to 180V to light the Nixie tubes. While this is still quite a high voltage, it is isolated from the mains and is much less dangerous.
My design is largely based on Threeneuron’s Pile o’Poo.
The clock is finished! I could barely be any happier with how it has turned out. I’m even pleased with the wood work.
The only exposed materials are wood and glass (excusing the wire out the back) and so far it hasn’t lost any accuracy, and it’s been running for 3 days.
Initially I did have some issues with it skipping time when touched but I traced that back to a loosely connected chip.
Time for a new project!
I want to make something that is not only functional, but also enjoyable to look at. To achieve this, I am taking my time to build a nice enclosure for the electronics.
I am using 66x6mm pine strip wood as well as some skirting wood to make a 198*198*33mm box within which will be the electronics.
To make the walls of the box with skirting wood requires mitre joints (45 degree cuts), however I have never done this kind of joint before so it was a learning experience.
The bottom and lid of the box were made with 3 pieces of strip wood glued together with a strengthening piece of wood.
Gluing is frustratingly slow, but the box just needs some varnishing and a bit of routing before it is done.
The clock uses the 50Hz mains signal to keep time. Therefore, we need some kind of circuitry to count the pulses, and convert them into minutes and hours.
For this I am using a series of CMOS logic 4017 Decade Counters. These chips basically count from 0 to 9, incrementing at each pulse on the Clock pin, and output a pulse once per cycle. However, they can be forced to have a shorter cycle, e.g. 0 to 5.
Therefore, to convert a 50Hz pulse into a 1Hz pulse, I pass it first through a decade counter from 0 to 9, producing a 5Hz pulse, and then pass that through a decade counter from 0 to 5, producing a 1Hz pulse.
This process can be repeated until I have a pulses with period 1 minute, 10 minutes, 1 hour and 10 hours. The counters generating each of these pulses can then drive the Nixie tubes.
This could all be done on a micro-controller very easily, and this would reduce the chip count from about 9 chips to 2 chips, however that is a bit boring and this way I learn more about digital logic. The result of this is some pretty complex wiring.
My original plan was to use my CNC to produce a single PCB for the logic board, however I found that the schematic was so complex that the board would either have to be double sided, or the traces be very thin. Both of these options are not feasible on my CNC, so the possibility of having a PCB was out the window.
Making the circuit on stripboard is much more fiddly and slow, with every connection having to be wired individually, however it actually worked out relatively compact and I’m happy with the results. Of course, if I wanted to produce multiple boards, it would make much more sense to design a PCB and get it made professionally.
Because this project operates largely at mains voltages, it is important that the circuit is not exposed when powered on. I also want to make sure that the board doesn’t slide around on my desk, potentially touching me. So I quickly put together a stand for the board to give the board a bit of weight and hold the board above the desk to prevent shorts (e.g. due to touching a screwdriver). So far this has been effective!