Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

AltIMU-10 v5 on Arduino: Absolute values for roll and pitch?

Hi everyone,

apologies if this question has been discussed before - I tried my best searching the forum but could not find anything.

I’m trying to build a pitch/roll indicator for my 4WD vehicle using an Arduino Mega, the AltIMU-10 v5, and the MinIMU-9 + Arduino AHRS code provided by Pololu. The sensors are reasonably well calibrated and I’m getting readouts that seem correct. My problem is the following:

With the provided code, the board needs to sit flat for a few seconds after powering up to get baseline readings. Obviously this is not possible once I put everything in the car. I would like to be able to zero the unit while being parked on a flat surface, write these values to the Arduino EEPROM, and then use them as an offset reference everytime I start the car.

Is this generally possible? If I understand it correctly, the gyro alone cannot do this, but that I need to use it in conjunction with the accelerometer. How can I implement this? Can this be easily done by modifying the MinIMU code or would I have to start from scratch?

FYI, I’m not terribly eperienced in these things…

Cheers,

Jan

The sensor calibration parameters can be written to EEPROM and recovered upon startup. In general, though, the sensor offsets are strongly temperature dependent, so if your vehicle sits in the sun, they will be highly inaccurate.

If you are mainly interested in static tilt and roll angles, then just use the accelerometer, as the factory calibration is usually fairly accurate and the offsets are less sensitive to temperature. Mount the sensor on a platform that allows zeroing these values when the vehicle is level.

Tilt and roll is very simple to calculate, as shown in this tutorial: How_to_Use_a_Three-Axis_Accelerometer_for_Tilt_Sensing-DFRobot

For a 3D AHRS in a vehicle, the magnetometer MUST be calibrated in place, to remove hard iron distortions.

Thanks for your reply Jim! I wasn’t aware of the temperature sensitivity, so thanks for that bit of advice! I’ll look into the article you linked and will see how it goes with the accelerometer!

Cheers,
Jan