MPU-6050 Bring-up on STM32
Connecting an MPU-6050 IMU to an STM32 microcontroller and verifying I2C communication.
Connecting an MPU-6050 IMU to an STM32 microcontroller and verifying I2C communication.
How to calibrate an MPU6050 accelerometer using gravity as the only reference — six static positions, no jig or rotary stage. Covers measuring bias and scale, validating the result, and which constants belong in firmware.
How to calibrate an MPU6050 gyroscope with nothing but gravity and a pair of hands — measuring the zero point at startup, extracting the scale factor by tilting between two resting positions, and comparing what each compensation actually buys.
How to measure an MPU6050's real sampling interval from inside the MCU, using the Cortex-M DWT cycle counter on the data-ready interrupt. Covers the clock source that made the sensor 1.2 % fast, how measurement resolution hides jitter, and why an integral needs a measured dt.
How much of a stationary MPU6050's output is noise, what the internal DLPF removes, and what the same job costs in software. Measured with FFT, a spectrogram and standard deviation, with the response delay each cutoff frequency buys.
Turning three calibrated accelerometer channels into roll and pitch with two atan2 calls. The geometry behind the equations, the plus or minus 180 degree wrap, why pitch stops at 90 degrees, how stable the result is, and what linear acceleration does to it.
As pitch approaches 90 degrees the accelerometer roll estimate becomes unstable while the sensor barely moves. Why the information disappears, what a regularization coefficient buys, what it costs, and the measured tradeoff across five values of the coefficient.
Integrating MPU6050 gyro rates into roll, pitch and yaw. It passes straight through the orientation where the accelerometer breaks down, it is the only source of relative yaw, and over five stationary minutes it wandered 1.1, 0.8 and 0.37 degrees. Then the temperature moved.
Blending the MPU6050 accelerometer and gyroscope with one line of arithmetic. Six time constants recorded side by side. It cut attitude noise by six to seven times and removed a 23 degree integration error. It only damps a linear-acceleration disturbance rather than rejecting it, and it does not repair the collapse of roll near 90 degrees of pitch.