I bought a digital volt-ohm meter for $5 at a ham flea market years ago. It is probably about 1970 vintage and uses old fashioned Nixie display tubes. These tubes have long since been replaced with 7-segment LEDs and then LCDs, and then pixel based LCDs.
Nixies are a favorite among hobbyists who like archaic parts because of the visual appeal of the display. Each numeral is individually "drawn" from a gas discharge tube, rather than being crudely constructed from segments or dots. The VOM has three Nixie tubes with 0-9 plus decimal point, plus a single neon tube for the MSD (1 or off). So it is a 3-1/2 digit device with range from 0000 to 1999.
A. Hardware approach ...
Plan 1 was to let the PIC generate a DC voltage equivalent to the time in millivolts, for example 10:35 is 1035mV, and input that to the meter. The PIC would use its PWM module to generate voltages. Unfortunately, the PWM is only 10 bits, a resolution of one part in 1024. I need one part in 1259 so I couldn't be accurate right to the minute. Also there would be some accuracy issues resulting in a little uncertainty in the 1's minute digit. The advantage would be that there would be no modification to the VOM at all.
Plan 2 required investigating how the VOM works. I could have the PIC put BCD data right to the three Nixie driver chips (if I have their data), but it might be nice to have an easier way that doesn't require 12 data lines and cutting a bunch of traces.
Each Nixie has three chips in front of it. First is a 7441B Nixie driver, fairly standard. Next is a SN7075N and behind it is a SN7090N. Probably TTL chips 7475 and 7490 before the industry standardized on 7400 series numbering for TTL devices.
The VOM works this: It clears the counters to zeroes, then starts a ramp generator and at the same time gates on a string of pulses to the units digit counter. The ramp generator and unknown voltage both go to a comparator. When the ramp voltage becomes equal to the unknown voltage, a logic signal is generated which gates off the pulse train to the counter. At the same time or just after, the latch signal is given to the 7075 to update the display.
Next, a clear signal is given to the counters and the next measurement starts.
Initially, I was going to monitor the DMM's "clear" line, and after it was asserted, I would substitute my pulse string, virus like, for its own, in the available window. For example, if it's 8:37 AM (or PM), I send 837 pulses and the DMM is none the wiser. I'd have to sneak them in fast enough to be finished before the DMM generated its "latch" pulse. Due to technical difficulties too tedious to describe here, I wound up having to take control of both the clear and latch lines form the PIC. Easy enough except my idea of keeping things minimalist by using an 8-pin 12F629 chip severely challenged me for my I/O needs as the project progressed.
B. The software ...
I was initially going to use a 32,768 (2^15) hertz "watch crystal" for my PIC's timebase, just because that approach seems to go with clocks. You divide it down to 1 Hz and -- Bob's your uncle -- you're there. But that speed was too slow to allow me to jam my train of pulses (maximum of 1259) into the available window. So I went to a 455 kHz crystal and to a method of calculating 1 second intervals that's lots cooler. Here we go ...
This uses a technique I found on the web described by
Roman Black, based on an idea by Bob Ammerman. It uses a
method based on the Bresenham algorithm which produces
intervals that average exactly a second, although there
may be some small jitter (which can be calculated) in each
second's time.
It will work like this. My clock speed is 455,000/4 or
113,750Hz. I put that number into a 24 bit variable. I set
timer 0 to interrupt every 256 counts. At each interrupt,
I subtract 256 from the variable. When the variable becomes
less than 256, I add 113,750 to it and increment the seconds
count.
Obviously, over time my *average* second takes 113,750 counts,
which would be perfect. But each individual second could be
off by as much as 256, so my maximum jitter is 256/113,750 or
0.23%. If I used a 1MHz clock and interrupted every 128
counts, jitter would be 0.0128%, but 0.23% is plenty good for
this application. My Nixie clock won't show individual
seconds and over 60 seconds the errors should cancel pretty well.
(What's the accuracy over longer periods, assuming a perfectly
accurate crystal? Well, the uncertainty is never larger than
256 counts at any given time. So for a full minute, the jitter
would be 0.23% / 60, for an hour, it's 0.23% / 3600, and so on.
That's why it's said to approach perfect accuracy over time.)
Black said you can do this for any crystal frequency. I'd
say that's true, but since the PIC clock is Fxtal / 4, if
that division didn't yield an integer, you'd want to trim
the crystal's frequency (+/-3 Hz maximum) to produce an integral
count.
C. Summary ...
Nick's Law says that any programming or hardware project will be two to ten times more complicated than originally envisioned. This one fell comfortably within those boundaries. The clock works great. A clock doesn't have to do much, right? But it keeps good time and doesn't lock up or show any strange behavior. At least not any more.
A few things are missing or not fully developed. First, there's no colon. I can manipulate a decimal point into that position if I want a delimiter. I've considered using a long neon tube painted black except for two dot-sized openings on each end, and possibly using two small yellow LEDs, but I decided it was time to call this project to a halt.
Another sort of clunky part is that my setting routines aren't very well human engineered, but they do work. I added small surface mount SET and ADVANCE pushbuttons on the rear of the case.
Finally, I wanted battery backup. The PIC board should pull less than 1 mA so a tiny battery should maintain the time even during long outages. I mounted a little 3-cell nicad pack in the box, diode auctioneered with the main 5 VDC supply, but I abandoned it when I had startup problems. I found that the PIC needs a clean RESET signal, which here means pulling the supply voltage all the way to zero. So to use the battery, I'd need a third button on the back of the box, labeled RESET. But I've declared this project finished.
Nixie mania? Just this month (September, 2009) I found another Nixie based DMM at a hamfest for $5. It's a Bell & Howell unit made by Heathkit for an electronics class. But it has only 2 & 1/2 digits so isn't suitable for use as a clock. I should consider myself lucky.
No comments:
Post a Comment