Raspberry Pi Buzz Wire Game (fully Recycled Build)
by AwniAlholi in Circuits > Raspberry Pi
16 Views, 0 Favorites, 0 Comments
Raspberry Pi Buzz Wire Game (fully Recycled Build)
A smart buzz wire game with automatic level detection, per zone vibration feedback, a live scoreboard and history on a web dashboard. Built entirely with hand tools and recycled materials only the electronics were bought.
Supplies
Github link: https://github.com/howest-mct/2025-2026-projectone-mct-AlholiAwni
Bill of Materials
The whole "making" part (box, frame, handle) is recycled and cost me nothing:
- Box & lid: recycled wood/plywood sheets (±3.3 mm).
- Frame: recycled plastic cable duct (Legrand) double duct per side.
- Handle: an empty bubble-blower bottle.
- Legs/support strips, glue, velcro, screws: leftover material
Electronics (bought, ±€130 total):
Part: Raspberry Pi 5 (4GB)
Qty: 1
Note: the brain
Part: IR obstacle sensor (TCRT5000-type, 3-pin)
Qty: 3 (5 bought)
Note: zone detection, 2–30 cm range, sensitivity adjustable via potentiometer
Part: TCS34725 color sensor (I2C)
Qty: 1
Note: level detection via strap color
Part: 4x3 matrix keypad
Qty: 1
Note: player ID
Part: LCD 1602 I2C (PCF8574A backpack)
Qty: 1
Note: game info + IP
Part: Coreless vibration motor 1015 (3V)
Qty: 1 (2 bought)
Note: zone feedback in the stick
Part: Tactile push buttons
Qty: 2
Note: power-off + display toggle
Part: Silicone hook-up wire (set)
Qty: 1
Note: wiring
Part: Stainless steel wire 1 mm (10 m)
Qty: 1
Note: buzz wire + ring
Part: JST XH 3-pin connector + housing
Qty: a few
Note: makes frame ↔ box and stick detachable
Tools
Only hand tools, deliberately chosen to prove this is re-creatable without a laser cutter or 3D printer:
- hand saw / coping saw
- drill + bits
- sandpaper
- wood glue + super glue + glue gun
- soldering iron + heat shrink
- multimeter (check continuity!)
- screwdriver, knife, ruler/pencil
How It Works (block Diagram)
The Raspberry Pi sits in the center. Inputs on the left, outputs on the right:
- In → keypad (player ID), 3× IR sensor (zones), color sensor (level), 3 contact wires (start / end / buzz), 2 push buttons.
- Pi (logic): Python backend with FastAPI + Socket.IO. Sensor threads (RPi.GPIO) push events to the async event loop via asyncio.run_coroutine_threadsafe.
- Out → vibration motor (PWM, stronger per zone), 16x2 LCD (game info / IP), the website (live + history).
- Database: MySQL database on the Pi (BuzzWireGame).
Set Up the Database
The database is normalized and consists of five main tables in MySQLDatabase:
- players — id, name, player_code (4 digits)
- levels — id, name, color (green = Easy, red = Hard)
- rounds — player_id (FK), level_id (FK), start_time, end_time, completed
- faults — round_id (FK), timestamp, fault_zone
- hardware_history — links sensor and actuator events to a round (with additional catalog tables: sensors, actuators, and hardware)
Backend
The Python backend runs continuously on the Pi (python backend/app.py):
- GPIO callbacks from the keypad, IR and contact wires run in separate threads and push events to the async loop.
- On startup the color sensor reads the level (normalized RGB → Euclidean distance against calibrated values → green or red).
- Start/end contacts handle the timer; if the ring touches the buzz wire → fault → game stops.
- All data is written to MySQL, even without the dashboard.
Frontend
A responsive, dark-themed single-page site (HTML/CSS/JS) on a separate web server:
- Live (Socket.IO): play time, current zone, game state, current level.
- REST (from DB): scoreboard per level (fastest first) + full history.
- Dashboard buttons: 4 test buttons for the vibration motor (one per zone) and a power-off button for the Pi.
- Secured with user management and passwords.
Build the Enclosure
The box is a wooden case (±50 × 25 × 25 cm) made from recycled sheets, built with hand tools: sawing, sanding, drilling and gluing. The top sheet is the lid that flips open (hinge) so you can reach the Pi and wiring. The back gets a feed-through for USB-C (Pi power) and a separate power supply.
Front Panel: Drill Holes and Place Components
Drill/cut the openings in the front panel and mount:
- left: the 4x3 keypad
- center: the 16x2 LCD, with the green LED below it
- right: the red power-off button
- the display-toggle button goes right next to the LCD (Desloovere feedback applied)
Mount the Sensors in the Lid
On the inside of the lid (the top sheet) go:
- 3 IR sensors at 10 / 25 / 40 cm → determine zones 2, 3 and 4 (zone 1 = start, no sensor).
- The TCS34725 color sensor, with velcro on both sides so the color strap lies flat over it.
The buzz wire dips down above each IR sensor so the ring comes within range (2–30 cm) of the IR sensor. This way you detect the zone without putting sensors on the frame.
This is what it should look like now:
Make the Swappable Wire Frame
The frame is an inverted U made from double plastic cable duct (2 legs + top bar), 50 cm wide. Cut the duct to size and glue/screw the corners. Sand and paint the frame white for a clean look.
Shape the Buzz Wire and Lay It in the Frame
Lay the stainless steel wire (1 mm) in a natural, wavy shape inside the duct — no sharp angles. At each IR position let the wire dip down (toward the IR sensor in the box), but not too close. Fix the wire in the duct. Start and end contacts sit at mid-height.
The Color Strap (level Detection)
Hang a colored strap (for my project I used 2 colored cloths) low on one leg, level with the velcro (or double face tape) on the box. The color sensor reads the color and picks the level:
- green → Easy
- red → Hard
Calibrate once: sample both colors with kalibratie.py; it writes normalized RGB constants that app.py uses.
Make the Handle (stick)
The handle is an empty bubble-blower bottle (recycled):
- Drill a hole in the bottom/through the cap for the wiring.
- Make a ring/loop from stainless steel wire (inner diameter ±2 cm) and fix it on top.
- Put the vibration motor inside the bottle.
- Run the wires (motor + ring contact) through the hole to a coiled cable toward the box.
Make It Detachable With JST XH 3-pin Connectors
To swap frames and detach the stick, I use JST XH 3-pin connectors (instead of GX12):
- Frame ↔ box: the contact wires (start / end / buzz + common ground) run through JST connectors, so you can lift one frame out and plug another in.
- Stick: a separate JST 3-pin for the vibration motor + ring contact.
Solder the wires to the JST pins, heat-shrink them, and check continuity with the multimeter.
Wire Everything to the Pi
Connect everything to the Raspberry Pi (BCM numbering):
- Keypad: rows on GPIO 17, 23, 25, 27 — columns on GPIO 24, 22, 5. (Do not change these pins.)
- IR sensors: GPIO 4, 6, 13 (active-LOW, internal pull-up).
- Vibration motor: GPIO 18 (PWM, via a transistor circuit — you don't drive the motor straight off a GPIO).
- Color sensor + LCD: I2C (color sensor 0x29, LCD 0x38/0x27).
- Buttons + contact wires: on their GPIOs with pull-up.
- Common ground
Testing
Test step by step with your separate test scripts (keypad.py, IRsensors.py, kleursensor.py) before running everything together:
- Keypad: does each key print the right value?
- IR: does each sensor detect object/free?
- Color sensor: does it read green vs. red correctly after calibration?
- Contact wires: do start, end and buzz trigger?
- Vibration motor: does it vibrate harder per zone?
- LCD: does it show game info and toggle to the IP?
Then start python backend/app.py and open the site at http://<Pi-IP>:5000/.
Done! Play
Click the wire frame into the two legs, plug in the JST connectors, put the strap on place, and you're ready:
- Green (on the website): you're safe, game running.
- Red (+ buzz/vibration): ring touched the wire → game over.
- Completed: ring through the end contact → time saved → appears on the scoreboard.