Monday, April 14, 2008
Computer Dashboard, part 5 - Dampers
Back to Part 4
In the previous chapters we've seen how output from the pins of the I/O board can either switch an LED on or off, or move a meter. After doing some tests, I noticed that while it worked just fine, the output was rather "harsh". The LED was ON or it was OFF - immediately. The meter snapped with precision and speed to each position on the scale. Now, this might have been cool in the early 80s, when digital was new. But nowadays it's hip to soften the edges a bit and "fake" analog.
Witness the hypnotic sleep indicator on a MacBook - it fades in and out, as an incandescent lightbulb might do. So what I wanted to do was add some smoothing to my output devices - something to make the meter gradually move from one position to another, and fade the LEDs in and out.
This is very simple to do with a simple R/C network in between the output pins and the device. An R/C network is simply a single resistor and capacitor. A capacitor is like a very fast charging battery. (well, not really, but think of it that way). A resistor will affect how fast the capacitor charges. What this means is, when an output pin turns on, you can wire the resistor and capacitor in such a way that initially, most of the current goes into charging the capacitor, rather than into the LED. As the capacitor charges to full, more and more of the current goes into the LED. This results in a slow-on effect. When the pin turns off, the full capacitor discharges through the LED, resulting in a slow-off effect. Same for the meter - the capacitor will soak up current and release it during any change, resulting in a damping or slowing of any movement. The picture shows this - the input signal is the square spiky thing, the output is the gentle rampy thing.
I had to fool around with the resistor and capacitor values to arrive at the final configuration, but it's quite effective. Nowadays they're showing kids how to arrive at the same effect by programming microcontrollers. Sigh.