I have always liked how nixie tubes looked, so I decided that my first ESP32 project should use them somehow. And since I also like the contrast in the tech used, I decided to modify my nixie tube clock and add an esp32 to it that syncs it’s time over Wi-Fi using NTP.
If you want to look at the code and the hardware, it is in our GitHub.
The software is probably the easiest part of the nixie tube clock, as the esp32 comes with basically all libraries needed to sync time. So, all the software does is connect to a wifi network, enable the SNTP service and then just update the display periodically.
The most complicated part of the software is probably writing data to the display, as the way I made the digit mapping is a little odd to make PCB routing easier. When one value needs to be mapped to a specific byte sequence with no logical relation to the input value, it is common to use a lookup table. This is what I am doing in my code, as well. The NIXIE_NL variables act as the lookup tables for each unique number. To get the bit value that will need to be outputted, I just use division/modulo to get each digit, get the matching values from the LUT, then AND/OR them to get the value to write to the shift register.
I chose to use IN-12 tubes since they seem to be quite readily available and not too expensive at ~5$ a tube, but they are relatively small. I like the compactness of the clock I built, but it isn’t something for people that want large orange glowing digits in their living room. The dots in the middle are just ordinary neon indicators from Digikey. I initially used INS-1 front-illuminated neon dots, but after one and a half years of running them, I have noticed that the discharge tends to disappear into the back of the tube where it is not visible from the front, something that won’t happen with typical indicators. Plus, I do think they look better than the dots.
The 180V supply
The biggest issue with nixie tubes is, of course, the high voltage they require. Back in the day when they were common, the equipment using them had one big linear transformer in it that put out the voltages required, but nowadays we do not have that luxury. Furthermore, I wouldn’t try hard to build a nice and small clock if it ends up having a large mains’ socket on it.
The solution is to use a boost converter to step up the 5V from the USB port to the 180V that the tubes need. Usually, one wouldn’t use a boost regulator for voltage ratios beyond 5 or 6 because the duty cycle and peak inductor currents get quite large. Still, since the tubes only draw a few milliamps, it is viable to let the converter operate in discontinuous mode (so the current in the inductor drops to zero during the off-time) and use a much lower duty cycle than would usually be necessary.
I used the BD9303 PWM controller because I had some around, and they were decently cheap. One slight workaround is necessary to allow the circuit to function. D2 is used in parallel with the compensation network to limit the error amplifier’s maximum voltage. This has the effect of limiting the duty cycle. The chip has an overcurrent shut-off built in that would trigger otherwise. I recommend that you go to eBay or Aliexpress and buy yourself one of those assembled boost modules if you just want to get the tubes working since my circuit can only run 5 or 6 tubes with the large-ish source resistor on the mosfet. It probably wouldn’t do well with any of the larger tubes, either.
Controlling the Display
Another issue that the tubes’ high voltage brings is that no ordinary logic can control them. Connecting them to a standard 74hc595 shift register would result in either the shift register dying, or more likely, the tubes just staying on as the top clamping diode conducts the display current even with the output turned off. The obvious solution is to use parts with an open drain or open collector output, but those tend to only go up to ~100V. Back in the day, there were dedicated high voltage BCD decoders that could handle 180V easily, but they are now only available as old stock and in DIP packages, increasing circuit size a lot. Since I tried to make the nixie tube clock decently compact, that wasn’t an option.
Fear not, though, because microchip has an entire portfolio of up-to-date high voltage logic parts 😀 The one I picked (HV5122) has 32 open-drain outputs that go up to 250V, and there are some push-pull ones available, too, in case somebody wants to build a large, multiplexed display of nixies. The only issue is that the one I chose needs 12V logic signals, so I added a 12V charge pump and some mosfets for level shifting.
The tubes have one pin for each of the cathodes in the shape of the number displayed and one for the anode grid on the tube’s front. To turn on a segment, we just need to pull the corresponding pin to ground (and make sure that no other digit is illuminated as that will show both simultaneously).
Dimming the nixies is also pretty easy, as they do reasonably well with just ordinary PWM, even though the frequency has to be reduced below a specific duty cycle (10% in my case), as the tubes won’t fully illuminate their digits otherwise.
One workaround I used in the nixie tube clock was only to connect some of the digits, so I got away with using only one shift register. Since it will only ever display time, I could just ignore the numbers that are never shown. For example, all digits above 3 in the 10-hour tube. That does limit the number of possible values that can be displayed. So not a full IOT display thingy, but good enough for me 😛
Ways to Improve the Nixie Tube Clock
Since this was meant to be a quick proof of concept, I did not re-engineer the nixie tube clock’s parts that already worked (mainly the HV section). But there certainly is a lot of room for improvement:
- Replace the PWM regulator with just a PWM output from the microcontroller to make the circuit simpler
- The 12V logic supply could be created by the microcontroller using a charge pump.
- Replace the 12V logic with other ICs that work from a 5V supply
- A finger guard behind the nixie tube PCB might be nice since I have already shocked myself a few times when playing around with the thing.
If I get around to making these changes, I’ll be sure to keep you updated since I think this has the potential to be a cool little DIY project if designed for that properly. Maybe we’ll turn this into a nixie tube clock kit? Let us know what you think!
The post Making a Nixie Tube Clock with an ESP32 appeared first on .