Driving Two Nixie Tubes With an Arduino Via a Shift Register and Two SN74141s.

by lmperkins in Craft > Digital Graphics

80757 Views, 146 Favorites, 0 Comments

Driving Two Nixie Tubes With an Arduino Via a Shift Register and Two SN74141s.

Nixie tubes are really cool looking and are becoming quite popular for their 'retro' look. Although there are a number of tutorials out there on using nixie tubes and some nice pre-packaged units (see these nice ones from ogi lumen and ArduiNIX) I hadn't seen a simple tutorial on running them using a shift register like the SN74HC595. This would use the minimum number of Arduino pins as it can run as a serial device. Another nice addition is the use of the SN74141 BCD to decimal decoder/driver chip. This chip allows direct control of the Nixie tubes from the shift registers without the use of individual transistors for each numeral. An added benefit to using shift registers is that additional pairs of Nixie tubes can be added without using any more Arduino output pins. They just get daisy chained to the first set.

WARNING: Nixie tubes require a high voltage power supply, typically 150-180 volts. This is enough voltage to hurt you. Please make sure you know what you are doing.

Note: please let me know of any typos/errors/comments so I can continue to improve this Instructable.
I'd also appreciate it if you'd vote for me in the contest. Thanks.

Theory

The Arduino code defines a byte (eight bits) based on the code written.
This byte is then passed serially to the shift register.
The shift register then uses the byte to set each of eight pins either high or low (aka serial to parallel conversion). (A useful tutorial using shift registers with Arduinos can be found here)
These eight pins are connected to the input pins (four each) on the two 74141 chips.
The 74141 chips read the four bits as a code that defines which of the numbers to light on the Nixie tube. See the datasheet for the codes)
A Nixie tube works by having a high voltage (typically 150 - 180 volts) attached to the anode. Each of the filaments is connected to the anode and each has a separate cathode. When a number's cathode is connected to ground, current flows through the digit and it lights up).
The 74141 chip is designed to interpret the four bit code to connect one of its ten pins to ground. The 10 cathodes of the Nixie tube are connected to these pins. When one of these pins gets connected to ground, that number lights up. The 74141 is specially designed to handle the Nixie's high voltages.The same thing could be done with a series of transistors, but the 74141 chip just simplifies things.

Get the Stuf

IMG_1543.JPG
You will need the following:
An Arduino development board of some type. I'm using a Freeduio from NKC Electronics
Two IN-12b nixie tubes with sockets (I found some on eBay)
Two SN74141 BCD chips (or the Soviet equivalent;  K155ID1, also from eBay, see above)
One SN74HC595N shift register (very common, e.g. Adafruit)
A high voltage power supply for the Nixie tubes (I used this one, see the picture)
A 12 volt power supply for the high voltage power, I used a 12 volt wall wart.
Two current limiting resistors, one for each Nixie tube. I used a 1 watt 4.7 kohm.
A breadboard and some jumpers

Setting Up

IMG_1542.JPG
You'll want to place the shift register in the middle of the breadboard and the two 74141 chips on either side of it. I've added a mounting spot to my breadboard to hold the Arduino. It just needs to be close by.
Assemble the high voltage (HV) power supply per its directions. The ground for the HV supply needs to be common to the Arduino and the rest of the circuit. Keep the HV line away from the normal five volt power line or bad things will happen. Please read all of the warning associated with your HV power supply and remember that this is enough voltage to hurt you.

Wiring the Nixie Tubes

IMG_1541.JPG
On the bottom of the Nixie tube socket each of the leads is numbered. Solder 4-6" leads on to each of these connections (you can ignore pin 12 as it does not get used). Note that the socket has a notch in it near pin one.
Identify pin one on the Nixie tube. Looking at the top of the tube, the number 3 will be on top. Pin 1 is at about 5 o'clock when holding the Nixie tube with the digit 3 upright. On my tubes this pin was painted white to differentiate it.
Place the Nixie tube in the socket so pin 1 is near the notch in the socket.
Connect the 11 leads in order to 11 rows of the breadboard near one of the 74141 chips.
Repeat for the second Nixie tube.

Wiring the Chips

nixie.png
There are a lot of jumpers that need to be wired. The diagram above shows the connections. The D inputs on the left refer to connections to the digital pins of the Arduino. I used the Vcc and ground pins on the Arduino to power the Vcc and gnd busses on the breadboard. Note that all three chips need 5 volt and ground connections.
I chose to use jumpers to connect to open slots on the breadboard and then connecting those slots to the Nixie tubes. Alternatively you could simply connect the leads from the Nixie tubes directly to the output pins on the 74141 chips.
Pin 1of each Nixie tube is the HV anode, do not connect this to anything yet.
Note that the number on each of the green lines adjacent to the chip is the pin number for that chip. Note that they are usually not in order so your wiring will look a lot more complicated than this diagram. (see here for determining pin numbers).

The Code

The code is designed to simply make sure that everything is working. All it does is count from 0 to 99 and displays these values on the nixie tubes. The byte sent to the shift register is actually two four bit segments that tell each 74141 chip what number to light up. Because of this, each of the possible 100 outputs is a distinct binary number. Taking advantage of this I calculated the decimal equivalent of each of those 100 bytes and set up an array that converts the decimal 0 - 99 value to the appropriate byte. Thus, all one needs to do is to provide the code with a two digit number (the variable 'x') and it will be displayed.
I've included some serial.print commands to make sure it's all working.

/*  a sketch to drive two nixie tubes using two SN74141 BCD chips and a single SN74HC595N shift register
    developed from the tutorials on Adafruit.com and arduino.cc
    the sketch will cause two nixie tubes to count from 0 to 99 but you can change it to create any two-digit number and have the nixie tube display it
    Jeff Glans 2013
    Released into the public domain
   
*/
//set up the pins for communication with the shift register
int latchPin = 8;
int clockPin = 12;
int dataPin = 11;
int x; //create a counting variable


// create an array that translates decimal numbers into an appropriate byte for sending to the shift register
int charTable[] = {0,128,64,192,32,160,96,224,16,144,8,136,72,200,40,168,104,232,24,152,4,132,68,196,36,164,100,228,20,148,12,140,76,204,44,
172,108,236,28,156,2,130,66,194,34,162,98,226,
18,146,10,138,74,202,42,170,106,234,26,154,6,134,70,198,38,166,102,230,22,150,14,142,78,206,46,174,110,238,30,158,1,129,
65,193,33,161,97,225,17,145,9,137,73,201,41,169,105,233,25,153};


byte nixies = 255; //initiate the byte to be sent to the shift register and set it to blank the nixies

void setup(){
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  Serial.begin(9600);
}

void loop(){
  nixies = 255; // create a blank byte
  updateShiftRegister(); // send the blank byte to the shift register
  delay(500);
 

  for (x = 0; x<100; x++){ // count from 0 to 99
    nixies = charTable[x]; // translate into a byte to send to the shift register
    
    updateShiftRegister(); //send to the shift register
    delay(500);
 
  Serial.print("x = ");
  Serial.println(x);
  Serial.print("nixies = ");
  Serial.println(nixies);}
}
  //the process of sending a byte to the shift register
void updateShiftRegister(){
  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, LSBFIRST, nixies);
  digitalWrite(latchPin, HIGH);
}

Downloads

Make Sure It's Working BEFORE Connecting the High Voltage Line

IMG_1522.JPG
A simple test will be to load the code into your Arduino and use the serial monitor to make sure it's doing what you expect. This won't really tell you anything about the 74141 output however. What I did was connect 10 LEDs to the output pins of each 74141 to 5 volts through a 100 ohm resistor. If you do this, what you should see is one set of LEDs counting the ones digits and the other counting the tens digits. You can also use a multimeter to make sure each of the output pins is being pulled low periodically, which is a bit more tricky and not as graphical as the LEDs.
Once your convinced it's working as expected it's time to connect up the juice (make sure you remove the LEDs first as they can provide a route to ground for 180 volts).

Connecting Up the HV to the Nixie Tubes

IMG_1526.JPG
I found the hard way (by burning up two 74141 chips and one ATMega328 chip) that some high voltage supplies need a current limiting resistor. If you use the power supply I did a 4.7k ohm 1 watt resistor should work well. Some power supplies have built in limiting resistors. If you can't tell, it's better to be safe than sorry.
Connect the HV power lead to each of the anode pins (pin 1) through the current limiting resistor. DANGER: this is pretty high voltage, make sure you know what you're doing!
I found the best way to do this was to have the Arduino sketch already running but with the HV power supply unplugged. Connect the HV line to the Nixie tubes before plugging in the HV power supply. Double check all your connections and then plug in the power supply. This will minimize shock to the system as it takes a bit for the power supply to come up to power. Reverse the procedure to power down.
At this point you should see the two Nixie tubes counting from 0 to 99.

Troubleshooting

Are the Nixie tubes lit at all?
-If not, are you sure they're getting power? Measure the voltage to pin 1, it should be at least 150 volts.
Are the tubes lit but not counting?
- if all the numbers are lit you probably have a ground fault somewhere.
- if only one number is lit but not changing check the serial monitor to make sure the code is running properly
Are the numbers not counting up correctly?
- make sure you have the connections from the shift register to the 74141 in the right order