I picked up a dirt cheap I2C capable 10-DOF "IMU" breakout board with from e-bay ( this one here ) just to see how hard it would be to get some motion sensing capability for my Raspberry Pi. I know that we've had all these sensors built into phones for years now but it's still amazing that I can now buy a 3-DOF Accelerometer, 3-DOF Gyro, 3-DOF Digital compass and have a temperature\barometric pressure sensor thrown in for €20.
After a bit of minor soldering a quick test proved that all the parts were visible over the I2C bus but I could only find Python libraries for the pressure sensor. This was not a surprise, and frankly I wanted to have to work a bit to get sensible data and I really wanted to have a project that I could use to learn Python.
The breakout board has these sensors:
The extremely useful AdaFruit Learning System has a basic tutorial, complete with a working interface library for the BMP085. I already had one of those working ( it's on a second Pi that I bought because my first one was taking so long, so now it's monitoring the temperature and pressure in my attic - you can see that data here: https://cosm.com/feeds/80617 ) . That sample gives me enough of a framework to try building up the necessary libraries for the other three sensors.
I've had a couple of evenings to hack away at this and I've now got sensible, if uncalibrated, data from both the accelerometer and magnetometor via Python. AdaFruit's Raspberry Pi WebIDE has been a joy to use for this sort of learning exercise - it's clean and simple (which I need right now) and its integration with Bitbucket means I can easily point people at the code I've managed to hack together so far:
This stuff just about works and I'm sure anyone who has any sort of Python skills will find a ton of newbie errors and bad practices in there but hey, they work and I will be cleaning them all up as I learn how to do all this properly. And hopefully I'll have the L3G4200D Gyro in there over the next couple of days.