Go Down

Topic: Accelerometer and Magnetometer calibration (Read 4 times) previous topic - next topic


I am trying to calibrate my accelerometer and magnetometer.  I am using FreeIMU's calibration tool and I can do everything, except I have no way to reliably and smoothly rotate my sensor through the range of motion required for calibration.  Does anybody have any tips for how physically manipulate my sensors in a smooth motion 360 degrees about the X, Y and Z axis?

I thinking about making a sort of gimbal jig, but before going through that effort I was wondering what other people have done.

Thank you in advance. 


I use a different method which doesn't require "smooth rotation",  so I don't know.

Is your sensor incorporated into a device ?

You could try building one of those spinning table centrepieces that chinese restaurants have.
You can get the circular bearing for about $4  and a round piece of plywood  or any round
thing you can find.


Jan 30, 2013, 06:56 pm Last Edit: Jan 30, 2013, 07:04 pm by jjspierx Reason: 1
Currently, my sensors are on a breadboard and connected to my Uno R3 using Sparkfuns Ardunio/Breadboard holder.

I think I am going to be build one, maybe using various sized PVC pipe or something like this.

What method did you use michinyon, is it something that I might be interested in?  I need something to calibrate the X, Y, and Z axis for both my magnetometer and accelerometer.  Even if your method only calibrates one or the other, I would still be interested in it.


Well it depends how you need to turn it.   Some need to be turned around only in one plane,
which you can do with some kind of turntable.

If you want to build some kind of 3-D gimbal thing,  go ahead.

I just wave mine around randomly in all directions,  collect thousands of samples on the SD card,
and them process them statistically in Matlab to get the calibration.  So far,  the calibration is
almost the same every time,   so I am currently assuming that the scaling errors are set by the
manufacturing defect   and not arising from the weather or other factors which continue to


I am wanting my sensors to give me a full 6 DOF, or I guess 9 DOF with the magnetometer, so I assume I need to properly calibrate all 3 axis of the acc and mag.  I have tried calibrating by rotating 360 degrees around each axis, and then translating in a circle in all 3 planes. 

I am using Fabio Varesano's (may his soul rest in peace) calibration tool which is in Python and uses an ellipsoid into sphere algorithm.


Maybe the algorithm used is more sensitive than your Matlab code with respect to needing smooth data in all planes and axes of rotation.

I think I will probably create a gimbal like I mentioned above, it will be fun simple project anyway, and if I can't calibrate my sensors with that, than I will probably look into other algorithms or maybe writing my own to calibration program for my sensors. 

Thanks for the help!


well the 6-dof and 9-dof are much abused teminology which I don't use.  Because they are not, really.

My approach is for the accelerometer and the magnetometer.   Not for the gyro.    In both those cases,
you are attempting to measure a vector which is a fixed, physical quantity.   in the first case, the gravity
vector and in the second case,  the earth's magnetic field vector.

I collect thousands of samples of that vector.   If you then represent all these vectors as pointing outwards
from the coordinate system origin,   you get a surface.   I then calculate the transform of that surface
which gives the least squares best fit to a sphere,  assuming a model with an offset and scaling parameter
for each axis,  which appears to be sufficient.   So I have 6 calibration parameters,  and I calculate the value
which gives the least sum squared deviation from the sphere.

This is probably the same fundamental approach as the other one you mentioned.  You are mapping something
which can be approximated as an off-centre ellipsoid,  to a sphere.

For the gyro,  I just capture the value when the device is stationary, and use that as the offset.   ation device that spins at a
fixed rate. Rate scaling
difference for the gyro would be very hard to measure,  you would need a calibrIn my experience,  this is best done every time you use the device.


Thanks for the description of your calibration method, interesting stuff indeed.  I purchased components to make my 3 gimbal calibration device already. I am using 1/2 CPVC with 90deg elbows.  Actually ended up being really cheap, about $14 for everything.  I think I am going to write my own calibration program, even if I can get my sensors calibrated with the FreeIMU calibration tool, just so I can gain a better understanding of these sensors.  And because, I find the FreeIMU calibration tool cumbersome to use.   


If you don't mind my asking what about your project would require you to use a gimbal rig to calibrate your accelerometer?


Nothing specifically about my project, I just have not been successful in calibrating my sensors when turning them by hand 360 degrees around X,Y,Z axis.  Every time I attempt to calibrate I get very different values.  My setup uses BlueTooth, so it should be fairly easy to set it in a gimbal rig and smoothly control the motion about each axis to collect better samples to use in the calibration algorithm.  I need the sensors to to determine rotation, and translation in all axes, so I would like them to be calibrated as accurately as possible.


Thanks for the response I'm using an acceleromter for the first time and trying to understand how to calibrate it also!  I wish I could be of more help but I'm still learning myself.  The gyro seems like a great idea though

I was also going to suggest if you have a bunch of old plastic container tops lying around you could try using those.. and save a bit more $$$ (Noxzema tops for instance, a small vicks vapor rub top, and something that could fit between them both) thats if you have the tools to cut them approriately


Feb 01, 2013, 01:00 pm Last Edit: Feb 01, 2013, 01:01 pm by jjspierx Reason: 1
Here is the design I came up for a yaw/pitch/roll 3 gimbal jig. I should be getting the rest of the hardware tonight and starting on it tomorrow.  Should cost less than $20.  If that helps me calibrate my sensor, then it will be money well worth it.  If not, well it will be a fun little project anyway. :-)


Here is the design I came up for a yaw/pitch/roll 3 gimbal jig. I should be getting the rest of the hardware tonight and starting on it tomorrow.  Should cost less than $20.  If that helps me calibrate my sensor, then it will be money well worth it.  If not, well it will be a fun little project anyway. :-)

Please post some pictures when you're done.  I might need to make a rig like that, to test the project I'm working on.

Holger Marten


I sure will. Cost me less than $20 in 1/2" CPVC and the necessary hardware.  I should have pics up tomorrow.  It's about 12" tall by design.  I designed the base, and was thinking of using plywood or 2x4"s, but ended up buying 3/4" CPVC with a 4-way for the middle part and 2x90 deg elbows for the arms.


Alright, here is the finished sensor calibration jig.  Ended up being about $25 for all the PVC and hardware.  The gimbals are 1/2" CPVC, the base is 3/4" CPVC, and the rest is various nylon locking nuts, bolts, and spacers.  The long piece through the middle of the sensor base is 1/4"-20 all-thread.  I bought a 12" piece and used a hacksaw to shorten it to about 6".  Now I just need to modify the FreeIMU calibration GUI tool and bit to accept inputs from my BlueTooth software serial port and I should be good to go. It stands just over 12" tall.

Go Up