FreeIMU: an Open Hardware Framework for Orientation and Motion Sensing

FreeIMU is an ongoing research project which aims to design Open Hardware 9/10 DOM/DOF Inertial Measurement Units as well as easy to use Orientation and Motion Sensing libraries, built on top of the Arduino platform.
The goal of the FreeIMU Framework is to simplify the development of projects based upon the most powerful and new consumer grade inertial, magnetic and pressure sensors.

FreeIMU version 0.2 (left) and version 0.1 (right)

The main application of FreeIMU is orientation sensing: by reading the data from the various sensors is possible to compute precisely the orientation of FreeIMU in the space. Recent boards also feature an high resolution barometer allowing to precisely track the device altitude. This can be useful in many applications: human-computer interaction device prototyping, flying machines, robots, human movement tracking and everywhere orientation sensing is a key aspect.

As FreeIMU breakout the sensors interrupt pins, it's also possible to detect per axis single and double taps, free fall as well as activity or inactivity. This makes FreeIMU a very good choice for Human-Computer devices prototyping. Interrupts pins are also very useful if you are into interrupt based reading of the sensors, useful to develop high frequency interrupt based sensor reading.

Video presentation of FreeIMU

Older video presentations: FreeIMU v0.3, FreeIMU v0.1 and 0.2.

A true Open Hardware project

Open Hardware Logo

FreeIMU is a true Open hardware, released under the CC-BY-SA. You are free, actually encouraged, to use it for any purpose, to study and modify its designs, to make your own copies of FreeIMU and even sell your own FreeIMU based hardware. But, you will have to share your designs based on FreeIMU keeping attribution and sharing them using the same libre license.

On FreeIMU repository (see development section below) and from the downloads on this page, you have access to everything you need to build your own FreeIMU board. You have access to the schematics, the PCB designs and even the bill of material so that you can build your own FreeIMU.

Moreover, FreeIMU has been designed using KiCAD, an excellent libre PCB design software, so you don't have to rely on proprietary software to study or modify FreeIMU.

Getting FreeIMU

An assembled, tested and ready to use FreeIMU board can be bought from:

The FreeIMUs boards bought from the above shops financially support the project. The boards have been produced and assembled in Italy by reasonably paid workers in a safe environment in respect with European and Italian laws.

Build your own FreeIMU

If you have SMD soldering experience (or if you are up for experimentation) you can build your own FreeIMU. From the downloads below you have access to all the designs needed to have your FreeIMU PCB manufactured.

You can get cheap PCB with awesome quality from Dorkbot PDX and order the various components needed from you favorite electronic distributor: the Bill of Materials (BOM) files will tell you exactly which components you'll need for your FreeIMU.

The are various ways of soldering the board. If you only need a couple of boards done, tack flux, solder wire and hot air reflow station are enough to build your boards (Remember not to use hot air over the pressure sensor). See this video for good instructions. In case you are building more units, an SMD stencil with solder paste is the suggested method.

In case you need help, just post a comment below.

FreeIMU versions

FreeIMU version 0.1

FreeIMU v0.1

WARNING: Discontinued due to the phasing out of the HMC5843.

FreeIMU v0.1 is the simplest FreeIMU available. It contains the ADXL345 accelerometer, the ITG3200 gyroscope and the HMC5843 magnetometer, their respective capacitors and an additional 10uF capacitor to help keeping the power to the sensors stable. It doesn't have any voltage regulator nor any level translator so it needs to be connected to a 3.3V power source and the I2C level signals have to be 3.3V. When used on a 5V microcontroller, an I2C level converter and a voltage regulator are needed.

FreeIMU version 0.2

FreeIMU v0.2

WARNING: Discontinued due to the phasing out of the HMC5843.

FreeIMU v0.2 has the same sensors (ADXL345, ITG3200 and HMC5843) and size of v0.1 but I added an integrated voltage regulator (MIC5205) and a logic level converter (PCA9306). With these components it's extremely simple to use FreeIMU v0.2 on 5V boards like 16MHz Arduinos, just connect FreeIMU to the 5V, GND, SDA and SCL on Arduino and you are ready to go!

IMPORTANT: in version 0.2 sent to production there is a bug in the drill size of the connectors. The drill hole should have been 0.04" while it is actually 0.032". Consequence of this is that only rounded pins will fit inside the drill and standard squared pins won't fit. This is not really a problem as the big oval pad makes actually possible to use 90 deg squared pin arrays using the pad as a smd connector. The Kicad sources above and the gerbers marked with "Fixed" have this issue fixed. However they haven't been tested on production so double check them before send them to fabrication.

FreeIMU version 0.3

FreeIMU v0.3

FreeIMU version 0.3 replaces the accelerometer and magnetometers used in v0.1 and v0.2 with the ADXL346 as accelerometer and the HMC5883L as magnetometer. The gyroscope is still the ITG3200. FreeIMU v0.3 integrates a voltage regulator (MIC5205) and a logic level translator (PCA9306) as well as all the pullups resistors needed.

FreeIMU version 0.3.1

FreeIMU v0.3.1 is a minor revision of FreeIMU v0.3. There have been some corrections in the silkscreen and the footprint of the HMC5883L have been made slightly bigger to make assembly easy. Everything else is just as in FreeIMU v0.3.

FreeIMU version 0.3.5

FreeIMU 0.3.5 top view

FreeIMU 0.3.5 is a small (22x20 mm) 9 degrees of measurement IMU MARG sensor featuring the BMA180 accelerometer, the ITG3200 gyroscope and the HMC5883L magnetometer.

FreeIMU 0.3.5 also has two additional subversions, FreeIMU 0.3.5_MS which features the MS5611-01BA high resolution pressure sensor and the FreeIMU 0.3.5_BMP which features the BMP085 pressure sensor.

FreeIMU v0.3.5 has an integrated voltage regulator (MIC5203) allowing you to plug it from 3V3 to 16V providing you 80mA of current which you can use to chain it to other 3V3 sensors or devices. By using the MIC5203, no tantalum caps are used in the whole design. Tantalum is not a good idea socially and environmentally.

The board has integrated 2K2 pullups resistors (which can be enabled or disabled by means of a solder switch) but doesn't have an integrated logic level converter. We decided to not include the LLC (which is present in my FreeIMU v0.2 and v0.3) as it adds considerable complexity in the design and schematics without being strictly necessary. In fact, given a properly configured software, it's a redundant part. Moreover the upcoming development of many 3V3 based control boards (eg: Multipilot 32) makes adding an LLC not a very far-seeing choice.

The IMU board is however compatible with my LLC board which can be stacked above the IMU, so that you can easily add the LLC protection keeping the amount of additional wires at the minimum.

The board, a part from the usual power and I2C connectors, breaks out the interrupt pins for all the three sensors. This should empower software developers to design interrupt based sensor reading and sensor fusion algorithms (opposed to the currently common polling based approach) which should provide possibility to shorten the cycle path of our algorithms.

FreeIMU version 0.3.5_MS

FreeIMU v0.3.5_MS

FreeIMU v0.3.5_MS is a variation of FreeIMU v0.3.5 which features the BMA180 accelerometer, the ITG3200 gyroscope, the HMC5883L magnetometer and the MS5611-01BA high resolution pressure sensor.

The board comes with a voltage regulator (MIC5203) and 2K2 pullups optionally disabled by using of a solder switch.

FreeIMU version 0.3.5_BMP

FreeIMU v0.3.5_BMP top view

FreeIMU v0.3.5_BMP is a variation of FreeIMU v0.3.5 which features the BMA180 accelerometer, the ITG3200 gyroscope, the HMC5883L magnetometer and the BMP085 pressure sensor.

The board comes with a voltage regulator (MIC5203) and 2K2 pullups optionally disabled by using of a solder switch.

FreeIMU version 0.4

FreeIMU v0.4.1

FreeIMU v0.4 features the MPU6050 gyroscope+accelerometer, the HMC5883L magnetometer and the MS5611-01BA high resolution altimeter.

The magnetometer is attached to the AUX I2C bus of the MPU6050 thus allowing it to be read directly by the MPU6050.

FreeIMU library

FreeIMU can be easily used on Arduino compatible boards using the Arduino FreeIMU library which implements sensor fusion MARG orientation filter enabling you to do easy and straightforward orientation sensing.

FreeIMU library - 2012/11/22
Use Arduino 1.0.1 IDE or later version.

Install the libraries as explained in the Arduino Libraries Reference section Contributed Libraries.
The FreeIMU library now supports all the versions up to v0.4. By default it's configured to be used on v0.4. In order to use on different boards, open the file FreeIMU.h and uncomment the correct version of your board.

The FreeIMU library also supports the following 3rd parties boards:

  • Sparkfun IMU Digital Combo Board - 6 Degrees of Freedom ITG3200/ADXL345 SEN-10121
  • Sparkfun 9 Degrees of Freedom - Razor IMU SEN-10736
  • Sparkfun 9 Degrees of Freedom - Sensor Stick SEN-10724
  • Sparkfun 9 Degrees of Freedom - Sensor Stick SEN-10183
  • DIYDrones ArduIMU+ V3
  • Generic MPU6050 Breakout boards (eg: GY-521, SEN-11028 and other MPU6050 wich have the MPU6050 AD0 pin connected to GND.)

Note for FreeIMU v0.1 and 0.2 users: from April 2011 the default magnetometer configuration is for HMC5883L. In order to use the library with HMC5843 (v0.1 and v0.2) edit the file HMC58X3.h and uncomment the line #define ISHMC5843.

FreeIMU Processing Programs
The FreeIMU library comes with Processing visualization demos. In order to use them, Download and install Processing. Copy the folders within the processing folder of the FreeIMU library archive into your Processing sketchbook.
Remember to change the Serial port address in the Processing code to match the address used by arduino on your system.

Ports to Other platforms

FreeIMU library on PIC 24 microcontroller by Hari Nair hair [dot] nair [at] gmail [dot] com. Author notes: 1. assumes a 6MHz crystal is attached and x4PLL internally, so Fosc = (6x4)/2 = 12 Mhz 2. trivial to use the internal FRC oscillator, instead of FNOSC_PRIPLL in the configuration words, use FNOSC_FRCPLL. This will give you Fosc = (8x4)/2 = 16MHz, but of course with less precision. 3. transmits ascii quaternion data at 38400baud. This does slow down the sampling rate. Without the quaternion print, the code completes in less than 10mS, so the sampling rate is exactly 100Hz as set by the timer.

FreeIMU library on NXP LPC1343 Cortex m3 processor by Hari Nair hair [dot] nair [at] gmail [dot] com. More details and possibility to contact the author on the FreeIMU community development forum.

Have you ported the FreeIMU library to other platforms? Please let me know and I'll list your work here!

Calibration

A calibration GUI application is available. The software is currently in alpha state, however many people are already using it.

The calibration, when properly executed, drastically improve the orientation sensing performance of the FreeIMU framework. If you are experiencing drifting or inconsistent results, your sensors may need to be calibrated using the Calibration GUI.

Community

There is now a FreeIMU Community website, which has been set up to become the central point of interaction between users of the FreeIMU framework. This is the place where you can get help, join others in developing new features, discuss IMUs applications and much more.

Previously we used FreeIMU answers on Launchpad as well as comments on Fabio's website for supporting users, however we decided to create an ad-hoc website to facilitate information gathering and collaboration between people.

Development, Bug Reports and Suggestions

Development of FreeIMU boards and libraries can be followed on FreeIMU project page on Launchpad which also hosts our software and hardware repository.

Suggestions or bug reports can be made on the FreeIMU Community, in the development forum.Previously bug reports were posted on the Launchpad bug reporting interface but that's not used anymore.

FreeIMU repository holds all the various library sources as well as design files and schematics. Everything is revisioned meaning that all the changes are logged and annotated.

The contents of the repository are available using Bazaar (bzr) with the command:
bzr co lp:freeimu

Never used bzr before? Not a big deal, it's very similar to git, svn or others. You may wanna have a look at the cheatsheet to have an overview of the commands available or read more documentation on bzr.

Alternatively, in case you have problems setting up bzr on your system, you can simply get the latest repository contents from here. The resulting file is a .tar.gz archive which can be opened with the excellent 7zip under Windows. Mac and Linux users shouldn't have problems opening such files.

The files on the repository can also browsed from a browser here. A list of recent changes is available here.

FreeIMU users videos

Here some videos made by FreeIMU users on their projects using FreeIMU.

rtsdrums flies like crazy with FreeIMU on his quadcopter.. check out the triple flip!

Warthox testing indoor FreeIMU v0.4r3 on one of his quadcopters.

Warthox stress test FreeIMU v0.3.5_MS on one of his quadcopters.

Chris uses FreeIMU on his VTOL EDF Tricopter powered by the MultiWii software.

Danilo Del Console uses FreeIMU in a 2 wheels self balancing robot.

Francesco Ferrara uses FreeIMU for a camera stabilization system.

Francesco Ferrara with his super fast implementation of the AHRS algorithm capable of displaying the rotating cube at 333Hz with FreeIMU! Great work!

Marchino65 with his first test with FreeIMU and the FreeIMU library on Arduino. The cube is spinning pretty good!

Francesco Ferrara in his first flight with FreeIMU on his very young quadcopter project called Simplo.

What boards are you using?

Submitted by fabio on Tue, 2011-06-14 15:50.

What boards are you using?

Boards

Submitted by Aze (not verified) on Tue, 2011-06-14 16:35.

I'm using the ADXL345, HMC5843, and ITG-3200. You're right, the X and Y are switched on the magnetometer relative to the accelerometer and gyroscope (it's already assembled on a pc board though). Can I just switch the two in the code?

Sure

Submitted by fabio on Tue, 2011-06-14 16:56.

Sure

Location in code?

Submitted by Aze (not verified) on Tue, 2011-06-14 18:16.

It seems like I have to change it in FreeIMU.cpp, but I'm not sure where. Do you have a suggestion?

Thanks!

easy fix

Submitted by Edi (not verified) on Sat, 2011-06-25 19:42.

just swap (in the getQ function) this line:

AHRSupdate(val[3] * M_PI/180, val[4] * M_PI/180, val[5] * M_PI/180, val[0], val[1], val[2], val[6], val[7], val[8]);

with this one:

AHRSupdate(val[3] * M_PI/180,val[4] * M_PI/180, val[5] * M_PI/180,val[0], val[1], val[2], val[7], -val[6], val[8]);

See this comment

Submitted by fabio on Tue, 2011-06-14 18:51.

Where to get board

Submitted by Steve (not verified) on Sat, 2011-06-11 01:45.

Hello Fabio

So are you getting the boards from Laen. I am thinking of making a couple of these and will put in an order with Laen for his next order on the 20th. Do you have a project link for mouser to get the parts from.
Thanks
Steve

Check out the BOM .. there

Submitted by fabio on Sat, 2011-06-11 01:52.

Check out the BOM .. there are some references to Digikey components. Not everything is available from Digikey, something will have to be bought from other sources (ITG3200).

Keep us posted.

Troubles in using the FreeIMU library

Submitted by Tuomas (not verified) on Tue, 2011-06-07 17:29.

Hi Fabio

Thanks for the really interesting site :)

I have my own setup of accelerometers, gyros and magnetometers hooked up to a Gumstix Overo running Linux and I'm using your FreeIMU library to calculate the yaw, pitch and roll.

I seem to be getting proper readings from the sensors but the yaw/pitch/roll values are not usable. Pitch and roll are about right, although they react a bit slowly and get confused if I rotate the device quickly. The biggest problem is the yaw. I don't think it shows anything meaningful. It can be increasing all the time although my device is still and while it do react to rotation I don't see any correlation.

I was first reading the sensors 25Hz and increased it to 100Hz without any improvement.

The accelerometer and magnetometer are giving out numbers without any scaling to real world units. The gyroscope is calibrated (by calculating an average offset) before use and the numbers are converted to degrees per second.

Math isn't my strongest side so I've basically just copied the routine without really understanding the idea behind it.

I'm using the default Kp (2.0f) and Ki (0.005f) values as I'm unsure about their meaning.

This is probably quite a hard question but do you have any ideas what might be wrong?

Well.. that's hard to say..

Submitted by fabio on Tue, 2011-06-07 20:29.

Well.. that's hard to say.. you are using a different system completely...

Note that the yaw needs some seconds to stabilize..

To me ... it looks like you have some kind of strange latency which shouldn't happen..

Resolved

Submitted by Tuomas (not verified) on Mon, 2011-06-13 15:02.

It seems that I just had my gyroscope scale way off because of some testing I did earlier. Now I get decent numbers to my GUI, although I don't know if the accuracy is enough for my goals. But I will find out that later :)

Thanks for the code!

Where to get it?

Submitted by thomas (not verified) on Sun, 2011-05-08 22:32.

Hello Fabio,

is there any way of buying one of those ?

regards from Mallorca

Thomas

Hi Thomas, I do have some

Submitted by fabio on Sun, 2011-05-08 22:48.

Hi Thomas, I do have some prototypes left I could sell you. If you are interested get in touch with me.

Dimesions of 0.3.1

Submitted by Sawan (not verified) on Thu, 2011-05-05 20:04.

hi Fabio,

Awesome Work!

But I have some questions -

What are dimesions of 0.3.1 ?

And how to open the .tar_ files?

Thanks,
Sawan

Dimensions are 37.465x19.685

Submitted by fabio on Fri, 2011-05-06 23:56.

Dimensions are 37.465x19.685 mm.

Just rename the .tar_ to .tar and use 7zip to open them.

Hope this helps,

Fabio

Hi,Fabio, First, thanks so

Submitted by shuzhe (not verified) on Tue, 2011-05-03 09:20.

Hi,Fabio,
First, thanks so much for providing such a wonderful library.
I have several questions.

1. I am considering build a FreeIMU 0.3. But I do not need the interrupt functions. Could I delete the INT pins on the PCB directly? Could the FreeIMU library work well with this modification?

2. For ITG3200, the I2C address is defined by AD0. Should I change something in the .h files if my AD0 is HIGH? I found the FreeIMU library works well for my AD0=HIGH, I changed noting of the library.

3.In FreeIMU 0.3 HMC5883L has replaced HMC5843. Does HMC5883L really has better resolution and other performace than HMC5843? Since someone told me that it is quite difficult to solder the HMC5883L onto the PCB without damage it even by reflow soldering.

1 - yeah you can delete the

Submitted by fabio on Thu, 2011-05-05 13:57.

1 - yeah you can delete the interrupt pins from the board design, the FreeIMU library will work just fine as it currently doesn't use interrupts. I would avoid doing so as I personally don't see any advantage in removing it. Maybe if you tell me what you are designing I could understand.

2 - hem.. that's strange.. in theory the FreeIMU library uses the AD0 = LOW by default, so it shouldn't work in your case (unless you modify its code).

3 - yes the HMC5883L is more precise, smaller and cheaper.. but yeah it's pretty hard to hand solder.. however, with some practice and with the right tools and solder paste, I've been able to solder it with an hot air gun and the pizza reflow oven.

Let me know if you have any other comment,

Thank you!

When do you think the first

Submitted by Mitch (not verified) on Sun, 2011-03-13 21:09.

When do you think the first FreeIMU v0.3 will be available to buy? I'm very interested in incorporating it into my quadcopter along with a Flyduino main controller. Thanks.

Get in touch with me if you

Submitted by fabio on Mon, 2011-03-14 10:09.

Get in touch with me if you want to participate in testing FreeIMU.

Have you considered the BMA180

Submitted by AlouetteIII (not verified) on Fri, 2011-02-18 14:14.

Fabio it's nice to see the v0.2 board - now it's quite practical in terms of incorporating the LLC and the 3v3. Very nice. In relation to the tests done by Point65 on comparison of ACCs and the poor performance of the ADXL345 - have you considered comparing the results of a Bosch Acc like the BMA180 also running at 400?

Also, check out this:

Submitted by fabio on Fri, 2011-02-18 14:57.

Hi AlouetteIII, thanks for

Submitted by fabio on Fri, 2011-02-18 14:39.

Hi AlouetteIII, thanks for stopping by..

I'm not aware of such tests, would you please point me to them?

I should also note that I developed FreeMU for usage in human-computer device prototyping so I choose the ADXL345 mostly for the presence of tap, double tap detection available in the ADXL345. The ADXL346 also add some orientation interrupt which looks pretty great.

Moreover, I love the quality of AD documentation: ADXL345/6 datasheets and accompanying docs are the best one I encountered so far.

Thank you,

Fabio

IMU's for advanced camera mount application.

Submitted by Denny Rowland (not verified) on Mon, 2011-02-14 09:39.

Fabio

I have for some time been developing 3 and 5 axis camera mounts. What I need is a small IMU that has pwm in/out and uses gyros of somewhere in the range of 20-67 deg/sec. Do you have anything that could be easily adapted to suit this application.

What I would really like to have is a dual 20deg/sec. with acc. that would be used in the tilt and roll axis (X and Y) and then a single 20deg/sec with acc. plus mag. that would be used on the pan axis.(Z axis).

Many thanks

Denny Rowland
(Director of Aerial Photography)

Hi Denny, thanks for getting

Submitted by fabio on Mon, 2011-02-14 14:39.

Hi Denny, thanks for getting in touch.
Aerial Photography really looks like something cool to explore.

I made a short google research for something similar to your application and I came out with: http://www.infmetry.com/coolstuff/xaircraft-x650-quadcopterquadrotor/
Have you tried looking for similar platforms for your applications? Probably there's already something happening somewhere in the world.. the problem is finding it ;-)

At the moment I don't have a platform which suits your needs out of the box. However, the sensors used on FreeIMU should be able to deliver the performance you need for your application (I have to say thought that I only partially understood the document you sent me by mail).

Moreover, I started collaborating with Francesco Ferrara (aka ciskje on rcgroups.com), the creator of Baronpilot, and Roberto Navoni from Virtualrobotix core developer of the upcoming Multipilot32 platform. Both of them are currently working on integrating FreeIMU on their platforms for usage in multicopter applications.

Personally, I'm a computer scientist by education and I'm still learning with electronics. I don't have any experience at all with RC application.

However, I do see here and on other forums many people interested in this field offering their help and sharing ideas, code, electronic designs and efforts.

With Francesco, we were thinking about designing Simplo, a simple board inspired to the Teensy++ for multicopter specific applications. That's still an idea though and I won't be available to work on it until April as I'm busy with my thesis right now.

So, if all of this does interest you, please get in touch with Francesco. I would suggest also to get in touch with Roberto which also have really a lot of knowledge to share.

Hope this helps,

Fabio

ADXL346

Submitted by John (not verified) on Mon, 2011-02-14 06:02.

Hi Fabio, Just wondering what your reasons are for the switch to the ADXL346. I see that it is slightly less expensive. Has the 345 been discontinued?

Nope, I don't think that the

Submitted by fabio on Mon, 2011-02-14 13:47.

Nope, I don't think that the ADXL345 is being discontinued. However, the new ADXL346 is slightly smaller and cheaper and has a couple of features more while still being register compatible and having the same performances of the ADXL345 so we can just use the code for the ADXL345 with also the ADXL346..

So, there is actually no a big reason for the switching.. but as I was designing FreeIMU v0.3, so, I thought why not?

eXtreme Programming?

Submitted by avenue33 (not verified) on Fri, 2011-02-11 21:44.

Congratulations Fabio, it's getting serious!

Is "agile development process" close to software "eXtreme Programming"?

See the concepts at http://en.wikipedia.org/wiki/Extreme_Programming

Good luck!

Yep, please see

Submitted by fabio on Sat, 2011-02-12 10:59.

Post new comment

The content of this field is kept private and will not be shown publicly.
If you have a personal or company website insert its address in the form http://www.example.com/ .
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre> <small> <del> <img> <h2> <h3> <h4> <b> <video> <sub> <sup>
  • Lines and paragraphs break automatically.
  • Images can be added to this post.
  • You may use [inline:xx] tags to display uploaded files or images inline.
  • You may insert videos with [video:URL]
  • Each email address will be obfuscated in a human readable fashion or (if JavaScript is enabled) replaced with a spamproof clickable link.

More information about formatting options