You can watch a full video version with more details here.
In my latest hardware test, I’ve been putting the LSM6DS3 accelerometer and gyroscope through their paces on my custom board. If you spotted the small LED fix in the corner, that’s from my previous ninja repair—go check that video out if you missed it. The blue LED now proudly indicates our BLE connection to the web interface I built.
The accelerometer mode works well for detecting pitch and roll, but not yaw, due to its reliance on gravity. Rotating around the Z-axis yields no change, and certain orientations can confuse the readings.
Switching to gyroscope mode gives smooth, real-time rotational data. We take the angular velocities reported by the device and integrate them over time to get the absolute rotation.
The downside? Over time, small errors accumulate, so the orientation can drift.
That’s where fusion mode comes in—combining accelerometer and gyroscope data to deliver more stable results. It’s not perfect, but drift is greatly reduced, and the board consistently returns to a flat reading after movement.
I’m using this library in my code. It seems to work pretty well.
Interestingly, the sensor readings are sensitive to temperature changes, which can introduce minor drift. Adding a magnetometer could improve accuracy even further, so that’s on my future to-do list.
3D Model Fun
The web app lets you load and manipulate any 3D model—yes, including a teapot!
To load your own PCB model, export a .glb
file from KiCad, upload it, and watch your PCB spin in real time.
Open Source Firmware
All the code is on GitHub and easy to adapt—just set your I²C pins and sensor address, and you’re good to go.
// Hardware constants
#define I2C_SDA 7
#define I2C_SCL 15
// LSM6DS3 I2C address - choose between 0x6A and 0x6B - most boards use 0x6A
#define LSM6DS3_I2C_ADDR 0x6B
It works over BLE or Web Serial, streaming JSON data with accelerometer, gyro, temperature, and fused values.
Check it out, try it with your own boards, and feel free to contribute improvements.