MiniIMU-9 V2 not accurate


I am trying to get Euler Angles from MiniIMU-9 V2 through Arduino Uno.

I used the libraries written for L3G ( and LSM303 ( and the example code given at Pololu Website (

However I couldnt get accurate readings from the sensor. I tried to change m.min and m.max values with the help of Calibration code given at L3G website. Firstly I always receive different values for every iteration they doesnt differ a lot but still there are considarable differences. I didnt see anything about calibration process on the website. So can you tell me how shall I move the sensor during calibration process. Shall I move fast or slow and the movement must have a pattern or just be random. Additionally the magnetometer is not tilt compensated as well. When I give a roll or pitch movement to the sensor the heading changes a lot.

Secondly my roll and pitch angle reading are not accurate. When I make a roll or pitch movement, the sensor readings change slowly and the sensor doesnt show the right values. Like if I make a roll movement of 50 degrees it only shows a 30 degrees of pitch and additionally it shows an additional roll movement as well, although there isn’t.

Thanks for your help already.


The MinIMU-9 should be moved through every possible orientation. The calculations for the Euler Angles will probably improve after calibrating. Before you move it, you should keep it level for a few seconds after starting the program (or turning on the device). Explanations on how to use the example programs can be found in the README files on the GitHub site.

- Jeremy

I fixed the problem. I didnt know that we have to start the sensor with component side facing down. Now it works as intended.

Thanks for the quick replies.