Inspired by the glowing cube gmail notifier, and having been given a nixie duo + driver from ogi lumen, this entry demos how to make a nixie display that shows the last two digits of your gmail unread count. It uses a python script to check your gmail atom feed, a $7 disposable camera circuit to power the tubes at 170VDC, and a roboduino (or any arduino compatible) board to control the nixies from the computer via USB serial. Click the title for more details.
Getting the Gmail unread count: This turns out to be surprisingly easy with universal feed parser, one line in fact. After getting the count, mod it by 100 to get the last two digits, and then send it out the serial port to your arduino once a second. This is mostly what J. Matthews did, except this script runs periodically in a python loop instead of using the OS X launched services. It would be easy to get local weather or just about anything else using urlopen, also.
Python Code:
import sys, feedparser, serial, time
#Settings - Change these to match your account details
USERNAME="youremail@gmail.com"
PASSWORD="yourpassword"
PROTO="https://"
SERVER="mail.google.com"
PATH="/gmail/feed/atom"
SERIALPORT = "/dev/tty.usbserial-A900acn6" # Change this to your serial port!
# type ls /dev/tty.usbserial* to find out what your USB serial port is
# Set up serial port
try:
ser = serial.Serial(SERIALPORT, 9600)
except serial.SerialException:
sys.exit()
time.sleep(1.0)
while (1):
newmails = int(feedparser.parse(PROTO + USERNAME + ":" + PASSWORD + "@" + SERVER + PATH)["feed"]["fullcount"])
print(newmails)
# get last two digits
newmails = newmails % 100
print(newmails)
ser.write(str(newmails))
time.sleep(1.0)
time.sleep(1.0);
# Close serial port
ser.close()
Arduino Code:
/*
nixie_example.cpp – sample code using the Nixie library
for controlling the OGI LUMEN NIXIE DRIVER KITs.
Created by Lionel Haims, July 25, 2008.
Released into the public domain.
*/
#include
#include <Nixie.h>
// note the number of digits (nixie tubes) you have (buy more, you need more)
#define numDigits 2
// note the digital pins of the arduino that are connected to the nixie driver
#define dataPin 2 // data line or SER
#define clockPin 3 // clock pin or SCK
#define latchPin 4 // latch pin or RCK
// Create the Nixie object
// pass in the pin numbers in the correct order
Nixie nixie(dataPin, clockPin, latchPin);
void setup()
{
// Clear the display if you wish
nixie.clear(numDigits);
Serial.begin(9600);
}
void loop()
{
// just some local variables to help the example
static int i = 0;
int ser_in;
int ser_num;
static int digits<2>;
// this is a little ugly–didn’t know how to send a single byte out of python,
// so here we interpret 2 digits.
if (ser_num = Serial.available()) {
if (ser_num == 2) {
digits[0]> = Serial.read() -48; // get first digit
}
else if (ser_num == 1) {
digits[1] = Serial.read() – 48;
ser_in = digits[0]*10 + digits[1];
nixie.writeNum( ser_in, numDigits);
}
}
delay(400);
}
$7 Disposable Camera Power Supply: A couple things to note:
- 170VDC is dangerous. Don’t attempt unless you’re aware of necessary precautions to take. Don’t kill yourself.
- The main voltage is easily found by soldering wires to the large capacitor. We also solder a 50k resistor to dissipate voltage relatively quickly after the power is turned off.
- A bench top power supply provided about 1.5V to 2V @ 1.5 Amps! A switching supply like the one ogi lumen sells would be much more efficient. The camera solution was operating at less than 10%…
- There’s a 3.3k resistor in series with the nixie tubes. Not sure if this is necessary, but it let us measure the amps going through (1.3mA @ 170V).
- The communication out is similar to SPI and is taken care of with the Nixie object class
Thanks to Josh Keister and Gordon at justDIY for help with this.