Live ESP-NOW & Delta Math Simulator
Shake or swipe your mouse/touch quickly inside the Kinetic Charge Pad to build up energy. Watch the real-time ESP-NOW signal transmit the charge state (0.0 to 1.0) to the follower, which interpolates smoothly using delta math.
Handle (Sender)
Follower (Receiver)
Project Overview
The Wireless Kinetic Light Baton decomposes motion-reactive graphics into a distributed hardware topology. Instead of running sensors and high-density LED strips off a single micro-controller, this project splits the responsibility: one device senses and generates haptic feedback inside the handle, while a separate follower handles the high-power visual rendering.
Why ESP-NOW?
ESP-NOW is a connectionless protocol developed by Espressif that bypasses traditional Wi-Fi handshakes and overhead. This allows the handle to broadcast 4-byte floating-point energy updates every 30 milliseconds with a transmission latency under 1.5 milliseconds, making it feel completely instantaneous to the human eye.
The Delta Math Easing
When the handle broadcasts the target charge (e.g., jumping from 0.0 to 0.7 immediately during a fast swing), displaying it directly on the LEDs causes visual stepping. To make the animation fluid, the follower implements a dt-based exponential easing function:
currentCharge += (targetCharge - currentCharge) * easingFactor * dt;
This guarantees smooth visual convergence towards the target charge regardless of packet drop or
timing jitter. We use a snap window of < 0.001 to prevent floating-point
micro-oscillations once the target is reached.
Parametric CAD Configurator
This project features a fully parametric 3D CAD configurator designed to generate custom haptic and visual baton assemblies. Built with JavaScript/TypeScript, it harnesses the high-performance WASM-compiled Manifold geometry kernel for instant CSG (Constructive Solid Geometry) boolean operations.
Configurable Part Parameters
Using the interactive CAD environment, you can dynamically configure and resize several mechanical features:
- Central Rod: Tube Outer Diameter and internal wall thickness.
- Housing / Sled: Sized length/wall thickness to accommodate battery cells, ESP32-C3, haptic motor driver, switch, and MPU6050/MPU6500 IMU.
- Ridges & Rings: Decorative outer profiles, flange heights, and end-cap slip tolerances.
- Fasteners: M3 clearance hole diameters and threaded depth tolerances.
- Handle Profile: Length and lanyard tether hole placement.
The CAD suite supports assembly exploding, Blueprint wireframe views, and instant STL downloads for direct slicer preparation.
Hardware Pinout Configuration
Configured on ESP32-C3-DevKitM-1 Development Boards.
1. Handle Device (Sender)
| Function | GPIO | MPU6050 | MPU6500 | Description |
|---|---|---|---|---|
| I2C SDA | 2 |
SDA |
SDA/SDI |
I2C data line (same wiring for both sensors) |
| I2C SCL | 3 |
SCL |
SCL/SCLK |
I2C clock line (same wiring for both sensors) |
| Soft GND | 4 |
GND |
GND |
Asserted LOW in setup as soft-ground for sensor |
| INT Pin | 5 |
INT |
INT |
Motion interrupt line; wakes device from deep sleep |
| FastLED | 6 |
n/a |
n/a |
Signal line for local WS2812B strip |
| Motor PWM | 7 |
n/a |
n/a |
PWM driver control for haptic vibration motor |
| Sensor Power | 3.3V |
VCC |
VDD/VCC |
Use 3.3V logic/power domain for both IMUs |
| Extra Pins | NC |
AD0, XDA, XCL, FSYNC |
NCS, SDO, FSYNC |
Leave unconnected in this project (I2C mode only) |
2. Follower Device (Receiver)
| Function | GPIO | Description |
|---|---|---|
| FastLED | 6 |
Data output to WS2812B strip (74 LEDs) |
| Power | 5V |
External power source for high current draw |
| GND | GND |
Common ground return line |
ESP32 Firmware Architecture
The hardware system is partitioned into two distinct C++ firmware applications running on separate ESP32-C3 modules to minimize wiring complexity and ensure latency-free performance.
1. Reactive Handle (Sender)
The handle read loop polls the MPU6050/MPU6500 IMU over I2C to calculate physical swing acceleration and rotation. It applies a soft-ground trick to simplify electrical routing by pulling Pin 4 LOW to act as ground. The combined motion vector drives a haptic driver chip on Pin 7, switching vibration states dynamically:
- Low Energy (< 0.3): Slow periodic Heartbeat vibration pulse.
- Medium Energy (< 0.7): Rapid rhythmic Gallop haptic pattern.
- High Energy (>= 0.7): Constant high-intensity Shimmer/Buzz.
Simultaneously, the energy level is broadcasted via raw ESP-NOW packets to the follower's MAC address at 30ms intervals.
2. Reactive Follower (Receiver)
The receiver listens for the broadcasted energy value in a non-blocking ESP-NOW interrupt callback. As the baton is swung, the follower lights up a WS2812B pixel array on Pin 6. The motion-reactive color mapping shifting and length scaling is computed dynamically. Easing-interpolated delta math eliminates packet jitter, delivering organic, smooth visual sweeps.