This project shows how to convert a Decimal number into a Binary number. The Decimal number is fed to the Arduino through a 4x4 Keypad. Arduino then converts this Decimal number to its Binary equivalent. These numbers are displayed on an OLED Display and Serial Monitor. The Binary number is also represented with 8 LEDs.
This project concretely demonstrates the steps for converting Decimal numbers to Binary. It receives numerical input via a 4x4 Keypad, then the Arduino performs mathematical processing to convert the value, and finally displays the result in three ways: an OLED screen, the Serial Monitor, and an 8-LED panel to visualize the operation of Bits at a hardware level.
Key Components and Engineering Details
To ensure this project functions completely, we have selected stable components suitable for embedded systems, as follows:
- Arduino Board (Uno/Nano): Acts as the central processing unit (MCU), controlling timing, receiving inputs, and commanding outputs.
- 4x4 Keypad: Uses a Scan Matrix method to detect which button is pressed, reducing Arduino pin usage by controlling all 16 buttons with only 8 pins.
- OLED Display (I2C): A small display that provides high clarity. It uses the I2C (SDA/SCL) communication protocol, which saves connection pins and displays numbers in real-time.
- 8 LEDs and resistors (220-330 Ohms): Used to display an 8-Bit (1 Byte) binary number, where each LED represents a place value (from $2^0$ to $2^7$). A lit LED means "1", and an unlit LED means "0".
System Logic Analysis
The program's operation can be divided into 3 main steps, following computer engineering logic:
1. Data Input
When the user presses a button on the Keypad, the number is received as characters (Char). The program then concatenates these characters into a string (String) and converts it into an integer (Integer), preparing it for calculation.
2. Conversion Logic
The core of the conversion involves examining the decimal number at the bit level. The program uses Bitwise Operation logic or the modulo operation, as follows:
- The program will loop 8 times (for 8 bits).
- In each round, it will use Bit Shift or check if the bit at that position is 1 or 0.
- If the value in that bit is 1, the program will command the Digital pin connected to that LED to be
HIGH; if it is 0, it will beLOW.
3. Visualization
- OLED: Displays the input decimal number and the binary number in text format.
- LED Array: Shows the electrical state of 1-byte data, allowing users to clearly understand the "High/Low" concept in digital systems.
- Serial Monitor: For debugging data during program development.
Project Summary
This project is not just a simple calculator but an excellent learning tool that makes intangible electronic concepts visible through LED lights. It is suitable for students and beginners interested in studying Bit Manipulation and comprehensively connecting Peripherals with Arduino, covering Parallel (LEDs), Matrix (Keypad), and Serial Communication (OLED) methods.