My inspiration for this project came from a lecture where they showed someone who created a basketball game as their final project. I often get bored and love playing games, so I decided to make my own version using paper balls, which are always around. This makes it simple, fun, and easy to play anytime.
Electronics
Arduino UNO
Jumper Wires
I2C LCD
Red LED
Crocodile Wires
Breadboard
Ultrasonic Sensor
push button
Enclosure Tools
Cardboard
Glue Gun
Cutter Blade
Masking Tape
Input Actions :
Paper Ball Hits Near the Ultrasonic Sensor : sensor detects the object
No paper detected : nothing happens
push button --> to reset score
Output Actions :
When paper ball is detected (point scored)
-LED blinks & score increases on LCD
No paper detected : LED remains ON & LCD score is the same
Wiring on TinkerCad (same wiring on real life ) on tinkercad use the default wiring they have for the lcd
Connections
LCD I2C :
GND --> GND ( Arduino )
VCC --> 5V
SDA --> A4 (default)
SCL --> A5 (default)
Ultrasonic Sensor
VCC --> 5V
Trig --> pin 3
Echo --> pin 4
GND --> GND
LED
Anode --> pin 7
Cathode --> GND
Push button
terminal 1 --> pin 8
terminal 2 --> GND
Wiring on Breadboard
Arduino Code
Declare pin locations:
Assign pin numbers for the ultrasonic sensor (trig & echo pins), LED, and reset button.
Setup section void setup ()
Set pin modes (e.g., LED as output, ultrasonic sensor pins, and reset button as input with INPUT_PULLUP
Initialize the LCD and display "Score: 0".
Turn the LED ON by default to indicate the system is active.
Loop section void loop ()
Reset button functionality:
Uses if statements to check if the reset button is pressed.
If pressed, it resets the score to zero and updates the LCD.
Ultrasonic sensor detection:
Uses digitalWrite(trigPin, HIGH) to send a pulse.
Echo pin reads the returning pulse to measure distance.
If a ball is detected within the scoring range, the score increases and is displayed on the LCD.
LED behavior:
Blinks when a score is registered.
Stays ON when waiting for a score.
Final Outcome Videos
My biggest challenge with the cardboard enclosure was extending the wires—something always seemed to stop working whenever I tried. After some trial and error, I finally got everything to work.
A useful tip: Masking tape is essential for successfully extending wires! It helps secure the connections and prevents loose or faulty wiring.
For the LCD wiring, I wasn’t sure how to set it up correctly, so I looked it up on Google and found a helpful guide https://lastminuteengineers.com/i2c-lcd-arduino-tutorial/
https://www.youtube.com/watch?v=X_hH5BzYp6s --> first couple of mins
For the code, I had it mostly working but needed a few adjustments. I used ChatGPT to help fix and fine-tune it.