Binary-Decimal Display

Binary is used ubiquitous in computing and engineering, but people not involved in these areas might find it a total mystery. This display takes binary input and converts to decimal, and displays both simultaneously. Because of the large number of I/O required, I’ve adopted the Arduino Mega.

The display operates in two modes toggled by a slide switch: free-running and manual. In free-running mode, a counter runs from 0 to 255 and rolls over to 0 when the count reaches 256. Speed is controlled by a potentiometer between VCC and GND with wiper connected to an Arduino analog pin. In manual mode, the user sets the digits of the binary display by “touching” the buttons of each digit.

Here’s a video of the display in action.

Manual mode

In fact, the buttons are photoresistors whose resistance is inversely proportional to the amount of light impinging on them. In more detail, each digit has two identical photoresistors that form a voltage divider between VCC and GND. The photoresistor nearer the user is the button, and the photoresistor nearer the display is maintains the resistance corresponding to the ambient light level. Because both resistors of the voltage divider are photoresistors, and they’ve been well-matched, the voltage at the divider center is very close to VCC/2, regardless of ambient light level.

The voltage at divider center point is connected to the “+” input of an LM339 comparator array. An adjustable reference voltage is connected to the “-” input. When the user covers the button photoresistor, the divider center voltage drops below the reference voltage, causing the LM339 output to invert (I don’t recall the polarity), signaling the MCU to invert that digit in the binary number. The decimal number is calculated from this, and both are displayed.

In either free-running or manual mode, the current count is stored so that the user can switch back and forth between manual and free-running mode without resetting the count. I considered adding a reset to 0 button, but haven’t done it yet.

The smaller LEDs: showing how the conversion is done

In addition to binary and decimal digit display, the conversion is shown by displaying 2^i for the ith digit in the binary code when that ith digit is “one”1”, and nothing when that digit is “0”. The user can see that addiing these  2^i results in the displayed decimal.

Circuit diagrams

Arduino Mega pinout
Control panel – photoresistors, switches and potentiometer
LED board
Op-amp board

Comments are closed.