Why does yaw angle goes away when I move controller?

Viewed 226

I have an MPU9250 on my PCB and I use an AHRS system with a Madgwick filter to get yaw angle. I took source code from here: https://github.com/sonphambk/MPU9250/tree/master/Src and changed there MadgwickAHRSupdate function as someone said here: Madgwick sensor fusion on LSM9DS0. Now yaw angle is quite accurate, but there is a problem. When I move my PCB, without rotating it, the yaw angle changes like that: enter image description here

Why does the yaw angle changes if I don't rotate my PCB? What I have to change in my code?

1 Answers

You have to keep in mind that AHRS is a mathematically super complex problem. A small error at the start of data processing may cause a huge deviation sometime later. If you know for sure, that provided code was used by others and they did not have drifts, then I would suggest checking the raw data stream of the sensor. If MPU9250 was bought from Chinese vendors or Ebay it is a good chance they are non-usable. Checking voltages, the output signal to noise ratio, sample rate consistencies is a must.

If you think that the hardware part works perfectly, try Kalman filters or filtering the input data. Also, ambient conditions might affect sensor reads - magnetic fields, heat, etc.

P.S. Moving PCB without rotation is not as innocent as you may guess. Human hands are constantly shaking and generating noise.

Related