FreeIMU Magnetometer and Accelerometer Calibration GUI: alpha version out

Last updated on Fri, 2012-11-23 12:07. Originally submitted by fabio on 2012-10-30 16:02.

I'm happy to finally publish a first working version of the FreeIMU Magnetometer and Accelerometer Calibration GUI. Currently, it should allow you to visually calibrate your accelerometer and magnetometer after you connected your IMU to a microcontroller running the FreeIMU_serial example in the FreeIMU library. NOTE: You have to use the FreeIMU_library available on the repository, not the one on the project webpage.

The program is written in Python, using PyQT4 as GUI library, using PySerial to communicate with Arduino, pyqtgraph for the graphs generation and PyOpenGL as backend for graph generation. Numpy and Scipi are instead used in the calibration algorithm.

Right now only 2D graphs and saving to calibration.h features work. 3D graphs and save to microcontroller EEPROM are being developed right now. Still, what's already available should be enough for starting properly calibrating your IMUs.

The software has been designed with flexibility in mind.. Ideally in the future it will evolve and let you test different calibration algorithms and various serial protocols will be implemented to use it with your favorite firmwares (eg: MultiWii, FreeIMU, etc..)

Please consider this release as very alpha software. Bugged and bad, but still nice to have a look. Any suggestion and comments welcome. I'm currently looking for a MacOS tester to try help me package it for Mac as well.

  • Windows version:
  • Linux users are encouraged to test the software directly from the Python sources available on the FreeIMU repository.
  • Mac not supported at the moment. I don't have a Mac so I can't test it. Help needed.

Here are a couple of pictures of the GUI..



Posted in:

problems in calibration mag data

Submitted by khyale (not verified) on Mon, 2015-07-20 15:29.


I am using your program '' from FreeIMU to calibrate the measurements done with a HMC5883L magnetometer. I create a file 'magn.txt' and put the sensor's raw data in tree columns (mag_x. mag_y, mag_z). The output from this program give me 6 parameters (x,y,z offsets and x,y,z scales vales). So I corrected the values usign the formula: corrected_val = (val-offset)/scale, for each axis' data. I noted after processing the offset was corrected but not the shape (it still continues a ellips(2d) or ellipsiod(3d)). it seems the algoritm only normalize the curve and adjust offset. And the magnitude information of magnetic field was lost. Anybody can help me?

What is the communication protocol

Submitted by CurrentZ (not verified) on Tue, 2015-05-19 21:11.

I tried the calibration tools that you provide and I did 3 dimension rotation but what I have on the graphs are not spherical stuffs but random lines. Could you help me with the process of doing the calibration?

You may want to test if the

Submitted by Andres (not verified) on Thu, 2015-05-21 18:24.

You may want to test if the communication between the device and the calibration utility is working properly. I would recommend to run the "free running" mode (communication starts and the device begins to send all the sensor readings until interrupted) and check that at least meaningful data is being transferred (you may use a serial terminal). Unfortunately I do not have the device near nor the software downloaded to test it again, but I remember having to tweak the free running mode a little bit (just a little bit) to get the output the calibration software needed. Of course, this may not be the (only) issue, but it is a starting point!

Good luck!

Free IMU GUI for windows hang upon connecting to com port

Submitted by Leo Chuah (not verified) on Sat, 2014-09-20 14:17.

as the title says, the program hangs upon connecting to the correct com port and it says python.exe isnt working. It also says at the bottom of the program that the connection to the arduino was successful and requested me to press the reset button. Following that instruction however had no effect. Do advise.

Link between calibration offset and sensor offset

Submitted by Florian_Bo (not verified) on Tue, 2014-09-09 17:48.

Hi anyone.
Thanks for the great library and tools you provided for the imu.
I am actually trying to calibrate a MPU6050 with an arduino and your calibration GUI.
Everything works fine and I manage to get the offset and scale values.
What I would like to do now, is to update the sensors' internal offset values (using the setXAccelOffset (int16_t offset) from the MPU6050 library).
If I get the original sensor offset, add the calibration offset and upload it to the sensor I get a less accurate sensor (when I try to calibrate it again).
Does anyone has any idea on what could be the relation between the calibration GUI offsets and the sensor internal offset?
Also, should I turn these sensor internal offset to zero before I calibrate it?

How do I start the GUI

Submitted by Anonymous (not verified) on Fri, 2014-08-15 12:30.

I have installed Python but I'm not able to start the GUI on what file do I have to click? When I start the nothings happens.

you have to run the .bat file

Submitted by Anonymous (not verified) on Thu, 2014-11-13 21:38.

you have to run the .bat file from the command prompt, and that should start up the gui

Help calibrating Adafruit 9 DOF sensor

Submitted by Ashfaque (not verified) on Sat, 2014-06-28 03:08.

Hi I have the following adafruit 9 DOF sensor.
it uses an LSM303DLHC - a 3-axis accelerometer (up to +/-16g) and a 3-axis magnetometer (up to +/-8.1 gauss).

Can you please tell me how to use your program to calibrate this sensor using the adafruit library?


I have the same problem... I

Submitted by Anonymous (not verified) on Thu, 2014-07-03 00:27.

I have the same problem...

I am using the adafruit-10-dof-imu-breakout-lsm303-l3gd20-bmp180, they recomend calibrating using this software but its clear they havent done it.

It wont work! I can't get the accel readings.... Has anyone been able to make it work with the adafruit sensor?????

The calibrition

Submitted by Liam (not verified) on Sun, 2014-06-08 17:25.

hi,buddy, i have got the compile problem solved. then i have got the calibraiton data as follows:
const int acc_off_x = 192;
const int acc_off_y = 174;
const int acc_off_z = 457;
const float acc_scale_x = 16522.9867621;
const float acc_scale_y = 16743.3485921;
const float acc_scale_z = 6835.60540726;
i wonder is that right? and i can't paste a picture here. if you have time i can send you the picture to your email.
And i don't konw how to use the scale_x/y/z data. becaue the mpu6050 has only the register of int8_t type. obviously the number is too large?

looking forward your reply!

Thanks very much.


Submitted by Liam (not verified) on Sat, 2014-06-07 17:46.

hi, i am doing the calibration work on the mpu6050, it really a tough work. So i found you have done a excellent job about it. i wonder how can i do it with the 6dof 6050. btw: the freeimu_serial cant be compiled successfully on my computer.

Hi Liam, you may want to add

Submitted by Andres (not verified) on Sat, 2014-06-07 20:49.

Hi Liam,
you may want to add some specific and detailed error/issue description in order to receive more precise suggestions. You should also provide information on compiler, OS and versions you are using.

Not sure about what kind of problems are you having right now... if you are not able to run the serial communication, you won't be able to calibrate the sensors. Have you already achieved sensor data readings? Do they make sense (raw values around the specified in the datasheet)?


Submitted by Liam (not verified) on Sun, 2014-06-08 17:28.

Thank u very much, and i got the lib file modified then the code compiled succeefully. my email is xllau [at] 126 [dot] com. and i have come to a new problem.
as described above. call me liam. and i am very gratitude about your pationce.

dont work under win7

Submitted by Liam (not verified) on Tue, 2014-05-27 08:21.

hi buddy, i got the files on my computer , but when i run the "freeimu.bat", the command window goes down. i don't know the cause. Or is there something wrong with my computer or my procedure? thank you very much.

Have you tried to run it

Submitted by Andres (not verified) on Wed, 2014-05-28 16:04.

Have you tried to run it directly from the command line? It may show what kind of error you have. That would be, open a cmd window inside your "FreeIMU_GUI-0.2-win32" folder (or the corresponding version) and run freeimu.bat there.


i have got my graphic driver

Submitted by Liam (not verified) on Sun, 2014-06-08 17:30.

i have got my graphic driver upgraded. then the problem has been solved. that is so troublesome. thank you very much.

dont work under win7

Submitted by Liam (not verified) on Tue, 2014-05-27 08:21.

hi buddy, i got the files on my computer , but when i run the "freeimu.bat", the command window goes down. i don't know the cause. Or is there something wrong with my computer or my procedure? thank you very much.

Running calibration in Ubuntu 13.10

Submitted by Andres (not verified) on Tue, 2014-01-07 03:08.

Hi folks,

Just wanted to share my experience, after having been struggling with the calibration software in order to make it run under Ubuntu 13.10, and installing the needed packages (following dependency suggestions), the less obvious change was a downgrade for PyOpenGL, from version 3.1.0 to version 3.0.2, as indicated here:

Just in case someone is stuck with the same issue.


What if i need to work with 2 MPU-6050 and i have one Arduino?

Submitted by An ony mouse (not verified) on Tue, 2013-12-10 21:39.

Hi. I have 2 MPU-6050 modules and i want to work with them but i only have 1 Arduino uno r3. can anybody help me in the solution of my question?

hello friend... u can connect

Submitted by Ravi (not verified) on Fri, 2013-12-27 04:40.

hello friend...

u can connect two mpu6050 on one i2c bus... just put ado pin high in one and low in another... to change address of mpu6050 one 0x68 and one 0x69.. pass address as argument when initlize mpu6050 object ...

Hi, Congratulation for the

Submitted by nejc (not verified) on Wed, 2013-04-10 12:03.

Congratulation for the effort included in development of FreeImu.

I have a question.
Where is the calibration algorithm derived from? I would like to implement a calibration algorithm in Matlab. But I would need a original algorithm.

If I understand correctly, the result of algoritm is the file "calibration.h", which is then used in functions of the file FreeIMU.cpp?

thank you


Calibration data

Submitted by Bo (not verified) on Sat, 2012-11-17 18:40.

Dear All

Thank you very much for the design and such a vibrant community. I recently have come into the possession of a second hand FreeIMU v43. Others have played with it before, so I am not entirely sure that it functions. Naturally, without calibration I get a lot of drift. But I recently tried the calibration program here. Things look okay from the yaw pitch roll program,only a little bit of yaw drift.

But when I look at calibration.h, there are some big numbers. Is that okay? Do the numbers below look okay?



const int acc_off_x = 1612;
const int acc_off_y = -430;
const int acc_off_z = -1808;
const float acc_scale_x = 12697.183876;
const float acc_scale_y = 16538.343853;
const float acc_scale_z = 17532.517665;

const int magn_off_x = 143;
const int magn_off_y = 56;
const int magn_off_z = -86;
const float magn_scale_x = 455.298155;
const float magn_scale_y = 431.236634;
const float magn_scale_z = 393.430345;

Yes, they look absolutely

Submitted by fabio on Wed, 2012-11-21 10:25.

Yes, they look absolutely fine.

Failed to run the firmware

Submitted by Ivan (not verified) on Tue, 2012-11-13 18:15.

When i attempt to run the firmware with the calibration.h file generated from FreeIMU_GUI (or simple the cailbration.h file from calibration_old folder) i'm get the Adruino IDE error 'class FreeIMU' has no member named 'calLoad'. Please help and show me where is the problem...

That was a bug. Thanks for

Submitted by fabio on Tue, 2012-11-13 19:01.

That was a bug. Thanks for discovering it. Please see FreeIMU_serial program on revision 30 and above for a fix.

Still not working

Submitted by Ivan (not verified) on Wed, 2012-11-14 08:16.

The calibrated values acc_off, acc_scale, magn_off, magn_scale are not override the default values. The 'C' command returns the next results: acc and magn_off (xyz) = 0; acc and magn_scale (xyz) = 1 (defined in FreeIMU.cpp // initialize scale factors to neutral values)

Ops. Should work now. See

Submitted by fabio on Wed, 2012-11-14 12:35.

Ops. Should work now. See changes in FreeIMU.cpp in commit 31.
Sorry for the trouble.


Submitted by Ivan (not verified) on Wed, 2012-11-14 15:14.

Great, now its work good.
I calibrated my IMU sensor (Sparkfun SEN-10724). Now the drift is much smaller but still present. Is suspected to blame the effect of temperature on the sensor calibration. This is unfortunate, because my job requires a fairly stable values​​. Perhaps, without complex adaptive filtering algorithms, such as Kalman filtering, to achieve stable results possible. Or not? In any case, thank you for an amazing job! By the way, the German colleagues have published a firmware for sensor SEN-10724 with calibration via GUI. The results are good, it should be noted:

Another calibration video

Submitted by Ivan (not verified) on Sat, 2012-11-17 10:31.

Here is my video where I caliber my sensor (Sparkfun-10724)
Drift is still present, but much less than without calibration.

Constant temperature oven

Submitted by John (not verified) on Wed, 2012-11-14 19:21.

If you require stable perfromance, you may consider putting the small sensor inside a constant temperature oven of about 40 degree centigrade. Oven is a time proven practice for high accuracy telecommunication radio frequency oscillator. Oven can be constructed by, may be 1 to 4 watts, resistor serving as heater, off the shelf industrial PID temperature controller and a small foam heat insulating box to hold the sensor board and resistor. Good quality industrial PID temperature controller is stable to about 0.1 degree centigrade.

Another aproach

Submitted by Manu Guisado (not verified) on Wed, 2012-11-14 20:29.

Maybe it would be a good idea to have a set of calibration data indexed by temperatures.

Instruction for using the calibration software

Submitted by John (not verified) on Mon, 2012-11-12 14:32.

Grateful for kindly pointers to instructions on how to use the FreeIMU_GUI-0.1-win32 calibration software

Many thanks in advance


Values always peak

Submitted by cin0s (not verified) on Sun, 2012-11-11 17:10.

Hi Guys,
I've got a little problem with my sensores. I don't think this issue is caused by Fabios software, but I think it's caused by the sensore I use. Well. I use the 9DOF Sensore Stick (SEN-10724) and 2 of the 3 axis peak always at a certain angle. Here is a screenshot of the calibration tool:

I also get a similar output if I read the acc sensore values "manually". So it's not Fabios fault, but it is a really anoying issue...

Btw: this is the output I get with this kind of sensore data:
const int acc_off_x = -38;
const int acc_off_y = 52;
const int acc_off_z = 423;
const float acc_scale_x = 186.456572;
const float acc_scale_y = 331.873171;
const float acc_scale_z = 112.734495;

const int magn_off_x = 39;
const int magn_off_y = -128;
const int magn_off_z = 4;
const float magn_scale_x = 387.551331;
const float magn_scale_y = 436.820877;
const float magn_scale_z = 381.809318;

So do you have got any idea how to solve this? I don't have much expirience with such sensores, but i think the sensores is somehow to sensitive. So that the 9.81 m/s² let the sensore peak. Is that possible?


Ps: I accedently posted this comment here: a few seconds ago. It was a mistake by myselfe (yeah. I'm kind of dumb -.-). Sorry Fabio!

gentoo is running calibration sw !

Submitted by legacy (not verified) on Fri, 2012-11-09 12:57.

i am still working on macOSX port
but gentoo is now running the py-calibration sw !

python: can't open file './Cura/'

Submitted by Manu Guisado (not verified) on Tue, 2012-11-06 18:53.

Hi Fabio,

I'm trying to test the software directly from the Python sources available on the FreeIMU repository as you have recommended.

These are the command that I have executed:

> bzr branch lp:freeimu
> cd freeimu/FreeIMU_GUI
> ./ linux
> cd dist/FreeIMU_GUI-0.1-linux
> ./
python: can't open file './Cura/': [Errno 2] No such file or directory

I have searched that file but I have not been able to find it.

Could you help me?

More data ...

Submitted by Manu Guisado (not verified) on Tue, 2012-11-06 18:57.

I forgot to comment that I'm working with an Ubuntu 12.10.

Best regards and thank you.

The script is only

Submitted by fabio on Thu, 2012-11-08 02:20.

The script is only for windows at the moment. Proceed this way:

> bzr branch lp:freeimu
> cd freeimu/FreeIMU_GUI/FreeIMU_GUI
> make
> make run

That's likely that you will have to install some dependencies, python will complain about missing packages, just google for them and install using apt-get or similar.

why don't you use git ? it

Submitted by legacy (not verified) on Tue, 2012-11-06 14:19.

why don't you use git ? it much more friendly

I don't know if you are

Submitted by fabio on Tue, 2012-11-06 14:33.

I don't know if you are talking about some kind of GUI frontend to git or bzr but, I'm using those programs from command line and I really don't see much difference.

Please elaborate.


Submitted by legacy (not verified) on Wed, 2012-11-07 15:24.

git is too difficult to put on gentoo machines, i had a lot of troubles in order to emerge it on arm machines, for example, also nobody is using git except you, people are usually to use

1) svn
2) git
3) mercurial

all of them are supported by all the distro

also there are a lot of service around the world which provide you git repo online for free with the possibility to browse the code and to analysis on it.

i typed wrong

Submitted by legacy (not verified) on Fri, 2012-11-09 13:03.

"bzr is too difficult to be port" ... i was talking about bzr
git it easy to be port on gentoo machine, on mac, on win, etc, and people is using git much more than bzr, also a lot of web services like GIT-HUB

btw, it is your choice, personally i do not like bzr

Still not stable

Submitted by Arend (not verified) on Thu, 2012-11-01 15:27.

Hi Fabio,

I callibrated my sensorboard using you callibration prog.
Still no stable behaviour.

I think I must be doing something awfully qrong, but can't figure out what.

Here is the callibration.h:

* FreeIMU calibration header. Automatically generated by octave AccMagnCalib.m.
* Do not edit manually unless you know what you are doing.


const int acc_off_x = 550;
const int acc_off_y = 13107;
const int acc_off_z = -888;
const float acc_scale_x = 11146.480275;
const float acc_scale_y = 31762.766817;
const float acc_scale_z = 22324.487139;

const int magn_off_x = -546;
const int magn_off_y = 12;
const int magn_off_z = 65;
const float magn_scale_x = 360.789483;
const float magn_scale_y = 578.284233;
const float magn_scale_z = 747.336750;

Yeah, those calibration

Submitted by fabio on Thu, 2012-11-01 15:46.

Yeah, those calibration parameters looks pretty wrong, especially the accelerometer scale factors. That's pretty unlikely to have so different values on the scales.

When doing the calibration, concentrate on drawing circles on the XY, YZ, ZX graphs for both the accelerometer and magnetometer. Before hitting the "Calibrate" button you need to have something like this on your graphs. See the various circles.

I'll be making a calibration how-to video in the next week.

Got it

Submitted by Arend (not verified) on Thu, 2012-11-01 22:39.

Got the hang of the callibration movement.
Output is much more stable now!

Fantastic Job

Submitted by Arend (not verified) on Wed, 2012-10-31 13:32.

Hello Fabio,

Fantastic job you have performed here.
Perhaps a little instruction on how to best callibrate?

I'll do an instruction videos

Submitted by fabio on Wed, 2012-10-31 17:08.

I'll do an instruction videos once the software is more stable. For now, you just have to describe a sphere as accurate as you can be.

i've got macOSX 10.7.5

Submitted by legacy (not verified) on Wed, 2012-10-31 12:59.

i've got macOSX 10.7.5 machine
i could test it for adruIMU running freeIMU
also it may be i will put your freeIMU to an arduino

i need the list of all the python package you are using

Submitted by legacy (not verified) on Wed, 2012-11-07 15:25.

yeah, mac-port wants to know what he has to emerge, if you provide the list of python packages your app is using i could try to arrange something on macOSX/x86 using mac-ports

ok, 90% done with mac-ports

Submitted by legacy (not verified) on Fri, 2012-11-09 12:59.

the only missing one is QT-OpenGL
which is too hard to be compiled on mac
i think i will use a pre-build from