AltIMU-10 v3: Reading speed


Just bought the AltIMU-10 v3 to connect with my Beaglebone.

Everything works fine so far, but I am stuck with one point. I was expecting much faster reading (I would need around 200Hz)… The results I have currently are around 20ms between two readings. I am wondering if this comes from a wrong register parameter or from something else (I2C bus parameter [which is currently working at 100kHz]) ?

Here below is my Python script (example for the LSM303D):

import commands
import datetime

 # Compass LSM303D (accelerometer and magnetometer)
print "Client started ..."

print "i2cdetect -r -y 1"
print commands.getoutput("i2cdetect -r -y 1")
print "Attempt to connect to the Compass..."
x = commands.getoutput("i2cget -y 1 0x1D 0x0F b")
if x == '0x49':
    print "Beagle Bone is connected with the Compass"
    print "Cannot connect to the Compass"
commands.getoutput("i2cset -y 1 0x1D 0x21 0x00 b") #CTRL2
# magnetic sensor into continuous mode from sleep mode
commands.getoutput("i2cset -y 1 0x1D 0x20 0x57 b") #CTRL1 0x57
# ctrl5 parameter 
commands.getoutput("i2cset -y 1 0x1D 0x24 0x64") #CTRL5
commands.getoutput("i2cset -y 1 0x1D 0x25 0x20") #CTRL6
commands.getoutput("i2cset -y 1 0x1D 0x26 0x00") #CTRL7
while True:
    time_1 =
    #read x-axis accelerometer
    x = commands.getoutput("i2cget -y 1 0x1D 0x28 b") #Low
    time_2 =
    print "int : "+str(time_2 - time_1)


Hello, vex73.

I suspect each of your readings is taking a long time due to the overhead of commands.getoutput(). Each time you take a reading, your program is starting a new i2cget process and waiting for it to complete and return its output.

You should be able to read the sensors much more frequently if you can work directly with I2C from your Python program. We do not have experience using I2C on the Beaglebone, but Adafruit has a Adafruit BeagleBone IO Python library with an I2C module that might work for you. Alternatively, you might be able to use the python-smbus module directly.

- Kevin

Hi Kevin,

Good catch! Didn’t think it could be so slow because of that, but makes sense now.

Works fine with the Adafruit library, got a reading > 1 kHz.