I've been experimenting with various IMU sensors, such as Pololu's AltIMU-10 (the V3 is currently on sale for $22) with various software options, and comparing the performance with commercial packaged IMU options like the CHRobotics UM-7.
I have concluded that the combination of the AltIMU-10, an Arduino Pro Mini and the open source AHRS (Attitude, Heading and Reference System) software for Arduino from Richards-tech is state of the art for hobbyists.
At the risk of losing points with Pololu, I admit to using low power, $3 eBay Pro Minis. One board in particular is quite handy because it has holes for a 3x2 AVR-ISP style programming header, as well as programming via the standard, 6x1 Arduino-style USB-serial adapter. I have several of these and all have withstood considerable abuse. ebay.com/itm/Free-Shipping-A ... 3cf3feac9d
Considering the total cost of ~$25, this combo can't be beat, and the two boards together are the size of a stick of chewing gum.
The open source AHRS software can be downloaded at richardstechnotes.wordpress.com/). Richard's code is very clearly written, understandable, easy to modify and to judge from his blog, he is interested in user experiences, responsive to questions and quite willing to support it.
After connecting the AltIMU-10 to the Pro Mini via the I2C pins (A4 and A5) and providing it with power from Vcc and GND (with everything powered via the USB-serial adapter), it took me all of ten minutes to get the combo up and running.
Install the RTIMU software as instructed on the GitHub page and notes. To get this to work with the AltIMU-10 V3, you have to change just two lines in RTIMULibDefs.h so that it appears as follows (basically, you are just defining the gyro I2C address):
//#define MPU9150_68 // MPU9150 at address 0x68 (JR: undefined)
//#define MPU9150_69 // MPU9150 at address 0x69
//#define MPU9250_68 // MPU9250 at address 0x68
//#define MPU9250_69 // MPU9250 at address 0x69
//#define LSM9DS0_6a // LSM9DS0 at address 0x6a
//#define LSM9DS0_6b // LSM9DS0 at address 0x6b
//#define GD20HM303D_6a // GD20H + M303D at address 0x6a
//#define GD20HM303D_6b // GD20H + M303D at address 0x6b
//#define GD20HM303DLHC_6a // GD20H + M303DLHC at address 0x6a
//#define GD20HM303DLHC_6b // GD20H + M303DLHC at address 0x6b
//#define GD20M303DLHC_6a // GD20 + M303DLHC at address 0x6a
#define GD20M303DLHC_6b // GD20 + M303DLHC at address 0x6b (JR: defined)
Later versions of the AltIMU-10 use a different gyro, e.g. GD20H which is also supported. I did not enable the pressure sensor.
The first step is to calibrate the magnetometer. In the Arduino IDE, load up ArduinoMagCal from the downloaded package, compile and run. After a couple of minutes of twisting and turning the IMU board, enter "s" into the serial monitor window, and the magnetometer calibration constants are saved to EEPROM. Ideally, this step will be performed in the final resting place of the sensor.
An unusually sophisticated and desirable feature of the package is automatic tracking and removal of the rate gyro bias.
Then, load up ArduinoIMU in the IDE, compile and run. You will be greeted by an intro and the yaw, pitch and roll angles similar to what follows (I have already made slight modifications to the code producing the output stream, for plotting the results):
The output is smooth and when the sensor is not moving, rock steady! See the attached plot for an example. In my preliminary tests, the yaw, pitch and roll angles seem to be every bit as accurate, stable and the board as responsive as the CHRobotics UM-7 module, although I am certain that the Arduino is not capable of similar update rates. Everything runs on 5V, so no need to worry about 3.3V interfaces!
The compiled code takes up 24,108 of 30,000 bytes (not counting the bootloader), so there isn't much left for other code. However, one could easily implement a balancing robot, platform stabilizer, etc. in the remaining 6K bytes. On the other hand, processors are so cheap now that one could just use this setup as the AHRS, feeding attitude input into another processor that does whatever else might be interesting.