Flip-and-Shake Mood Light - Seeed Studio XIAO ESP32S3 - dumpling—li - CodeCraft Hub
Scene: Smart Home. Edge AI application on CodeCraft Hub for Smart Home use cases.
Devices / BOM: Seeed Studio XIAO ESP32S3, Grove Shield for Seeed Studio XIAO, Grove - 3 Axis Accelerator(LISDJTR), Grove - RGB LED Stick (20), Grove - Universal 4 Pin Buckled 20cm Cable (5pcs)
Smart Home application on CodeCraft Hub. This project precisely detects orientation and motion to switch light between a "Warm-Yellow Breath" and a "Red Flash." In restaurants, customers can use these intuitive light signals to send simple service requests just by flipping or shaking the device.
Documentation
Core Features:Motion Awareness · Circadian Breathing · Persistent Memory Timer
Deploy steps
- Hardware Connection
Plug the XIAO ESP32-S3 into the Grove Shield. The accelerometer connects via the I2C interface, and the LED strip connects to the D9 interface.
Main Controller : Seat the XIAO ESP32-S3 into the base, ensuring the USB port aligns with the shield orientation and pins are firmly pressed.
LIS3DHTR 3-Axis Accelerometer Connection(Input)
VCC → XIAO 5V Pin
GND → XIAO GND Pin
SDA → XIAO D4 Pin
SCL → XIAO D5 Pin
LED Strip Connection(Output)
VCC (5V) → XIAO 5V Pin
GND → XIAO GND Pin
DIN (Data) → XIAO D9 Pin (GPIO8)
- Firmware Flashing
Use the following flashing tool to upload the firmware to the XIAO ESP32-S3:
Click the [Flash Firmware] button below, select the corresponding serial port, and connect your device.
The flashing address is set to 0x0 (default configuration).
Note : If the device is not recognized, double-click the Reset button on the XIAO to enter Download Mode and try again.
- Operation and Usage
After successful flashing, press the Reset button on the XIAO-ESP32-S3 to enter "Monitoring Mode."
Upright Position (Warm Light Mode) : When the bottle is upright, the LED strip displays a Warm Yellow Breathing light. The slow breathing rhythm creates a peaceful atmosphere.
Inverted Position (Idle Alert) : When flipped upside down, the light switches to a Red Breathing effect.
Shake Trigger (Emergency Response) : Shaking the bottle while inverted enters the "2-Minute Flash Mode." The LEDs will flash rapidly in red for 120 seconds, even after shaking stops.
Instant Override : Flipping the bottle back to the upright position at any time will immediately switch the light back to the Warm Yellow Breathing effect.
Flash firmware to your device (in-app tool on CodeCraft Hub).
- Future Extensions
In addition to basic posture feedback, the following functions can be further expanded:
Sleep Timer : Auto-extinguish after 30 minutes of being upright, serving as a bedside sleep lamp.
Stress Relief Tool : Change flash frequency or colors based on shaking intensity as a visual feedback for emotional regulation.
Logistics Impact Monitor : Place inside fragile packaging; a persistent red flash can mark packages that were violently shaken or inverted during transit.
- 3D structure file
model_Flip-and-ShakeMoodLight.3mf