A 2-Bit Adder Learning and Interactive Quiz Game (Multiplayer)
by 1077581 in Circuits > Arduino
59 Views, 2 Favorites, 0 Comments
A 2-Bit Adder Learning and Interactive Quiz Game (Multiplayer)
Hello! My name is Muhammad Dawood Khan and this project is a 2-bit binary adder using logic gates and an Arduino, combined with an interactive two-player quiz game.
This project takes two 2-bit binary numbers and adds them using a real digital logic circuit built with AND, XOR, and OR gates. The result is displayed through LEDs. To make it more engaging, I added a two-player quiz game mode using a touch sensor, two buttons, and a buzzer, where players answer questions about logic gates and binary.
This project helped me understand:
- How computers use binary math
- How logic gates perform addition
- How hardware and software work together
- How to design a user-interactive system
Although it may look complex at first, everything is broken down step by step, making it beginner-friendly.
Step 1: How the Project Works (Overview)
This project has two modes. Touch the touch sensor to switch between them.
Mode A – Adder Mode
- DIP switches input two 2-bit binary numbers
- Logic gate chips calculate the result
- Three LEDs display the binary output
- Result also streams to the Serial Monitor
Mode B – Game Mode
- Two players take turns
- First to 3 points wins
- Questions about logic gates and binary appear in the Serial Monitor
- Press Button 1 for option A, Button 2 for option B
- Correct answer earns a point with a victory buzzer sound
- Wrong answer gets a defeat buzzer sound
- Winner gets a special victory sound and game resets to adder mode
Supplies
For this project you will require (links are included):
1x Buzzer: $1.14
1x Standard 4 Position DIP Switch: $0.98
1x Touch sensor: $11.54
3x LED’s: $0.80
1x LCD $14
1x XOR Logic Gate$2.41
1x AND Logic Gate$0.95
1x OR Logic Gate$1.80
6x 10kΩ Resistors 0.40
3x 330Ω Resistors$0.50
1x Arduino UNO R3$15.99
1x Wire Pawck$14.99
1x Breadboard$4.99
Total Project Cost:
$59.41
Understanding the 2-Bit Adder
A 2-bit adder is made using two half adders:
- First half adder adds the least significant bits
- Second half adder adds the most significant bits and carry
Outputs:
- S0 → 1’s place
- S1 → 2’s place
- C2 → 4’s place
Together, they form a 3-bit binary number (0–6).
Wiring the Adder
DIP switch outputs connect to the 74HC86 (XOR), 74HC08 (AND), and 74HC32 (OR) chips on the breadboard. The chips calculate the result and send it to three LEDs through 330Ω resistors.
- S0 → pin 4
- S1 → pin 3
- C2 → pin 2
All chips connect to 5V and GND from the Arduino.
Wiring the Touch Sensor
The touch sensor is a capacitive module, meaning it detects the electrical charge from your finger without needing to physically press anything. It only needs 3 wires:
- VCC → 5V
- GND → GND
- SIG → pin 7
No resistor is needed since the module has built-in circuitry that handles the signal. When touched, it sends a HIGH signal to pin 7 on the Arduino, which triggers the mode switch between adder mode and game mode.
Wiring the Buzzer
Step 4: Wiring the Buzzer
- Positive leg → pin 8
- Negative leg → GND
The buzzer provides sound feedback for three different events:
- Correct answer → short rising victory sound
- Wrong answer → low defeat sound
- Game winner → long celebratory melody
Wiring the Buttons
- Button 1 one leg → 5V, other leg → pin 5
- Button 2 one leg → 5V, other leg → pin 6
- 10kΩ resistor from each signal row to GND
The buttons are used during game mode only. Button 1 selects option A and Button 2 selects option B. When a button is pressed, 5V flows through to the signal pin and the Arduino reads it as HIGH.
Adder Mode
In this mode:
- Arduino reads S0, S1, and C2 from the breadboard
- Displays the binary result in the Serial Monitor
- Updates every 0.5 seconds as you flip the DIP switches
Example:
Binary: 010
(means 1 + 1 = 2)
Game Mode
How to Play:
- Touch the touch sensor to start game mode
- Serial Monitor shows which player's turn it is
- A question about logic gates or binary appears
- Press Button 1 for option A, Button 2 for option B
- Correct answer = 1 point + victory buzzer sound
- Wrong answer = defeat buzzer sound
- First to 3 points wins and a winner melody plays
- Game automatically switches back to adder mode
Switching Modes
If you want to stop the game at any time and go back to the adder, simply touch the touch sensor again. It will immediately switch back to adder mode and the Serial Monitor will display "--- ADDER MODE ---". The scores will reset when you start a new game.
Code
Downloads
Final Thoughts
This project combines:
- Digital logic
- Binary math
- Programming
- User interaction
- Sound feedback
It helped me understand how real computers perform calculations using nothing but logic gates, and how hardware and software can work together seamlessly. Building the 2-bit adder from scratch using physical chips made binary math click in a way that just reading about it never could. The game mode makes learning logic gates fun and competitive, turning a complex topic into something anyone can enjoy.