Smart LED Juggling Balls With Real-Time Web Dashboard
by Eliaswulf in Circuits > Raspberry Pi
8 Views, 0 Favorites, 0 Comments
Smart LED Juggling Balls With Real-Time Web Dashboard
FOTO BASISTATION MET JONGLEERBALLEN OP
Have you ever wanted to track your juggling performance? In this Instructable, I will show you how I built Smart LED Juggling Balls. This project uses a XIAO ESP32 C3 inside each juggling ball to measure impacts and free-fall using a BMI sensor. It automatically detects whether the ball was caught or dropped, giving instant visual feedback through NeoPixels with fully customizable colors. The data is transmitted wirelessly to a Raspberry Pi 5 base station, where an RFID reader starts a personalized session and a database logs your battery life and juggling stats.
Supplies
COMPONENTS:
- 3x XIAO ESP32 C3 Microcontroller
- 1x XIAO ESP32 C3 Antenna
- 1x Raspberry Pi 5 (8GB)
- 3x BMI IMU Sensor (I2C)
- 3x INA219 Current/Voltage Sensor
- 6x WS2812B NeoPixels (7 LEDs each)
- 1x MFRC522 RFID Reader
- 1x TCRT5000 Infrared Reflective Sensor
- 1x lcd screen
- 3x 3.7V 600mAh LIPO Batteries
- Transparant PETG (200g)
- PLA black (150g)
- Nails
- Screws
- Jumping wires
- 30AWG Wires
- Breadboard
- External power supply breadboard (5v)
- 3 to 1 usb-A to 3 x Type 3
- Wood 8mm thick
- heat-shrink tubing
- Kapton Tape
- usb c to usb c extension
- transparant silicone
- hinges
TOOLS:
- Soldering iron & wire
- 3D printer
- ...
The total estimated cost to build a set of three smart balls and the base station is around €300.
Circuit Design (Fritzing)
AFBEELDING FRITZING SCHEMAS
The hardware system is split into two main parts: the Sender (the Juggling Balls) and the Receiver (the Raspberry Pi 5 Base Station). The ESP32 inside the ball handles the high-speed sensor sampling, while the Raspberry Pi acts as the master controller, receiving data via a serial bridge. Check the attached Fritzing diagrams for the exact wiring profiles.
Database
FOTO ERD DATABASE
To store the juggling sessions, impacts, scores, and hardware logistics, I set up a fully normalized relational MySQL database.
The schema consists of the following seven tables:
- tbl_gebruiker: Stores user profiles and registration data.
- tbl_sessie: Tracks individual juggling sessions initiated by users.
- tbl_apparaat: Manages the hardware components used in the setup.
- tbl_bal: Logs the specific juggling balls connected to the system.
- tbl_worp: Tracks data for individual throws and catches during a session.
- tbl_scores: Saves high scores and performance tracking metrics.
- tbl_historiek: Acts as a central logging table for continuous data streams like battery levels and raw timestamps.
Foreign keys connect these tables to ensure data integrity, linking every throw, score, and battery log back to the active session and user profile.
The Smart Bal Code (esp32)
The XIAO ESP32 C3 is the brain inside the ball. To ensure zero data loss, the firmware runs entirely without using delay(), relying on non-blocking millisecond timers instead.
- Impact Detection: It samples the BMI sensor 100 times per second (100Hz). By measuring sudden changes in G-force (jerk), it accurately calculates if an impact was a clean 'catch' (one sharp spike) or a 'drop' (multiple cascading bounces). This threshold can be tweaked in the code according to your setup.
- Power Saving: To conserve the 600mAh LiPo battery, the ESP32 enters deep sleep after a period of inactivity. The BMI sensor remains active in a low-power interrupt mode, sending an Active HIGH signal to wake up the ESP32 the exact millisecond the ball is picked up again.
The complete, non-blocking C++ firmware for the XIAO ESP32 C3 can be found here: https://github.com/howest-mct/2025-2026-projectone-mct-Dewulf-Elias
The Base Station (Raspberry Pi Code)
- The Raspberry Pi 5 acts as the receiver and database host, running a Python script inside a dedicated virtual environment (venv).
- Serial Communication: The Pi continuously listens to incoming serial data from an ESP32 bridge module, which catches the wireless ESP-NOW messages sent by the juggling balls.
- RFID & Debouncing: Users scan their MFRC522 RFID badge to initialize a personalized juggling session. To prevent accidental double scans, the Python code uses strict state-tracking variables and software debouncing.
The Python communication loop and backend scripts are available here: https://github.com/howest-mct/2025-2026-projectone-mct-Dewulf-Elias
Developing the Web Interface and Backend
To visualize the juggling data in real-time, a custom web interface and backend API were developed.
- The Backend: A Python web server handles the incoming data from the serial communication loop and acts as a REST API. It queries the MySQL database to fetch individual session histories, top scores, and device battery logistics.
- The Frontend: The user interface is built using HTML, CSS, and JavaScript. It communicates with the backend API to display real-time statistics. While juggling, the website dynamically updates the live charts to show the current stream of "CATCH" and "DROP" events.
- Socket Communication: WebSockets are used to push the live impact data directly to the browser with zero latency, ensuring the web dashboard updates the exact millisecond the ball hits the ground or your hand.
AFBEELDING FRONTENT 3 WEBPAGINAS
Enclosure & Assembly
All electronic components are soldered and securely inserted into the three 3D-printed PETG shells. To finish the build, the 3D-printed ball is surrounded by a soft, translucent PVC layer that helps protect the electronics from hard drops and acts as a beautiful light diffuser for the NeoPixels. Finally, the base station is assembled by placing the Raspberry Pi 5, the LCD screen, and the RFID reader inside a custom wooden box, giving you the final ecosystem shown in the main image.
AFBEELDING BASISSTATION