Gravity Balance Light - Seeed Studio XIAO ESP32S3 - dumpling—li - CodeCraft Hub
Scene: Maker. Edge AI application on CodeCraft Hub for Maker use cases.
Devices / BOM: Seeed Studio XIAO ESP32S3, Grove Shield for Seeed Studio XIAO, Grove - 3 Axis Accelerator(LISDJTR), Grove - Universal 4 Pin Buckled 20cm Cable (5pcs), Grove - RGB LED Stick (20)
Maker application on CodeCraft Hub. This project is an interactive lighting installation based on the XIAO ESP32-S3 and the LIS3DHTR 3-axis accelerometer. By sensing the device’s tilt in space, it maps gravity components in real time onto a WS2813 RGB LED strip, creating a fluid-like lighting effect.
Documentation
Key Features: Fluid visual effect · Instant response · Flexible adaptability
Deploy steps
- Hardware Connection
Insert the XIAO ESP32-S3 into the Grove Shield for Seeed Studio XIAO. Connect the LIS3DJTR accelerometer to the I2C interface (D4, D5), and the WS2813 LED strip to D9 and D10.
Insert the XIAO ESP32-S3 into the Grove Shield (align the USB port direction and press firmly into place)
LED strip VCC (5V) → XIAO 5V pin
LED strip GND → XIAO GND pin
LED strip DIN (data) → XIAO D9 (GPIO8); if there is a BIN (backup line), connect it together with DIN to D9
Accelerometer VCC (5V) → XIAO 5V pin
Accelerometer GND → XIAO GND pin
Accelerometer SDA → XIAO D4
Accelerometer SCL → XIAO D5
- Firmware Flashing
Use the firmware flashing tool below to upload the firmware to the XIAO ESP32-S3.
Click the “Flash Firmware” button and select the serial port to connect the device
Flash address: 0x0 (default)
If the device is not recognized, double-press the Reset button on the XIAO to enter download mode and try again
Flash firmware to your device (in-app tool on CodeCraft Hub).
- Power On and Usage
After flashing, press the Reset button on the XIAO ESP32-S3 and observe the response.
Self-test on power-up: 3 LEDs light up blue
Rotate the accelerometer along the Y-axis: LEDs move along the strip accordingly
If LEDs do not light up, press RESET and check the wiring of the accelerometer and LED strip
- Future Extensions
Beyond the gravity-based lighting effect, the project can be extended to:
Umbrella handle: Create a flowing tech-style light effect on rainy nights
Roly-poly toy: Add a “flowing energy core” visual when the toy swings
Posture correction device: Integrate into desk edges to provide visual alerts when tilt or instability is detected
Smart musical accessory: Mount on instrument necks or drumsticks to generate synchronized lighting effects based on motion