Building an Interactive Binary Calculator with Arduino

In this Arduino project we will share the creation of a physical input of a binary number using two boards — one for input control and another for displaying the result.

The Setup

The heart of the project involves allowing users to input an 8-bit number (ranging from 0 to 255) using physical switches representing individual bits.

As users toggle these switches, corresponding LEDs light up, providing a visual representation of the binary input.

When a button is pressed, the system calculates the decimal equivalent of the binary number.

The Components

Controller (1st Script)

  • Switches: 19, 18, 17, 16, 2, 3, 4, 5
  • LEDs: 6, 7, 8, 9, 10, 11, 12, 13
  • Button: 14
  • TX Pin: 1

Display (2nd Script)

  • RX Pin: 0 (Connect to the TX pin of the sender)
  • SDA: connect to HT16K33 display
  • SLC: connect to HT16K33 display

How It Works

Controller Script

  • The controller script reads the state of the switches, toggles LEDs based on switch states, and calculates the decimal value when the button is pressed. The calculated result is then sent to the display Arduino board.

Display Script

  • The display script receives the calculated decimal value from the controller and showcases it on a 4-digit display (dependency: Adafruit LEDBackpack Library)

Future Plans

The project is set to evolve, with plans to allow users to input two numbers and perform various calculations such as addition and subtraction.