IN-12 Nixie Clock

A time has come for me to say ‘hello’ to the mid-XX century technology of  Neon numerical displays, also known as Nixie tubes. Despite being quite hard to obtain and utilize I’ve decided to make a nice looking clock which (hopefully) would make a perfect Christmas present, and since the Christmas is all about sharing I thought It would be nice to go Open Source about it.

After few weeks of work I’ve ended up with neat single board design that makes the whole thing cheaper and easier to manufacture than the usual double board solutions (separate board for nixie lamps/divers, and another for microcontroller, power supply, high voltage dc/dc conversion, etc.). All of the circuitry is laid out on the back of the clock so it does not interfere with the old-school look of the Nixie displays.

Not a single LED was involved in that project, as I find those to be a disgrace when mixed up with neon indicators. (Geez, this is like, ‘your opinion’, man! 🙂 )


The ‘Ne’ part

I wanted to keep the clock’s form factor as small as possible, so I chose it to be a standard HH:MM clock (without ‘seconds’ display) which requires only four Nixie tubes and two neon lamps for the separating colon.

I’ve decided to use IN-12 type Nixies as those are very popular here in Eastern Europe, but can also be easily bought on ebay and shipped worldwide. Those lamps are actually pretty cheap, mostly because they were manufactured in really large quantities back in the day.  One thing that’s worth mentioning: since those Nixies come straight from Soviet Union, where almost no one paid any attention to the quality of whatever they’ve been producing, it will be wise to buy, let’s say a 150% of lamps that you need for your project. This gives the possibility to compensate for all imperfections (and believe me, these can get ugly like: digits being tilted, pins not being centered, ‘funny’ frontal grid color, etc.) which can easily degrade the overall look of your Nixie clock.

As for the separating colon I went for INS-1 Neon lamp, which has the advantage of being similar in height as the glassy part of IN-12, so it will make a perfect separator.

Every clock needs a way of setting the time, and the simplest way of achieving this is to embed buttons (like micro-switches).  Since I’m aiming towards keeping the overall look to be as minimalistic as it is possible (well, Nixies don’t necessarily present themselves as ‘minimalistic’ to begin with.. ) I came up with a neat idea of placing the two buttons just under the INS-1 lamps, so when colon dots are pushed they, in fact, press the micro switches and, since the switches have the ‘springy’ action they move the colon lamps back to their original position as soon as user stops pushing.

The ‘Si’ part

Well, actually there is not much space left on the ‘bottom’ side of the PCB (which is in fact ‘back’ side, at least when the orientation of the Nixies is considered), so it became obvious that I need to go for SMD parts if I ever dreamed of fitting in.

After a few hours I came up with the following schematic:



For the uC I went a for good ol’ friend of mine: STM32L152 which is a really powerful device while still being affordable. The micro itself will be responsible for:

  • multiplexing the display (timing, signal driving, etc) (GPIO)
  • driving the high voltage DC/DC converter according to required voltage/current being drawn (TIMER to generate PWM, ADC to measure the output voltage)
  • measuring time  (RTC with external 32768Hz crystal resonator)
  • reading state of the buttons (GPIO, External Interrupts)
  • monitoring the main power supply, and sustaining the clock settings even when power fails, using external battery/super-capacitor. (GPIO, Cortex-M3 Stop Mode)

All of those tasks can be done with almost no effort in STM.

Nixie Drivers

Nixie lamps can be thought of being very similar to common anode LED displays, which means that every lamp has its own common anode, and ten separate cathodes (for digits ‘0’ – ‘9’). What’s important is that Nixies show very promising results when being used with technique called Multiplexing, which can lead to a considerable reduction of total number of driving signals. A naive approach for four Nixies would require 40 driving signals (40 catchodes, all anodes connected directly to high voltage rail) while multiplexing four tubes requires only 14 signals (10 cathodes, 4 anodes). One must remember that multiplexing comes at the expense of display intensity (or brightness) since a single Nixie is being powered on for only 1/4 of the cycle. That however, can be compensated by increasing the supply voltage.

Although there are some ICs dedicated for driving cathodes of Nixie lamps I decided to go for transistor level solution, so every cathode has its own transistor with a current limiting base resistor. This is actually quite beneficial, mainly because It gives the possibility to spread out the parts along the PCB, and since SMD transistors are small, they can be distributed almost anywhere on the PCB. Second reason for using transistors was that I wanted to avoid using parts that might be obsolete/hard to buy.

Anode side is driven by a two transistor circuit: PNP keys the anode voltage on and off, while NPN acts as the level-shifter, so that uC could interface the anodes. By the way: it is very important not to omit the resistors that connect the base of the PNP transistor to the supply line (R3-R6) as the PNPs will operate at the edge of being turned on. This is because of the leakage current of the NPN transistor, which although being very small (in range of nA) gets amplified by the factor of PNP’s beta which might be sufficient for the Nixie lamp to be ignited, resulting in unreadable display! (remember, we are using Mutliplexing here so we need to have a way of turning Nixie off completely!)

I used general purpose NPN/PNP transistors that have high Collector Emitter Breakdown Voltage. This is the most important parameter here – it tells us that transistor won’t get damaged when high voltage is applied nor will it leak any unwanted current.

Generating High Voltage

Many of the solutions available on the Internet are using large parts for DC/DC conversion like: beefy transistors that are capable of dissipating some serious power, bulky, high-inductance inductors, and near-audio frequency switching regulators. Seeing that, I knew it was at least worth a try to design my own converter, as those solutions would’t even fit onto my PCB!

Before I started the design process I wrote down some basic remarks about converters:

  • Output voltage – this is totally Nixie dependent. I’ve settled around 130V – 140V, which is good for Multiplexed IN-12, but you may need to experiment on this value, especially if you plan to use different tubes.
  • Output current – again, mostly Nixie dependent (datasheet tells us to keep the current under 2.5mA for the Nixie and 0.5mA for a single Neon lamp used in separator), BUT many different parts of the circuit will cause an increase in current being drawn. First of all: the step-up feedback network which is nothing more than ~1Meg Ohm resistor connected between the output and ground, so it adds 130V/1Meg = 130uA. Anode drivers will also use current, but since only one Nixie is being powered at time we can calculate the current as if there was only one Nixie present in the design: 130V/2Meg = 75uA. Let’s stick with 5mA total.
  • Input voltage – the bigger – the better! It’s best to keep the voltage ratio somewhere between 1:10 – 1:20. Using higher ratios will likely result in sudden drop in efficiency, and will involve high input current spikes, that may even get radiated from power cord! I went for voltage range of 10-16V, which is dictated by lowest acceptable operating voltage of MOSFET driver and by the voltage rating of the capacitors used for filtering input voltage.
  • Inductor – needs to be small (not much space on PCB!), which can either result in small inductance/small DC resistance/high current capabilities or just the opposite: low inductance/high DC resistance/low current.
  • MOSFET Trasistor – needs to withstand large voltage generated by inductor. Fast switching and low ‘on’ resistance are also required, as those parameters contribute greatly to power dissipation (power wasted into heat). Choosing the correct transistor for the job is always a compromise between low ‘on’ resistance and high voltage handling capabilities. There are some models that have both, but those can get expensive. Remember to check for drain current vs gate voltage. Many MOSFETs require high gate voltage (mine did) in order to open them fully (i.e. get high drain current), so adding a MOSFET driver is a good option, especially when even cheap (<$1) drivers can provide +/- 1.5A of driving current (bare GPIO pins max out at 20mA) which increases the switching speed tremendously (lower losses).
  • Diode – component responsible for transferring the energy from inductor to filtering capacitors. It’s contribution to whole circuit is often neglected which may lead to many problems. Most important factor is Reverse Breakdown Voltage which tells us about the maximal voltage that can be present between cathode and anode. Exceeding this voltage will essentially lead to voltage being fed back to input voltage rail! Another important factor is Reverse recovery Time which describes how much time it takes for a suddenly reverse polarized diode to start blocking the current flow. This parameter will have a very significant impact on the efficiency since it tells us about how much energy stored in output capacitors will leak back to input power rail after the switching cycle has completed. Remember to keep this parameter to minimum (use ‘fast’ diodes). Try to choose right diode for the job. Large diodes are not always the best choice as those often have higher conduction losses.
  • Controller – Since I had to keep the number of parts to the minimum I’ve decided to implement my own step-up (boost) converter regulator using the resources provided by the microcontroller. I chose to operate the converter in so called Discontinuous mode, which has the advantage of being easy to implement in software. The whole regulation process will be based on adjusting the frequency of MOSFET gate pulses that have constant width.

Now, lets make some assumptions: I chose to use 12V wall brick power supply, which are widely available, so that makes for the input voltage. The input voltage and the inductance will determine the rate at which the current is being build up in the inductor.

\[I[A]=\frac{V_{in}[V]*t[\mu s]}{L[\mu H]} \]

Inductor current should never exceed so called Saturation current. This is the point where inductance suddenly decreases (at least by a factor of 10% – 20%) because of the magnetic core being saturated. Inductor then starts to behave more and more like the pure resistance (heats up, stores little energy) as no more magnetic field can be build up!

A compromise needs to be made when choosing the inductor value especially for a given maximum size, which in my design is about 5x5mm. I did some research among different component suppliers and got my hands on SRN5040 Series from BOUNRS.

Low inductance would require very short (sub microsecond) gate pulses in order to stay below the saturation current. It would also cause a large current to flow through MOSFET, as well as being drawn from input voltage rail. The process of fully opening and closing the high voltage MOSFET is a sub microsecond manner is not an easy thing to do. Diode recovery times will contribute greatly to conversion losses, if they are becoming comparable to overall cycle length.

High value inductors will saturate later which eases the timing requirements, but they present higher DC resistance. Less current is required to store the same amount of energy as in low value inductors, so MOSFET does not need to handle large currents. Since the overall cycle will be longer the output voltage ripple will get higher for the same output capacitance. The only way around it is to add more capacitance to output, but keep in mind that high voltage capacitors can get pretty darn big!

Having said that I chose 15uH inductor (Part No.: SRN5040-150M) which offers a very good ratio of size/saturation current/inductance. In fact it offers the greatest energy storage capability of 60 micro Joules, at least when SRN5040 series is considered. Manufacturer claims that inductor has the saturation current level of 2A. Let’s crank the numbers:

\[E = \frac{I^2 * L}{2}  = \frac{4 A^2 * 15\mu H}{2} = 60\mu J\]

\[I = \frac{V * t}{L}, t=\frac{I*L}{V} = \frac{2A * 15\mu H}{12V}  = 2.5\mu s\]

The information about energy lets us derive the actual cycle period, knowing the golden rule of energy conservation. One needs to know that not all of the energy will be transferred to output. Some of that energy will be wasted, mostly into heat (can be problematic), some will be radiated as electromagnetic waves (can be very problematic). It is safe to assume the efficiency (often denoted with greek letter Eta, η), of such simple, discontinuous mode, converter to be around 60-70%. That leaves us with following portion of effective energy transferred during every cycle:

\[E_{eff} = E*\eta = 60\mu J * 60\% = 36\mu J\]

Since Nixies are consuming 5mA at 130V we calculate power to be:


Lets now calculate the time required for Nixies to consume all the energy provided:

\[E_{eff} = P * t, t=\frac{E_{eff}}{P} =\frac{36\mu J}{0.65W} = 55\mu s\]

Having done that we end up with nice, easy to generate, pulse train, Generating 2.5us pulses asks for uC clock to be at least 2MHz for 0.5us resolution, which is not a problem (Medium Speed Internal Oscillator, MSI, gives 2096kHz, close enough!). uC’s job will be to generate 2.5us pulses that will open the MOSFET and adjust the frequency of the pulses according to calculated base value of 55us  and the instantaneous demand on current. The frequency of pulses at maximal current (5mA) will therefore be:

\[f = 1/t = 1/55\mu s \approx 18.1kHz\]

This is just at the edge of audible frequencies range, and we know that circuit will not always draw full 5mA. When it uses less current this frequency will drop (energy portions from inductor will be required rarer) and become even more audible and annoying as well. One way around it is to make the pulses shorter, lets say 2uS, so the inductor stores less energy:

\[I = \frac{12V * 2\mu s}{15\mu H} = 1.6A\]

\[E_{eff}=\frac{2.56A^2*15\mu H}{2}*60\%= 19.2\mu J\]

\[t = \frac{19.2\mu J}{0.65W}=29.5\mu s, f \approx 33.9kHz\]

See? Well above audio frequencies, and all done in software. Neat! Just keep in mind that further decreasing pulse width will have an impact on efficiency and ‘60%’ assumption might no longer be valid.

So much for the theory. The best way to validate all the assumptions made is to simulate the converter circuit and do some measurements. To do so I often use LTSpice. Here’s the initial schematic.


 and a plot that shows voltage at switching node (green) and output voltage (blue) ramping up.


Here’s a closeup of switching node voltage. Some serious ringing can be observed. This is bad. Really really bad.


Ringing is initiated by reverse recovery of the diode and sustained by resonant circuit, formed by the inductor and parasitic capacitance that is present in MOSFET transistor. These oscillations can cause quite a mess! They will get radiated and cause interference to all devices nearby. It’s a common practice to implement so called snubber circuit (parts C11, R36 on the main schematic). The ringing is almost entirely suppressed after being treated with a snubber.


Incorporating snubber circuit will always come at the expense of efficiency, but please keep using it 🙂 Another good practice is to keep the switching node as short as possible, and use a lot of good input filtering (low ESR caps). I’ve even added a ferrite bead on the input voltage rail, to prevent any high frequency garbage from traveling along the power cord.

Some remarks about measuring output voltage are needed. It’s a good practice to measure voltage just in between switching cycles, and not during current pulses. This will help to get around all the switching noise that might have some serious impact on accuracy. This can be easily achieved by triggering ADC conversion with Timer Output Channel Compare feature (one channel generates MOSFET pulses, the other, slightly delayed, generates ADC trigger pulses). ADC conversion results will therefore be produced at rate equal to conversion cycle frequency which might result in too much computational load used just for reading ADC data register. The best way around this is to employ DMA for readout fetching and calculate the mean value of readouts when DMA transfer complete/half-transfer complete interrupt fires. I’ve set the interrupt routine to be called every 16 readouts (transfer size: 32, half-transfer interrupt enabled). Here’s the interrupt routine:

/* adc samples buffer */
static uint16_t samples[32];

/* dma channel 1 isr */
static void StepUp_Dmac1Isr(void)
 /* get status */
 uint16_t isr = DMA1->ISR;
 /* buffer pointer */
 uint16_t *ptr = samples, cnt;
 /* accumulator */
 uint32_t a = 0;

 /* re-enable dma if needed */
 /* clear interrupt flags */

 /* got transfer complete? */
 if (isr & DMA_ISR_TCIF1) {
     /* select second half of measurement buffer */
     ptr = samples + elems(samples) / 2;

 cnt = elems(samples) / 2;
 /* sum all measurements */
 while (cnt--) {
     a += *(ptr++);

 /* get current error vector */
 int32_t diff = (a - 2900) * 8;
 /* limit diff */
 diff = min(max(diff, -512), 512);

 /* update regulator output */
 reg += diff;
 /* limit range */
 reg = min(max(reg, (uint32_t)64 << 8), (uint32_t)150 << 8);

 /* apply regulation */
 TIM4->ARR = reg >> 8;
 /* set new sampling point */
 TIM4->CCR4 = (reg >> 8) - 16;


As it can be seen from the code above the regulation algorithm is very simple, in fact it is no more – no less than a simple Proportional Regulator which compares accumulated ADC readouts with the magic value of 2900. Why 2900? Because it makes Nixies look best! (at least in terms of light intensity) :). Feel free to adjust this value to match your expectations.

I’ve intentionally limited the possible values of  ‘reg’ variable so, if an error occurs (like bad solder joint in ADC’s voltage divider) it will prevent the MOSFET to be constantly turned on, shorting the input power rail to ground.

Keep in mind that ARR and CCRx registers must be preloaded (i.e. updated on every Update Event by Timer’s logic, not on register write access, APRE bit set in CR1 register, OCxP bit set in CCMRx register) or you’ll end up with very weird timer behavior.

Help, my clock is always late!

Oh well, that’s a common problem with crystals. They often give out very stable frequency but it does not necessarily be spot on 32768Hz. ST Microelectronics thought of that problem and prepared a nice detailed paper about their RTC that deals with calibration which could be done entirely in software.

I’ve placed a test point on PCB where you can measure your reference clock frequency with some accurate frequency counter.

Printed Circuit Board

Here’s the overall look of the PCB. The dimensions are: 124 x 40mm. All the components fitted on the back side.


Not much going on on the front side since I don’t have the Nixie model, and I was too lazy to make one. Here you can see the micro-switches that are placed just beneath the neon lamps.


I used 0805 and 0603 for passive parts so the soldering shouldn’t be very hard. The only difficulty is encountered while dealing with MCU, but its manageable. Just apply a lot of flux and use a hot air gun.

Please make sure that, after soldering you’ve removed all the residual flux as it might disturb the operation of all high impedance networks present in this circuit (like step up feedback network).

Neon push-buttons

To make it happen we need to prepare neon bulbs to have springy action. We do that by bening their legs properly, like this:


Soldering Nixies

That’s right, IN-12 lamps can be soldered easily (no acidic fluxes are required), so there is no need for sockets. Footprint present on PCB uses large pads, so it’s straightforward process of  ‘positioning and locking’. I needed to solder lamps as they would be SMD (as opposed to THT) components in order to match their height to the height of the whole micro switch – nixie lamp construction.

Final Remarks

As mentioned above I decided to give this project as my contribution to community, so here’s the link to my GitHub repository, where you can find all the schematics, PCB layout, source code for the uC, LTSpice Schematic, etc.. Feel free to use it to whatever purpose it might serve.