The folks over at Adafruit have been busy designing an LED matrix wristwatch for a while now. The circuit works great, but since this watch is powered by a coin cell battery, they’d really like to get the power consumption as low as possible. This means they needed a test rig to measure the consumption of each firmware revision, but how exactly do you build a voltage logger that works with voltages and currents this small? It turned out to be a very interesting project, with plenty of info on how to build an accurate voltage logger for really small projects.
Adafruit’s TIMESQUARE watch is a small circuit board with an ATMega328p microcontroller and an 8×8 red LED matrix powered by a single coin battery. To test each revision of the firmware, the folks at Adafruit broke out their Arduino data logging shield to press the watch’s button once a minute (activating the display) and measuring the voltage of the battery.
The naive approach to logging the voltage on the watch would use a digital pin on the data logging shield to activate the watch and then read the voltage with an analog input pin. This won’t work correctly, though: the microcontroller on the watch is very good at getting the power it needs from anywhere, and connecting it directly to an Arduino would skew the results.
The alternative solution would be to use an optoisolator, but surprisingly the Adafrtuit lab didn’t have any in stock. There’s another way to actuate a button on the watch without any power, though: tri-state logic.
Instead of sending 5 Volts to the pin connected to the watch’s button, the data logging shield instead alternates between input and output. When the digital pin on the shield is an input, the watch sees an open circuit. When the digital pin is changed to an output, current flows from the watch to ground, just as it would without the data logging shield at all.
It’s a neat trick, and for anyone whose eyes glaze over the words. “tri-state output” and “high impedance state”, a perfect introduction to something a little more complex than blinking a LED with an Arduino.