I am trying to get heading information of a forklift. I've designed a small PCB for this purpose. This PCB has a 3 axis magnetometer and a 6 axis gyroscope-accelerometer (Z- axis looking towards the ground). I've used Madgwick's sensor fusion algorithm to combine 9 axis' informations. There are 3 choices for the sensor fusion implementation;

  • Choice 1: It uses all 9 axis information and returns roll, pitch, yaw values (Affected by magnetic interference)
  • Choice 2: It uses only gyroscope and accelerometer readings and returns relative roll, pitch, yaw values (Does not get affected by magnetic interference however value drifts over time)
  • Choice 3: It uses only magnetometer and accelerometer readings returns tilt compansated heading (Affected by magnetic interference)

Which one would be more suitable in metal heavy environment? Are there any other methods that you can suggest?

Also due to dynamic magnetic interference of the forklift's moving parts, I've mounted the device at the rear top side of the forklift. Should I do hard and soft iron calibrations when the device is mounted on the forklift or should I do calibrations before mounting? If I try to calibrate when the device is mounted, I won't be able to rotate device around the Z axis.


1 Answer 1


Heading information from an accelerometer can be inherently noisy due to integration errors. Magnetometers and Gyroscopes can provide additional information to help reduce some of these errors, but if you are operating in the presence of external magnetic fields, you won't be able to reliably trust them either. Since you have designed / have access to the pcb, one possible solution would be to use some simple magnetic shields around your IMU.

Another solution would be to use some other sensors, like cameras or LiDAR. This might be more involved, but may provide you with a more accurate heading.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.