2009-03-01
To make the bolometer direct-reading I threw together this relatively simple 4-digit 7-segment digital display, driven by an atmel ATtiny13V. The tiny13 ADC measures the heater supply voltage, and computes the current applied power based on its memory of the quiescent bias power. The bias zeroing power is remembered with a button press.
The display is quite straight forward, but a little involved to construct because of the low IO pin count of the ATtiny13. I did not have an LCD display in the junkbox, but I had lots of 7-segment LED units, so naturally enough I used what I had. A pair of 74HC595 serial-in parallel-out registered shift registers does the 3-wire to 12-wire conversion required to multiplex the display. The displays are common cathode, the 8 anodes (7 segments + decimal point) are fed by the first 74HC595 in parallel through current limiting resistors. The four cathodes are each connected through a 2N7000 multiplexing FET, and the FET gates driven from the 4 LSB of the second 74HC595. (As there are 4 spare multiplexing pull-downs the general scheme could drive 8 digits).
I briefly toyed with using 4 74HC595s, one for each 7-segment unit so each would have its own 8-bit memory register... While this would have simplified the driving logic (no need to multiplex, just clock the data in once and latch it), it would have meant 32 current limiting resistors and I didn't feel like soldering in that many (also I lacked 32 220 ohm resistors anyway).
The wiring pencil once again made the construction fairly swift. The wiring is quite dense and much care was required, but otherwise construction was uneventful.
The display interface is via a 5-pin header. Two power lines, one data, and two clocks (shift and output latch). I toyed with the idea of bringing out the output enable so the display could be blanked and perhaps made somewhat more fail-safe in the event of lost multiplexing drive (which might cause excessive current in the static display). Instead I just used 220 ohm dropper resistors, giving a somewhat dimmer display but an inherently fail-safe one. The reset line of the tiny13 would be required to drive the enable line anyway as I needed two spare pins for the rest of the application.
The remaining work is simply software. The display is multiplexed continously in a tight loop. The digits are bit-mapped into a byte wide, 18 byte long table for the digits 0-9, A-F, decimal point and blank. (The last two being trivial and not strictly required). I tested the display by having it dump a 16 bit integer in hex that was being incremented... The final application only requires the 0-9 (and E) states, so the rest could be omitted to save ROM space. The current version of the application takes about 900+ bytes so it just fits.
The ADC runs continously in auto-triggered mode. This is a problem as the ADC noise is significant and the application really needs more than the 10 bits of precision available... I need to work on this some more. The tiny13 timer is being used to periodically update the display state vector. It is possible to use the timer interrupt to trigger an ADC conversion in full noise-reduction sleep, but it will cause a small gap in the multiplexing which may be noticeable... Haven't tried that yet.
It does however basically work. The power computation is done in fixed-point arithmetic using longs. One intermediate code version was simply a 0-5 volt display (which worked quite well). A pin-change interrupt is utilised to cause memorisation of the current heater power (i.e. the zero button), each timer interrupt the difference between that value and the current value is placed into the display vector.
While annoying to wire-up the display is straight forward, easy to drive and expandable almost without limit. The dedicated register version would be quite nice as it requires no CPU time to maintain, you just clock in new data when you want an update. The 74HC595 can be clocked at 100 MHz, so most MCUs need no wait states and only a few cycles per segment. A PCB would remove the drudgery of building the display. The 74HC595 costs $0.30 - $1.50 depending on where you buy it, and 7-segement displays are about the same (4-digit display modules suitable for the multiplexing system I used are about $1.20 retail). At < $4 that is fairly competitive with LCD displays for a small number of digits. LCDs are obviously more flexible and cheaper but perhaps for some applications these nice bright displays are easy to build and talk to.
Application wise, the code is still work in progress. I think the limitations of the tiny13 will make the display stability an issue, the ADC just isn't good enough. Using a multimeter and a calculator is better for precision measurement, and the moving coil meter is nicer for general 1-100 mW trending. Building the display and its drive code was quite fun however, and probably more useful in the long run than a digital display for the bolometer.
Leave a comment on this article.
title | type | size |
---|---|---|
The Code for the Bolometer Display | application/gzip | 5.744 kbytes |
Parent article: RF and Optical Bolometer.