Skip to content

02. Introduction

mjs513 edited this page Nov 9, 2014 · 5 revisions

FreeIMU INTRODUCTION

The FreeIMU library was designed by Fabio Veresano as part of his thesis project and his continuing interests in tangible human computer interaction. His thesis pretty says it all in where his interests laid (http://www.varesano.net/files/MoS_thesis/thesis.pdf). The original library itself implements the Magnetic, Angular Rate, and Gravity (MARG) filter based the Sebastian Madgwick’s MARG implementation of Mahoney’s DCM complimentary in quaternion form (see http://www.x-io.co.uk/open-source-imu-and-ahrs-algorithms/ for original paper). The library provided support several IMUs:

  • 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.)

This equates to the following sensors:

 Accelerometers
     ADXL345B
 Gyros
     ITG3200, L3GD20H
 Magnetometers
     HMC58X3
 Combos
     MPU-6000: Gyro and accelerometer
     MPU-6050: Gyro and accelerometer
 Pressure/Altimeter Sensors
     MS5611BA, BMA180 

Fabio also created several versions of the FreeIMU board, his last version, v0.4r3 which is the MPU-6050, HMC5883L and the MS5611 pressure sensor. He provided visual software developed in Unfortunately, Fabio passed away December 2013 the age of 28 and the Maker community lost a great friend and genius.

This project is my attempt to both extend and implement improvements to library for my own projects and share them with rest of the community as Fabio did for us.

To date I have made several changes to the library including support for additional IMU/sensors including:

  • Altimu10-v3: L3GD20H gyro and LSM303D accelerometer and magnetometer, and the LPS331AP digital barometer
  • DFROBOT 10 DOF IMU: ADXL345 accelerometer, the HMC5883L magnetometer,the ITG-3205 gyro and the BMP085 barometric pressure sensor.
  • APM 2.5 Arduimu - MPU-6000, HMC5883l and MS5611. Note that this board uses the SPI bus.
  • Generic breakout boards for the MPU-9150 and MPU-9250. These boards have the AK8975 and AK8963 magnetometers
  • Pressure sensors: MS5611 SPI support for the APM 2.5, MPL3115A2

The MahoneyAHRS algorithm requires two parameters to Kp and Ki. For each of boards including the FreeIMU v0.4 were tuned to ensure best performance. These parameters may have to be adjusted for your board even though it is the same. The same holds true for the MadgwickAHARS algorithm which I believe uses a gradient descent method. In case the Beta term has been adjusted. For more information of the AHRS filters used download Sebastian Madgwick’s paper. The link also has the source code in different formats if you are interested.

In addition to the changes above, additional changes were made including

  • Butterworth filters added using the filter library from the Aeroquad library
  • Temperature compensation curve as an option
  • Implemented the altitude complimentary filter based on Fabio’s PALLA software
  • Implemented tilt compensation heading
  • 1-D Kalman filter for pressure within the library
  • 1-D Kalman filter for accelerometers as an option in the Arduino Serial sketch
  • Libraries added for AK8963 and AK8975 used for the MPU-9150 and the MPU-9250
  • Added Madgwick MARG gradient descent filter: have to set flag, which seems to dramatically reduces yaw drift which requires only one tunable factor
  • Added GPS support in the Arduino Serial library but may move to the FreeIMU proper
  • Changed layout and added indicators in the visualization processing sketches.

The library was tested on the Arduino Mega, Teensy 3.1, Arduino Due and the Intel Galileo although I was having issues with the Galileo reading multiple I2C sensors. The code will work on the Arduino Uno, unfortunately with all the changes will not fit.

A nice comparison of IMUs and CPU comparisons can be found Kris Winer’s github page: https://github.com/kriswiner/MPU-6050.wiki.git.

The effects of these changes were demonstrated in multiple YouTube videos:

FreeIMU/MPU-6050 Drift Free AHRS and Motion Detection

Alt text for your video

FreeIMU Library Update/Gradient Descent - Zero Yaw Drift

Alt text for your video

FreeIMU Drift Free with GPS and MPU-9150

Alt text for your video

New FreeIMU Library Processing GUI

Alt text for your video

Automated FreeIMU (MPU-6050) Calibration

Alt text for your video

The contents of this wiki will follow the steps you need to implement the FreeIMU library with the supported sensors:

Section 1: Hooking up a IMU to the Arduino. This is the easiest step in process

Section 2: Calibration: Don’t even try to use the library without doing a good calibration – you will get a lot of drift and/or some very strange behaviors.

Section 3. Configuring FreeIMU library and FreeIMU Serial Sketch

Section 3a. Configuring Accelerometers/Gryos/Magnetometer Settings

Section 3b. Adding a IMU to the Library/Understanding Axis Alignment

Section 4. Using the Processing visualization sketches.

You can’t perform that action at this time.