The 7-segment display shows the score, while the LCD displays messages such as the game title, "Game Start", and "Game Over". A reset button allows restarting the game anytime.
This project is perfect for Arduino beginners and can be used as a mini project for school, college, or DIY fun.
Components Required
-
Arduino UNO (or compatible)
-
Ultrasonic Sensor (HC-SR04)
-
16x2 LCD (without I2C module, parallel mode)
-
2-digit 7-segment display (common cathode)
-
Push button (for reset)
-
10k Potentiometer (for LCD contrast)
-
Resistors (220Ω for LCD backlight & button pull-down if needed)
-
Breadboard and jumper wires
Buzzer
Circuit Diagram (Connections)
I2C LCD (16x2)
-
VCC → 5V
-
GND → GND
-
SDA → A4
-
SCL → A5
VCC → 5V
GND → GND
SDA → A4
SCL → A5
Ultrasonic Sensor
-
VCC → 5V
-
GND → GND
-
TRIG → D2
-
ECHO → D3
VCC → 5V
GND → GND
TRIG → D2
ECHO → D3
Buzzer
- vcc→ D8
-
GND → GND
GND → GND
Reset Button
-
One side → D13
-
Other side → GND
One side → D13
Other side → GND
2-digit 7-Segment Display (Common Cathode)
-
Digit1 → D6
-
Digit2 → D7
-
Segments a–g → A0, A1, A2, A3, A4, A5, D12
Digit1 → D6
Digit2 → D7
Segments a–g → A0, A1, A2, A3, A4, A5, D12
How the Game Works
LCD shows AMHAR HIZBULLAH.CC BASKET BALL GAME at startup.
-
Game starts → LCD shows GAME START!
-
Ball passes hoop → Ultrasonic detects → score increases
-
Buzzer sounds for 200ms on each goal
-
Score displayed only on 7-segment
-
Score reaches 20 → LCD shows GAME OVER + final score
-
Press Reset button → Score resets and new game begins
-
.
Final Output
-
LCD: Game title, Start, Game Over messages
-
7-Segment: Real-time score
-
Ultrasonic: Detects each basket
-
Button: Restart game anytime
Comments
Post a Comment