Tilt & Motion Dashboard
Stream the onboard accelerometer to the browser and watch a live dashboard react as you tilt the board.
This project reverses the data direction: instead of the browser commanding the board, the board streams sensor data to the browser. The Nano 33 BLE has an LSM9DS1 inertial measurement unit (IMU) on board, so no wiring is needed.
Ten times per second, the sketch reads the accelerometer and writes 12 bytes into the acceleration characteristic — three float32 numbers (x, y, z) in units of g. Because the app subscribed to notifications when it connected, every write is pushed to the browser automatically; the app never has to poll.
Gravity is the trick that makes the dashboard work: when the board lies flat, gravity pulls almost entirely along the z axis (≈1 g). Tilt the board and that 1 g redistributes across x and y. The bars show each axis and the bubble level combines x and y — just like a spirit level.
Goals
- Stream accelerometer samples from board to browser
- Read notify-driven sensor data without polling
- Interpret tilt with axis bars and a bubble level
Materials
- Arduino Nano 33 BLE Sense (onboard LSM9DS1)
- USB cable
- Arduino IDE with ArduinoBLE and Arduino_LSM9DS1