ExperimentMPU6050 · I²C
MPU6050 orientation
Six axes of motion, turned into an angle you can see.
The story, in 3 stages
- 01Sensor
- 02Angle
- 03Visualization
(01)The instrument
Angle out
R -24°
P 18°
roll = atan2(ay, az) · pitch = atan2(−ax, √(ay² + az²))
A simulation of how the part behaves — not a recording of mine. Bench photos go in the evidence below.
(02)Sensor → Angle → Visualization
- 01 · Sensor→
Gravity is the reference
An MPU6050 packs a 3-axis gyroscope and a 3-axis accelerometer onto one chip. Lying flat, the accelerometer reads about 1 g straight down — gravity is the one thing everything else is measured against.
- 02 · Angle→
Tilt is trigonometry
Tilt the board and gravity's share moves between the axes. Pitch and roll fall out of arctangents of those shares. Use the wrong axis — or the wrong quadrant — and you get confident nonsense like −135°.
- 03 · Visualization■
Seeing what it sees
Numbers scrolling past on a serial monitor don't tell you much. Plotted against time, or drawn as a board that tilts with the real one, they suddenly do.
(03)On my bench
What I actually did with it
- 01On the bench, and the heart of the motorcycle safety prototype
[ADD — how you visualised it, a photo, the code]
(04)Evidence
Related on the bench