I’ve built several Nixie Clocks, most of them based on the Propeller Microcontroller. This time I decided to put one of my spare Raspberry Pis to use, and show a little bit of insight into my design process.
The High-Voltage Components
I started with two building blocks I already had, my generic Nixie Driver Board and my HVPSU board:
The HVPSU is described elsewhere on my blog, but the Nixie Driver board is something I haven’t discussed before. I designed the driver board for simple Nixie Tube prototyping. It combines the tube itself with the driver IC (either a 74141 or the russian variant, K155ID) and the anode resistor. The schematic for the driver board is pretty simple:
Note that the power and ground pins on IC1 aren’t shown. The 74141 is a basic Nixie Driver IC. It takes a BCD input on pins 3,6,7, and 4, and enables the appropriate anode on the tube. The anode resistor (R1) is used to control the current to the tube. I selected an anode resistor of 15K and an anode voltage of 170V. Most Nixie Clocks you will see are multiplexed, with one 74141 dirivng multiple displays and transistors being used to switch the anodes very quickly. My Nixie Raspberry Pi clock prototype doesn’t use multiplexing because the number of GPIO on the Pi is relatively limited. So let’s see how we can drive lots of Nixie Tube pins from just a couple of Raspberry Pi IO pins.
TP1 and TP2 are where the high voltage connects to the driver board. I used two pins so it’s easy to daisy-chain the high voltage connection to multiple digits.
Let’s talk about Shift Registers
A shift is a serial to parallel device, and we can use it to turn a couple of IO pins into a great many IO pins. Let’s see how:
As with the driver schematic, note that the GND and VCC connections to the 74HCT595s aren’t shown.
A shift register is a serial-to-parallel device. Data is fed into the shift register using a data pin and a clock pin. Each time the clock goes through a low-to-high transition, the state inside of the shift register is shifted left one bit and the current value of the data pin is loaded into the lower-most position of the shift register. Let’s go through a quick example and assume we want to store the decimal number “93” in the register. In binary, this is 01011101. We start shifting from the most significant bit.
|clk pin||data pin||shift register value|
In the table above, I showed the clock pin as it goes from 0 to 1, but omitted the transitions from 1 back to zero for brevity. As we can see, in 8 clocks we were able to load our value 93 into the shift register. Once we have the value we want loaded, then we transition the latch pin from 0 to 1, and the shift register value will be copied to the output pins, and in turn displayed on our nixie tubes.
Shift registers can be cascaded by connecting the output of one register to the data input of the next register. This allows us to get 16 pins of output from only 3 pins of GPIO on the Pi.
Connecting the Pi
In my prototype, I’ve made the following connections to the Pi:
|Pi Pin||Shift Register|
Now let’s write some code. I’m a python programmer, so I’m going to use the Python GPIO library to implement my clock:
""" Raspberry Pi Nixie Clock Prototype Scott M Baker, 2013
Why? … An astute reader would probably ask why I’m using a Linux computer to operate a simple 4-digit display. My first retort would of course be “because I can”. One advantage is that the Pi does give us an easy ability to use NTP to automatically set the clock. Using the Pi is cheaper than one of my traditional Propeller+GPS Nixie Tube Clocks. However, my true motivation is to go on and do bigger and better things:
- A remote Thermometer/Hygrometer. My home automation system currently has sensors for temperature and humidity, and this data is available over a secure TCP/IP connection. Implementing SSL on a Parallax Propeller was a bit more than I wanted to tackle, but doing it on a Pi would be a simple task. Fetch the temperature and humidity from the Home Automation controller and display it on the Nixie Tubes.
- A web counter. I’ve already implemented a web counter using a Propeller and a 10-digit Nixie display board. It would be a lot simpler and a bit more flexible to implement this on a Pi. I’m thinking a wall display board with counters for my primary web sites. Something involving at least a couple dozen nixie tubes. Let’s see how far we can push those shift registers!
Anyhow, I hope this tutorial has showed how easy it is to use the Pi’s GPIO. We’ve managed to bridge the gap between a 2012 Linux computer and some 1960s Nixie Tubes.