Real-time orientation display with the MinIMU-9 v2
The MinIMU-9 v2 (catchy, no?) is a tiny inertial measurement unit (IMU). It has has three axes of gyroscope, accelerometer and magnetometer on board, which mean you can use it to sense the precise orientation of the device itself and, by extension, whatever it’s fixed to.
You’ll find IMUs in devices like model aeroplanes and VR headsets. This one talks to I²C, making it an ideal fit for the Raspberry Pi – all that was needed for this project was the IMU, a Pi and a few jumper cables.
David Grayson has hooked it up to the Pi’s I²C bus and has built some software (available on GitHub) that uses the Raspberry Pi’s powerful 3D graphics to impose a visualisation process on the raw data in real time. This means that you can display on screen exactly what position the IMU is in, on the fly.
David’s software comes with a number of different modes, including gyro only and magnet only, which are useful for understanding how IMUs work, and also for troubleshooting any system you might build using one.
If you’re interested in getting acquainted with manipulating IMUs yourself, David has made a superbly detailed tutorial available alongside the source code itself on GitHub. Thanks David – it’s always a pleasure to see work that’s documented so well, especially when it’s accompanied by such tidy source code.
For those who’d like to see more of David’s work, he has a blog (inventively titled David Grayson’s Blog).
10 comments
Romilly Cocking (@rareblog)
It looks as if the v2 is being replaced by the MinIMU-9 v3 (http://www.pololu.com/product/2468) whcih has deiffent I2C addresses and register designations. The good news is that the v2 is available more cheaply until Pololu rin out of stock.
Romilly Cocking (@rareblog)
Sadly, neither version will help me type better :)
Bill Stephenson
That is remarkably cool!
Thank you for sharing, I’m off to read the details…
Vincent RAMPAL
Hi, you’re interested in the subject you should also look for a chip called MPU-9150 available a very low prices on eBay and a librabry called RTIMULib.
http://www.ebay.com/sch/i.html?_nkw=mpu-9150
https://github.com/richards-tech/RTIMULib
Yaron
RTIMULib seems great, thank you for posting it.
I have an mpu-9150, and I have used the library linux-mpu9150 in order to get the sensor data, and using a websocket server (using libwebsockets) I sent the orientation data, and displayed a 3d rotating rectangle on a webpage using JavaScript and CSS3, and it works quite similar to what is done in the video in the article.
But it seems that the linux-mpu9150 is not actively supported any more and RTIMULib seems to be easier to work with.
The Raspberry Pi Guy
Wow! That is awesome!
I could possibly make this into a video tutorial at a later date – making sure you are duly credited of course. Would you be up for that?
The Raspberry Pi Guy
Ton van Overbeek
Adafruit has a similar unit (https://www.adafruit.com/products/1714)
using the same sensors as the v2 for $39.95. Also covered in their learning system. They also have an other one with an additional barometer (altitude measurement).
And if you wonder what AHRS means: Attitude and Heading Reference System.
Jeremy Hall
Hey this would be the most awesome thing if you could make guidance control systems for rockets and long range missions with complete accuracy.
Roger Swanson, SC USA
Very Cool, thanks for the post ;-)
kevin mcavinchey
Great idea. Id like to try this project. Can you suggest where i can get a minimu and whether i should get rev 2 or 3.
cheers kevin
Comments are closed