Pages

Friday, December 4, 2015

Adafruit 10-DOF IMU: Getting It to work on Raspberry Pi... With Python!!!

I recently purchased the Adafruit 10-DOF IMU with much anticipation.










http://www.adafruit.com/product/1604

This puppy combines 3 sensors into one package giving you 11 axes of data in one package! The various readings can be combined to create a complete Altitude and Heading Reference System (AHRS).  Barometric Pressure and Temperature readings can be combined with standard physics equations to calculate its height above sea level.

Getting it Connected Up and Running


After some initial fumbling around I finally got this thing to work. So let's begin by connecting it up. This step is pretty straight-forward if you follow the instructions linked below.
SaveFromTheNet
https://learn.adafruit.com/adafruit-10-dof-imu-breakout-lsm303-l3gd20-bmp180/connecting-it-up













Next, I had to enable I2C on my Raspberry Pi 2. To do this I simply followed the instructions below. Note that on the RPI2 I had to use the >i2cdetect -y 1 command instead of >i2cdetect -y 0 to detect if i2c was working. I guess bus 1 is enabled by default on the RPI2 instead of bus 0.

http://www.instructables.com/id/Raspberry-Pi-I2C-Python/step2/Enable-I2C/


Next, install the RTIMULib2 from the link below.

https://github.com/richards-tech/RTIMULib2

To install the package, do the following:
1) download the package
2) unzip
3) cd to ~/TRIMULib2-master/Linux/python
4) run >sudo python setup.py build
5) run >sudo python setup.py install

That's it!

Now let's try it out.
> cd ~/RTIMULib2-master/Linux/python/tests
> sudo python Fusion.py

Your terminal should start rolling off number like the screen-shot below:













And that's it!  Take a look at the code for Fusion.py, Fusion10.py, and Fusion11.py to understand how to call the functions to access the IMU.

1 comment:

  1. r: 0.000000 p: -0.000000 y: -0.000000
    r: 0.000000 p: -0.000000 y: -0.000000
    r: 0.000000 p: -0.000000 y: -0.000000
    r: 0.000000 p: -0.000000 y: -0.000000
    r: 0.000000 p: -0.000000 y: -0.000000
    r: 0.000000 p: -0.000000 y: -0.000000
    r: 0.000000 p: -0.000000 y: -0.000000
    r: 0.000000 p: -0.000000 y: -0.000000
    r: 0.000000 p: -0.000000 y: -0.000000

    help me please

    ReplyDelete