After looking at various very cool and vary old display technologies on eBay, I ran across a 4 line dot matrix VFD display. It was one of 4 left, so I decided to order it and build a project similar to this one that an IRC friend linked me to: http://www.pyrofersprojects.com/blog/vfd-clock-with-snmp-and-ntp/. I originally was going to go down the similar route of a Arduino or Arduino clone and an Ethernet shield, but after looking at what the cost would be, the Raspberry Pi made a lot more sense. The Raspberry Pi itself is only $25 or $35 for the B model, and wifi module for $10. Since I didn’t have any of this equipment, I ended up getting a really nice kit from Adafruit (http://www.adafruit.com/products/1014) to get started. I also purchased some discreet electronics and other parts from Newark (Element 14) to build a RasPi UART to TTL converter (You can also do this with a MAX232 chip, which I haven’t tried yet) as I thought I would need it, which turned out not to be the case with the particular VFD module I got. Keep in mind however that the RasPi is 3.3v UART, not +5 TTL. That circuit will convert the two with 4 1k resistors and 2 2N222 transistors.

Here is most of the kit after I took everything out of the box and set some of it up:

Raspberry Pi 2

After plugging it in, it was simple enough to download the NOOBS software kit from Raspberri’s site and unzip the contents onto the microSD card through the microSD card reader that both came in the kit (tiny USB connector as seen in the picture). Sliding the card into the adapter and into the pi and turning it on brought it right up to a really nice and simple installation interface where you got to choose your OS to install. Since it seems to be the most popular and most supported, I went with the default, Raspbian.

Raspbian

The install took a while, but completed without any issues (sorry about the flash glare and quality of picture).

Unfortunately I totally didn’t take ANY pictures during the build. Not much was missed though. First I went straight to building the TTL conversion circuit, which promptly didn’t work. I took the “big risk” and plugged the display directly into the pi and it came to life! It was actually pretty simple. The 3 pin connector on the VFD module has +5 volt, Serial Data, and GND. All 3 pins went straight to the pi. The Serial Data pin is connected to pin 8 of the pi header which is the UART transmit, 5v got connected to pin 2, and GND to pin 6. You can probably picture it in your head, there’s no components inbetween.

After that initial success, it was just down to software; so I decided to build a case. Since I had never done this before, I was hoping to make just a simple, easy to put together case with a couple pieces of Lexan (plexiglass, etc). Thankfully my local hardware store had smaller pieces but thick enough for just under $4 each, so I got 3. Two extras just in case (and I needed them). I spent hours trying to cut and drill holes correctly. Wasted many a piece of Lexan. I ended up with this!

VFD Case Front VFD Case Back

As you can see I used 3 molex connectors and a piece of old ribbon cable to go between the pi and the VFD module. There was barely enough room for it all. It’s actually a little more tight than I really would want it to be. That is the “B” version of the PI, and will eventually be replaced with the cheaper and less powerful “A” version, since it’s not doing much. Then I can use the “B” for other projects.

I’m still developing the script, but here is what I have as of at the time of this writing. Before you look at it, remember that this project was the first time I had ever touched Python, so the writing is going to be laughable to you experts.

#!/usr/bin/env python

import serial, urllib2, time
from time import localtime, strftime
from lxml import etree

ser = serial.Serial('/dev/ttyAMA0', 19200, parity=serial.PARITY_EVEN)
time.sleep(5)
var = 1
global lastcheckhour
lastcheckhour = 0

def gettimedate():
       ser.write(strftime(" %I:%M %p", localtime()))
       ser.write("\x0D")
       ser.write("\x0A")
       ser.write(strftime(" %b %d, %Y", localtime()))

def getweather(lastcheckhour):
       if strftime("%H") != lastcheckhour:
              url = 'http://w1.weather.gov/xml/current_obs/KABQ.xml'
              fp = urllib2.urlopen(url)
              doc = etree.parse(fp)
              fp.close()
              global temp
              temp = doc.xpath("//current_observation/temp_f")[0].text
              global weather
              weather = doc.xpath("//current_observation/weather")[0].text
              lastcheckhour = strftime("%H")
              ser.write("\x0D")
              ser.write("\x0A")
              ser.write("\x0D")
              ser.write("\x0A")
              ser.write(temp[:-2] + "F " + weather )
       return lastcheckhour

while var == 1:
       ser.write("\x0E")
       ser.write("\x0C")
       ser.write("\x1B")
       ser.write("\x48")
       ser.write("\x00")
       gettimedate()
       lastcheckhour = getweather(lastcheckhour)
       time.sleep(60-int(strftime("%S")))

ser.close()

This script has a few bugs and problems. If there is no working internet connection, it hangs when updating the weather, so you have to kill it and restart the script when an internet connection is available again. This particular display module is a little strange in that it is set up as 19200 8E1, instead of the normal 9600 7N1. The script sets up the serial connection to the display, initializes a couple variables, then goes into an infinite loop. Every minute it cycles through the loop, first clearing the display, then repositioning the cursor to the top left. It then calls the function to display the time and date, and the weather. The weather function is programmed to only actually grab the current weather every hour, as to not needlessly load up the site and get the IP address banned from it requesting every minute. The script will be a continual work in progress while I continue to learn Python and add features.

This is the end result of the script in action:

VFD Info

The display is very blue and looks a lot better in this picture than in real life. This display is very tired as the “pixels” in real life are mostly dim, and very uneven in brightness. I believe it’s the camera flash that makes it look blue, but in reality, it’s green. See my other posts about the other parts of programming for this project for more info.

UPDATE:

Several weeks later the project failed, and it was an important lesson type of failure. The raspberry pi ran pretty warm the whole time, but not knowing what was “normal” I didn’t think much of it, other than thinking that I should get some heatsinks on it. Well, by then it was too late. One day the display was blank. Both the pi and the display were toast. Looking at it then revealed that I was probably pulling too much amperage through the poor little pi. The lesson? Watch the power draw! In the future, anything external outside of an LED in my projects will have its own power supply. Unfortunately I couldn’t breathe any life into the pi or the display. Lost to the beginners lessons of time forever.