Go Down

Topic: Lilypad Thermometer w/ Numitron Display (Read 1 time) previous topic - next topic

Brad Burleson

Feb 15, 2012, 12:11 am Last Edit: Feb 15, 2012, 09:17 pm by Brad Burleson Reason: 1
I've always wanted to build something with a Nixie tube but have avoided them due to the high voltages needed.

Then a couple month's ago Hackaday had a great post on using Numitron tubes (http://hackaday.com/2011/12/21/numitron-tube-tutorial/) so I thought I'd give it a spin.

I picked up a set of tubes on eBay and, after messing around with a breadboarded version I thought I'd build a standalone version.

My project is an ATmega168 running off the internal resonator (basically a Lilypad), with a DS18b20 temperature sensor and a TLC5940 to drive the Numitron tubes.  The board is mounted on a Radio Shack case that's empty except for 9volts of "AA" batteries.

I added a diode to the power line of each tube to drop the 5V to a bit closer to the tubes 4.5v max (you can see the lousy soldering job too).

Sorry there are no schematics, but I used the following sources to build the board:

This is the first time I've used a TLC5940 with anything besides LEDs.  Worked great.

Oops - forgot to include the code at least.  Here it is, FWIW...

Code: [Select]
/* Numitron temperature display (two digits)
* Code taken from the TLC5940 "Basic Use" example as well as the Dallas Temperature Sensor
* library
* Hardware follows the todbot "Minimal Arduino" 8Mhz
* (http://todbot.com/blog/2009/05/26/minimal-arduino-with-atmega8/) along with the
* TLC5940 reference (http://code.google.com/p/tlc5940arduino/)
* Brad Burleson (KF7FER)

#include <avr/pgmspace.h>
#include <Tlc5940.h>
#include <DallasTemperature.h>

// Table for each seven-digit segment
PROGMEM prog_uint8_t digits[10] = {
 B1111011,                      // Zero  
 B1100000,                      // One  
 B1010111,                      // Two
 B1110110,                      // Three
 B1101100,                      // Four  
 B0111110,                      // Five
 B0111111,                      // Six
 B1110000,                      // Seven  
 B1111111,                      // Eight
 B1111110                       // Nine

static const int ONE_WIRE_PIN = 2;
NewOneWire oneWire(ONE_WIRE_PIN);
DallasTemperature tempSensor(oneWire);

void setup()
 Tlc.init();                    // Setup the TLC5940
 tempSensor.begin();            // Prep the temperature sensor
 delay(500);                    // Need this delay for OneWire?

void loop()

 // Fetch temperature from the sensor (in Celcius)
 float temperature = tempSensor.getTemperature();
 // Now convert to int (and to Fahrenheit) for display
 int displayTemp = (int) (DallasTemperature::toFahrenheit(temperature));

 // Calculate ones and tens digits (only handles 2-digit above-zero temps for now)
 int temp_ones = displayTemp % 10;
 int temp_tens = 0;
 if (displayTemp >= 10)
   temp_tens = displayTemp / 10;

 // Now handle the display
 setupTLC(temp_tens, 0);        // Setup Tens digit
 setupTLC(temp_ones, 8);        // Then the Ones digit
 Tlc.update();                  // Update the display
 delay(3000);                   // Wait a bit...

// Pull digit from program memory and decode bits
void setupTLC(int digit, int offset) {
 byte data = pgm_read_byte (&digits[digit]);  
 for (int i=0; i < 7; i++)
   if (data & (1<<i))
      Tlc.set(offset + i, 4095);


Go Up