Reading LEDs for crowdsourcing kits: Which way and why does it matter?
Thursday, May 02, 2013 - 06:03 PM
In February, WNYC set out to design and build Cicada Trackers for the emergence of Brood II that occurs every 17 years. During development of the prototype we ran into a minor hurdle: We wanted our listeners to be able to read the temperature from their sensor, but the kit we wanted to use lacked the 7-segment LEDs needed to present the temperature in a human readable form. Worried that not all Radioshacks stocking the Arduino Uno and SideKick Basic Kit For Arduino would necessarily have 7 segment LEDs we decided instead to use the LEDs that shipped with the Basic Kit.
Our first prototypes were a success; the thermometer was reasonably accurate. The website readily converted a bit pattern into a temperature. Everything worked well until we handed the sensor to somebody outside of our team to try. Their immediate response was "Which way do we read it?"
At the time, the unit’s output was a line of LEDs displaying the thermometer’s value as a binary number. Numbers in this form are not all that different from the decimal numbers we work with every day. We know for example 1,234 is (1 * 1000) + (2 * 100) + (3 * 10) + (4). Binary numbers work much the same way, but i in increments of two instead of ten. 10,011,010,010 is (1 * 1024) + (1 * 128) + (1 * 64) + (1 * 16) + (1 * 2). Like a decimal number, reversing the order of the digits in a binary number changes its meaning. Just as 1,234 and 4,321 are not the same number in decimal, 10,011,010,010 when working in binary.
In our first revision we changed the color of one of the LEDs so our builders knew which end was the beginning. This worked well until we asked people outside of our project to test our instructions. Almost half the time the different colored LED was installed on the wrong side rendering the sensor useless. How nice it would be to be able to answer "It doesn't matter" to the question of the LED’s direction.
Yesterday I released a general purpose version of of the directional parity algorithm written in Python. It works with numbers of arbitrary size and includes command line versions for shell script users. In the days to come I anticipate adding libraries for other languages as well. Feel free to download and let us know what sort of applications you’re using it for.