I’m trying to use the MinIMU-9 v3 in a autonomous robot car project.
The car will have to drive in a straight line(using a PID) and turn left or right at certain angles.
So the only thing I’m interested in is the yaw/heading in degrees.
This is how I test:
- calibrate the magnetometer using the sketch provided in the LSM303 library
- IMU connected to a breadboard and breadboard connected to the Arduino Uno R3
- Using the MinIMU-9 AHRS sketch
- Moving the breadboard on my desk around my square mouse-pad and keeping it parallel (so the heading does not physically change)
- Observing the serial output
The roll and pith remain close to 0 - this is expected because I’m testing on a flat surface - all good. There is no drift if I keep the breadboard still.
But for the value I’m interested in, the yaw, I’m getting a huge drift while keeping the breadboard parralel and moving left/right/front/back.
If I move the breadboard back to the starting point, I get the same value as in the first place for that specific place on the desk.
I also tried this on the floor, moving the breadboard on ~50 cm distances but keeping it parallel/same yaw direction and I get huge drifts in the yaw while the roll and pitch remain close to 0.
There were no devices/ magnetic interfering close to my breadboard.
I’m also getting the above drift behavior using the “heading” sketch from the LSM303 library so I guess that my issue is related to the magnetometer
Any ideas on how to solve this will be greatly appreciated.
In the meantime, I tested with my phone the same scenario and found out that there is some strage magnetic disturbance in the building and it’s messing the compass.
I found a very cool library that works with MinIMU9 here.
Here you can read the issue posted on the library repo and some tests.
My current issue is a bit different now: I’m not able to get accurate readings without using the compass. The thing is that I only need heading data relative to the starting heading data so I’m not interested in using the compass (anyway it’s ruining the output).
Any idea how to use the accelerometer and gyro for accurate heading data?