This mod was built specifically for my friend, web hosting provider, and occasional landlord as a thanks for various things over the years, not the least of which is allowing me to have a lab in the building, and being lenient on the concept of "fixed days for paying rent". He works at a certain auto manufacturer's research building, making sure the networks are up and that the data flows. Every now and then, through no fault of his own, something big happens. Like the time the air conditioning to the server room died, or the time some rather foolish person put two domain controllers on the same share. For those of you not versed in the black, miasmas depths that is windows networking, imagine an army of record clerks arguing over where to file everything, and you'll get the general picture as to what was happening on the system.
Jad, as the fellow is known to the online world, is the type of person who needs a bit of a psychic release when it comes to stressful situations, and I thought that the ability to hit the Big Red Button when life decides to become brutish, nasty and short-tempered will make the days go by smoother, and possibly keep him from choking whoever is responsible and landing in jail. There is a certain amount of catharsis in hitting a Big Red Button, a certain amount of comfort in seeing exactly how often something like this happens, a certain amount of pathos in seeing it all roll back to zero. So I wired up a simple time-since-reset counter that resets when the button is hit. Jad gets the call from the graphics department that a worm infected 90% of the desktops, and relief is a button slap away.
This is a conceptually simple device. User IO consists of a single button and an arbitrarily complex time representation. Time is shown, time goes up, press a button, time returned to zero. The only real concern is how to represent the time. I've had some jobs where a single digit that updates daily would never run over. I've had others where, quite literally the most interesting thing that happened over the course of an entire year was seeing a raccoon. On top of that, how do you represent the time? Binary? While a simple 8 bit binary display representing number of days would work for most of a year and Jad can read binary, this project is meant to be displayed, and I don't know if any of his coworkers are binary literate.
The original design used 2 7-segment LCD's. This had the dual disadvantage of implying that Jad couldn't keep the system up for more than 100 days, and being difficult to lay out a board for. I couldn't get a single layer board design to work, and my PCB fabrication technique isn't quite up to dual layer designs of any complexity yet. I could have simply wired the unroutable pins directly, but that's a pain to do and a bigger pain to debug, so when I got my hands on some HD44780 compatible 16x2 character vacuum fluorescent displays, it seemed a logical upgrade.
32 characters gives enough space to display 4 separate 2 digit numbers with 4 letter labels. Shorter labels means more digits. The setup I use has 3 digits reserved for days on top of hh:mm:ss, somewhat optimistically allowing for about 2 years, 8 months for fertilizer to hit the fan. More time could have been done by removing seconds and adding years, but for Jad's current job, that would be like pouring a shot glass into a pool.
There are two principal disadvantages of the VFDs, cost and current. It's hard to find a VFD for under $20, whereas if you look, you can find a 16x2 LCD for half that. I argue that until someone comes out with an HD44780 compatible nixie tube display, VFD's are the glowingest, friendliest character displays available and well worth the extra cash on any regularly used installation.
The current consumption is not a major design issue, but it is one to watch for. My model draws a hair over 500 MA when in use, which is slightly above the rating for the regulator that I use. The initial design had a single 7805 regulator without a heat sink feeding the controller and the LCD. The regulator would get to boiling hot quickly and cut out after about 10 minutes. Adding a transistor follower to handle the current worked, but there was still more heat dissipation then I would like, so I had to add a radiator.
Having no TO-220 compatible heatsinks on hand, I improvised. Thankfully, the HoA lab stockpiles are good providers during times like these. If there is one thing that the House of Awesome has plenty of, it's old, dead computers. Most of which have horribly outdated video cards who's aluminum heatsink is thin enough to be easily cut to size. I did this (less than 5 minutes hacksaw work) and screwed the result to the 7805 with a bit of stock thermal grease (also common, as no one here uses stock grease). The transistor follower was now cool enough to touch.
This project uses the same time keeping method as my other timekeeping devices, albeit with a potentiometer to control the voltage level instead of a diode clamp. Basically, I take the unregulated input from an AC wall wart, put it through a diode to block half the waveform and a potentiometer to keep the voltage within tolerance, and plug the result into one of the microcontroller's pins. The microcontroller gets 60 pulses per second as timed by the good people at Detroit Edison, and uses this to keep accurate time. This will probably be my last circuit to use this method of timekeeping, as I have recently discovered the wonders of dedicated I2C real time clocks.
At the time of construction, I was out of 5 volt zener diodes, so I substituted a potentiometer. This isn't a perfect solution; the output is dependent on the input voltage. The transformer windings have a ratio of 8:1, and mains voltage generally ranges from 114 to 126 vac (12 volt range). Given that this is the root mean square and we want peak to peak, and that the output is rectified and only half the waveform is used, the range is multiplied by the square root of 2 and divided by 2, yielding a variance before step down of 8.5 volts, or 1.1v after stepping down. It's further divided by the resistor bridge so the actual input Dependant voltage fluctuation is less than a volt. Given the maximum voltage for input pins of an AVR at 5 volts 5.5v, this isn't much of an issue. Overvoltage may be a problem, but the clamping diodes built into the input line should prevent damage. The major problem is the purity of the input signal. A Zener diode will clamp the voltage neatly at 5 volts, whereas the potentiometer transfers every nuance of the wave. Aggressive software based debounce algorithms take care of this, but for actually important triggers, a zener (or preferably a Schmitt trigger) should be used. That is, if you don't just say screw it and get an RTC chip.
There was one notable flaw (fixed in the files) in the first revision of the circuit board. I swapped RS and R/W. This design doesn't use the write capability of the board, so R/W is shorted to ground. Since the VFD is connected via a ribbon cable, it was easy enough to fix without needing a new board or trimming leads. Since this is a project for someone else, I upped the quality and used standoff blocks instead of hot melt gluing the board in place. Only 3 were used, due to the capacitor being larger than planned and taking up the space that I was planning on using for the 4th one.
I recently picked up a cheap small form factor laminator for toner transfer. It gets infinitely better results than the iron on method, and allows the use of lighter materials such as magazine paper without tearing. A full description of the capabilities will wait for a future writeup. One of the many materials tested was papyrus paper. It doesn't give very good coverage of smaller signals (as you can see), but it practically falls off the board. No need for a soak, just peel off & discard. This makes it ideal for the silkscreen layer. Line up the paper with the non copper side, run it through the laminator, and you don't have to guess at which chip goes where or the alignment. Very handy.
The software is relatively simple. The bulk of the code is the handler software for the VFD. It's a parallel protocol that is compatible with the industry standard HD44780 controller. Communication is done over 8 or 4 data lines, one data direction line (R/W), a line to select printing characters or system commands (RS), and the data strobe line (E). The R/W line is not essential. The character area is treated as bank of RAM, any addresses outside of the screen area can be used as general purpose memory. If you don't need the extra storage, the only other reason the R/W line is used is to indicate command time out. If you want the extra pin, having a long timeout works, albeit with a limited refresh rate
The best site for learning how to use a HD44780 is without a doubt is a geocitys page that I thankfully discovered a few weeks before geocitys went to the great archive in the sky. It contained descriptions of functionality, animated examples, and most significantly, a full blown simulator that makes experimenting a snap. The HD44780 datasheet is useful for a reference, but sights like that make learning a breeze.
With geocity's death, many worthless pages and the occasional gem is lost to us forever. Thankfully, I was able to keep the simulator portion of the page and upload it for everyone to share. If you're the original author, send me a note, I'd be happy to re-host your tutorials.
Even the best tutorial and description still means nothing without hands on experience. Once I got comfortable with the simulator, I threw together a prototype board with an 8x dip switch for the parallel line, a switch for RS and a button for E. This let me get a hands on feel for the process, and demonstrated that the display worked, somewhat reassuring after spending hours writing the code and seeing nothing. Software problems only take time to fix, hardware problems require parts which may or may not be on hand.
The remainder of the code is simple. It uses the same timekeeping code as the binary and nixie tube clocks. Due to the relatively long time it takes to update the VFD (a time that would be shorter if the rw line was used) only one character is updated per cycle. There's no debounce on the switch, the display refresh takes enough time that it's not needed. A randomly selected (based on the milliseconds) message is displayed and the time is reset.
This project is a bit big for the standard altoids tin approach. My next step up is to use the tins that Twining distributes their loose leaf tea in, but even that looked too small. This called for a cookie tin. The tin used originally held some strange Chinese cookies given to me some time ago. It's slightly larger than needed, but square looks better than round, so it got the job. Step 1 was to cut the holes. The button was simple, chuck up the right sized drill and make the hole. The window for the display was trickier. I used a tool called a nibbler to clip away at the tin until it reached the correct shape (or at least something that looked vaguely like the correct shape). The button had a retaining nut to keep it in place. The VFD has 4 screw holes for mounting. For situations like this, I have special bolts that have a tapped hole on the head, so they are easy to stack to the proper length.
A brief aside on photographing VFD's. After some experimentation and much that the only way to get a decent picture of VFD's without them looking blurry due to light bleed. Flash is right out, that just makes the characters disappear. At the suggestion of more photographically minded friends, I set the F-stop to the highest possible and took a long exposure. The results aren't the same as what my eyes see, but they're good enough for me.
The circuit board is mounted to the side wall of the tin, as the button is mounted low enough to make mounting it on the bottom a tricky endeavor. My machining skills are sub par, but drilling the holes in the right spot is easy enough. Drill the mounting holes in the (unpopulated) PCB, tape the PCB to the spot where you plan on mounting it (making sure that it is facing the right direction) and drill using the holes in the PCB as a guide.
The labels were tricky. If the tin was easily disassemble, I would have used the toner transfer/etch method. Getting that to work in this case would be rather decidedly nontrivial, so I opted for using printed transparencies for the label. I picked up a pack of overhead projector sheets as part of the toner transfer experiment. They turned out to be useless for that purpose, but worked for this. Different methods were tried to stick the labels to the tin. It turns out that superglue is (or contains) some sort of solvent that causes the toner to run when I glued the label on. After several tries, the bottom label ("since a disaster") was glued on to my satisfaction. I gave up on gluing the top level ("It has been"), and used clear packing tape to attach the top label.
As an afterthought, I removed the panted-on label from the sides of the tin. I found the best thing to do this with was a green scratch pad soaked in acetone. The scratch pad breaks the varnish and ensures that the solvent gets spread on a large surface area of the paint. This setup is good for everything but the curved edges. The pad I used couldn't bend with the curve, but fine grained sandpaper made an adequate substitute.
Although the project was designed around the idea of "XXX days since life happened", the project could be used to indicate many other things. XKCD played with the concept brilliantly. "Do Not Press" would be a good way to see how many people with greater curiosity than impulse control are in the area. A Tattoo artist friend of mine wanted one that measured the time since someone got a worthwhile tattoo and not just another tramp stamp. I thought about making one for myself, reading "It has been this long since I didn't feel bitter", but there is only so much time representable by 32 characters.
The Zip or gzipped tar archive contains all the files needed to reproduce this project, released under the BSD license. The software was written for AVR-GCC, and the board was done up with cadsoft eagle. PDF's of the copper mask are included as well. There are 2 versions of the PCB, one designed for VFD's (vfdclock.*) and one for LCD's (lcdclock.*), the VFD design differs mainly in that there is a second 7805 regulator and no contrast potentiometer. The software is identical for both designs.
If you wish to comment on this mod, send me an email at p@ohbah.com.
Return to index. All works on this page is copyright 2009 Patrick Tait. Some rights reserved: