Testing FreeIMU Orientation Sensing after Accelerometer and Magnetometer Calibration

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

Testing the FreeIMU framework orientation sensing after using the new FreeIMU calibration GUI to calibrate Accelerometer and Magnetometer.

As you should see, this is pretty accurate and drift free estimation.

Posted in:

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: FreeIMU_GUI-0.2-win32-r23.zip
  • 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:

Ellipsoid into Sphere Optimization using Numpy and linalg

Last updated on Thu, 2012-11-15 09:30. Originally submitted by fabio on 2012-10-18 17:45.

I'm working on a user friendly calibration program, since I'm completely aware that what I released some time ago using a python script and Octave is very complex to use for FreeIMU library users.

So, I'm creating a new calibration software which will use Python, Numpy and its linalg component to provide an easy to use libre calibration software.

I started by trying what Nirav Patel suggested but wasn't much successful with it. So, I simply ported the Matlab/Octave code into Python+Numpy+linalg.

Below is the code for you to enjoy and here a sample input file.

cal_lib.py - Ellipsoid into Sphere calibration library based upon numpy and linalg
Copyright (C) 2012 Fabio Varesano 

Development of this code has been supported by the Department of Computer Science,
Universita' degli Studi di Torino, Italy within the Piemonte Project

This program is free software: you can redistribute it and/or modify
it under the terms of the version 3 GNU General Public License as
published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see .


import numpy
from numpy import linalg

def calibrate(x, y, z):
  H = numpy.array([x, y, z, -y**2, -z**2, numpy.ones([len(x), 1])])
  H = numpy.transpose(H)
  w = x**2
  (X, residues, rank, shape) = linalg.lstsq(H, w)
  OSx = X[0] / 2
  OSy = X[1] / (2 * X[3])
  OSz = X[2] / (2 * X[4])
  A = X[5] + OSx**2 + X[3] * OSy**2 + X[4] * OSz**2
  B = A / X[3]
  C = A / X[4]
  SCx = numpy.sqrt(A)
  SCy = numpy.sqrt(B)
  SCz = numpy.sqrt(C)
  return ([OSx, OSy, OSz], [SCx, SCy, SCz])

if __name__ == "__main__":
  acc_f = open("acc.txt", 'r')
  acc_x = []
  acc_y = []
  acc_z = []
  for line in acc_f:
    reading = line.split()

  (offsets, scale) = calibrate(numpy.array(acc_x), numpy.array(acc_y), numpy.array(acc_z))
  print offsets
  print scale

Custom made PCB with CC430 works! Blinking wonderfully :-)

Submitted by fabio on Sat, 2012-10-06 18:14.

I'm working on a little project using the CC430 microcontroller (specifically a CC430F6137) from Texas Instruments.. well, I was a bit skeptical about this project because the micro is pretty hard to solder, (it's a QFN with 64 pins).. however, some time ago I soldered it fine and only today I finally had time to run some code on it.

Well.. it works! I wrote a little blinking program for it, compiled it under Linux and it works! Ahhh.. great! :-)

Here is the code (file name blink.c):

#include  <cc430x613x.h>

int main(void) {
   unsigned int count;
   WDTCTL = WDTPW + WDTHOLD; //Stop watchdog timer

   P2OUT = 0; //Configure P1 to output on P1.0
   P2DIR |= 0x01;

      P2OUT ^= 0x01; //Toggle P1.0 using exclusive-OR
      for(count=0; count<60000; count++){ /* Insert some delay */ }

Under Linux with msp430-gcc you can simply compile it with:

msp430-gcc -mmcu=cc430f6137 blink.c

Then, a file a.out will be generated.. now simply program and run the micro with:

mspdebug rf2500
prog a.out


Posted in:

Here is PALLA!

Submitted by fabio on Fri, 2012-09-28 14:49.

I'm happy to finally disclose our work on PALLA, a spherical wireless device designed for usage in videogames and computer based leisure activities. I just opened its project page where you find all the details about it, including some publications on it.

The device has been presented officially at the Fun and Games 2012 conference at the beginning of this month and now I finally have demonstration videos and a project webpage.

Our work has been also featured today on newscientist.com in their article Smart ball lets you play video games intuitively which is also in their first page right now.

Here is a video which explains more about the device:

For more informations on PALLA, please visit the project webpage.

Posted in:

Fixing Olinuxino A13 Dev board hardware VGA problems

Submitted by fabio on Fri, 2012-09-21 10:01.

Back in July, I ordered one of the early versions of the Olinuxino A13 board since it seemed very cool: powerful, open hardware, easily to solder and develop derivative products from it...

Unfortunately, there was a minor hardware issue on the VGA output which Olimex guys promptly fixed and share the fixing procedure with us.

These are some pictures I took while I was fixing my board.

The Olinuxino A13, in all its beauty.


Posted in:

Complementary Filtering High Res Barometer and Accelerometer for Reliable Altitude Estimation

Submitted by fabio on Mon, 2012-09-17 17:59.

This is a simple example of some of the stuff I've been working on recently. This is a demonstration of the soon to be released filtering capabilities of the FreeIMU library using the FreeIMU v0.4.3 as sensor board.

The sensor fusion algorithm estimates the orientation of the board and from that an estimation of the dynamic acceleration is computed by subtracting the gravity from the accelerometer readings. The dynamic acceleration is the fused with the high resolution barometer readings coming from the MS5611 through a complementary filter.

The result, as seen in the graphs is an extremely reliable altitude estimation which can go up to 5-10 cm of precision with almost immediate response to motion.

Graphs programmed in python with pyqtgraph.

Greetings from Portugal

Submitted by fabio on Sun, 2012-09-09 10:26.

I just got back home from a 3 weeks holidays in Portugal.. I've been there with my girlfriend Arianna and we traveled by car along most of the country costs, looking for waves to surf but also for nice historical places. We really had a wonderful time there, Portugal is really a great place and we definitely wanna come back there soon!

Here is a selection of pictures from the trip, hope you like it.


Posted in:

Drift-free attitude and heading estimation with the new FreeIMU library calibration routine

Submitted by fabio on Tue, 2012-07-31 15:15.

The problem of missing calibration routines for the FreeIMU has been bothering me for a long time.. I was aware of many approaches to the problem but simply never been able to work on it.

Thanks to the help of Andrea and Pasquale Cirillo which provided me with some calibration code based upon the "infamous" AN3192 from ST Microsystems, I've been able to embed everything into a nice calibration procedure for the FreeIMU library.

The results are very promising, as you should see from the video below. Code is available on the FreeIMU repository and will be published in the next version of the FreeIMU library.

Posted in:

First Look at the Olinuxino Maxi: i.MX233 ARM based Linux computer with ArchlinuxARM

Submitted by fabio on Mon, 2012-07-30 10:53.

While everyone is crazy about the Raspberry Pi, I'm pretty skeptical about it. Why? Well, because it's a closed source hardware based upon a BGA microprocessor using a 6 layers PCBs.

What does that mean? Well, it means that it's really a pain in the ass to create derivative projects from it.. So, although the Pi it's a really awesome device, it's almost impossible to create a product from it.

With this in mind, I started to look around for alternatives and I found the Olinuxino Maxi, a single board Linux compatible computer based upon the i.MX233 microprocessor, designed by Olimex.

Olinuxino Maxi

Why this is much more interesting for me? Well, first of all, it's a complete Open Hardware project so the schematics and PCB designs are available released under CC-BY-SA so that we can take them and modify as we like.

Second very important aspect is that it is based upon a QFP packaged microprocessor using a 4 layers PCBs. This means that we are perfectly capable to solder it by hand and getting PCBs for it cheaply (through OSH Park for example).

This can very well support the creation of derivative hardware starting from the original Olinuxino designs..

So, I got one of these boards and in the following video I show it running with ArchlinuxARM.. looking pretty awesome so far.

What do you think? Should we all use Raspberry Closeberry Pis or look for more open and easily hackable alternatives?