TaserDerby is a race betting application that integrates a React web frontend with an ESP32 microcontroller and a handmade taser.
Bet on a racer and if you lose, you get tased with a safe & short electric shock.
Perfect for parties!
|
- Microscopic Race Simulation: Real-time, physics-based movement visualized on an HTML Canvas.
- Difficulty Scaling: Adjust the required finishing rank (Top 1 to Top 8).
- Direct Hardware Integration: Uses a
fetchPOST request to trigger a taser upon losing. - Minimalist UI: Betting and results are handled via fullscreen modals for an immersive "microscope" aesthetic.
This repository holds the entire project, organized into the following directories:
| Folder | Content | Description |
|---|---|---|
Website/ |
React/Vite Frontend Code | Contains the full web application source and dependencies. |
ESP32_Code/ |
Embedded C++ Source | Holds the Arduino sketch (taserderby_esp32_code.ino) for the microcontroller. |
CAD/ |
Hardware Design Files | Placeholder for any 3D models or enclosure design files. |
|
|
|
Clone this repository:
git clone https://github.com/ANonABento/TaserDerby.git
This part sets up the microcontroller to listen for the "defeat" signal.
- Open the
taserderby_esp32_code.inofile in the Arduino IDE. - Update Wi-Fi Credentials: Change the following lines to match your local Wi-Fi network:
const char* ssid = "YOUR_WIFI_SSID"; const char* password = "YOUR_WIFI_PASSWORD";
- Upload the sketch to your ESP32-C3.
- Open the Serial Monitor (115200 baud) to find and write down the ESP32's local IP address.
This part configures the frontend to target the hardware.
- Navigate to the web application source:
website/DigitalDerbyApp.jsx. - CRITICAL STEP: Update the IP address placeholder at the top of the file with the IP address printed by the ESP32 in Part A.
// IMPORTANT: Replace with the actual IP address of your ESP32 server const ESP32_IP_ADDRESS = 'YOUR_ESP32_IP'; // e.g., '192.168.1.100' const API_LOSE_ENDPOINT = `http://${ESP32_IP_ADDRESS}/lose`;
-
Clone and Navigate: Clone the submodule, then enter the web directory.
git clone --recurse-submodules cd TaserDerby/website -
Install Dependencies:
npm install
-
Start the Development Server:
npm run dev
The web application will now be running (usually at
http://localhost:5173) and ready to communicate with your ESP32.
|
- Start the Race: The app displays the Betting Modal.
- Set Difficulty: Adjust the slider (Top 1 to Top 8).
- Place Your Bet: Click a colored racer button to start the simulation.
- Result:
- SAFE: If your racer finishes within the Top X.
- DEFEAT: If your racer finishes outside the Top X, the
fetchrequest is sent, and the taser is triggered by the relay.
Note: If the taser is not triggering, check the IP address in website/DigitalDerbyApp.jsx and ensure both your computer and the ESP32 are on the same local Wi-Fi network.






