Did you find this site useful ? Please
to help www.micro-examples.com

If you need a coder or a freelance programmer, submit your project to me

Single-Tube nixie clock

Printer-friendly version | Forums | FAQs |

PIC16F84A nixie clockHere is the nixie clock !

  • PIC16F84A microcontroller
  • Single-digit Nixie, sequential hours, minutes and seconds display 
  • DCF-77 atomic clock, with automatic or manual time set-up
  • high voltage power supply for Nixie with only 4 components
  • 24 hours cycle programmable extinction time
  • no MikroC compiler licence needed !

 This project will show you how to drive a nixie tube display with a PIC16F84A simple microcontroller.

The nixie is a vertical-mount, front-reading IN-14 russian tube (thanks Alex !), very convenient for prototyping because of its long solderable pins.

  How to power the nixie ?

A 170 volt power supply must be applied between the anode of the tube and one of its cathod, to light the corresponding number from 0 to 9. The lightened number needs around 1.5 mA to glow.

If the voltage is lower, the number is not completely lightened and may even extinguish (under 140 V).

If the voltage is higher, digits will randomly light at the same time, and no digit will be clearly readable.

It is possible to get the high voltage from the main power supply, but it is highly dangerous because live parts may be exposed to dangerous voltage.

That's why is use a DC/DC converter, which gives the +170V needed by the nixie from the +5V power supply of the circuit.

The PIC16F84A generates a software PWM, and drives the MOSFET's gate. The MOSFET switches on an off the current into a 300 H coil. The inducted high voltage is collected by a fast recovery diode and then fed into a capacitor.

nixie clock power supply, MOSFET close-up


This is a close-up view, showing the IRF830 MOSFET, the 330 H miniature coil, and the big 2.2 F 250V capacitor.

Note that the power supply is build as an individual board, I use it also in other test boards for other projects.








A simple resistor divider feeds back a voltage reference into a PIC input : if the voltage exceeds the 1 level of the PIC, the software turns PWM off, until the voltage turns under the 1 level of the PIC : then the PWM output starts again, and so on... this allows to keep a constant high voltage of around +170 V, depending on the variable resistor setting.

nixie clock power supply close-up


This is a close-up of the voltage reference divider.

We can also see that the 15 K anode current limiting resistor is mounted on a socket : during tests, a 47 K resistor was used.

Remember this : reducing the current will increase the life of your tube ! You have to find a good value for a good brightness and a long life.

Power supply adjustment : turn the variable potentiometer, so that you can read around 175 V on a voltmeter connected to the test point (see schematic).


Don't forget that there is a 2.2 F capacitor charged with +170 V in the circuit. This is enough to hurt you VERY BADLY if you touch it.

How to drive the nixie ?

The anode is connected to the high voltage through a 15 K resistor, in order to limit the current to approximately 1.5 mA. It is not possible to drive the cathodes with the pic output, because of the high voltage engaged.

I use a 74141 IC, which has been designed for nixie tubes : it includes a BCD to decimal decoder, and each output has a high-voltage transistor.

74141 BCD to DECIMAL high voltage driver for nixies




74141 close-up : it may turn hard to find it !

You can try to use also 7441 IC, but it will not blank the outputs with BCD input greater than 9.




IN-14 socket



I didn't want to solder the nixie tube directly to my prototype board, that's why I plugged it on a 14 pins dual-in-line IC socket.






Circuit schematic

This is the schematic of my prototype board :

nixie clock schematic



Click on the schematic to enlarge an get a full-sized picture




This is the schematic of the full circuit (click on the picture to enlarge) :

PIC16F84A DCF77 Nixie Clock Circuit Diagram

As you can see, the power supply (+5V) comes from the EasyPic board.

The two decimal points (left & right) of the IN-14 tube are not used in this project.

R3 and D2 protect the pic input in case of the voltage turns to high if the regulation fails.

nixie clock prototype board

 This is the prototype board, with from left to right :

- the high voltage power supply

- the connector (to connect the board to the Easypic PORTB)

- the 74141 IC

- the IN-14 tube on its socket

The software

You can copy-paste or download the C source code from here

It is written in C for mikroC compiler, you can build the .hex file, without exceeding the 2K demo limit of the compiler.

Anyway, you can download the .hex file here.

The clock is ready to run !

single nixie dcf77 clock

If you have a DCF77 module, connect it to PORTA RB0, just as in my DCF77 led clock project.

Then connect the nixie board, and power up the EasyPic board : the nixie lights and starts to count from 0 to 2, it works !

Instructions for use

At power-up : selecting the run mode

The clock can work :

- mode 0 : with a positive logic DCF77 receiver

- mode 1 : with a negative logic DCF77 receiver

- mode 2 : with no DCF77 receiver at all

The clock starts to count from 0 to 2, the current mode makes the corresponding number blink rapidly.

Press the RA0 button to choose your run mode, it will be stored into the pic EEPROM.

If mode 0 or 1 is selected, the clock goes to the synchronization state.

if mode 2 is selected, the clock goes to manual setting.

Manual setting operation

You will have to select the hours and the minutes, two digits each. Press RA0 when you see the correct digit for :

- tenth of hours from 0 to 2 (the clock always runs in 24 hours mode)

- units of hours from 0 to 9

- tenth of minutes from 0 to 5

- units of minutes from 0 to 9

Then the clock goes to display mode.

Synchronization state

During synchronization state, the nixie display is turned off to prevent HF perturbations.

the RA1 LED repeats the DCF77 pulse signal.

the RA2 LED is turned on when a correct DCF77 frame is in sequence.

When a DCF77 frame is completed, the clock goes to display mode.

Display mode

The clock displays the time this way :

- tenth of hours, then units of hours, then a short blank

- tenth of minutes, then units of minutes, then a short blank

- tenth of seconds, then unites of seconds, then last digit extinguishes slowly

- a long blank, then repeat the display cycle.

This video has been shot at 21h 40mn 56s


All trademarks and registered trademarks are the property of their respective owners