Any library available for the BBB, to use MPU-6050 and ADXL335 ?

Hi all

I am learning how to use I2C, and I choose to use a gyro and an accelerometer sensor, for my project.

The gyro is the MPU-6050, while the accelerometer is the ADXL335

I have the data sheet; but I don’t see any code example that show how to get the data and process it. Is there a library already available for the BBB by any chance, for these 2 sensor?

I am not sure if others here use these sensor, but I was told that these are the most common ones; but the only thing that pops up in a search is related to the arduino.

Any pointer is more than welcome; Ideally I would like to write code in C++, to drive an application that process the data; and having a library that would interface with the device would save me time to write one (unless necessary; why re-invent the wheel if this has been already done?)

Thanks in advance and sorry for the newbie question…If there was a book showing how to do it, I would gladly buy it and study it.

Hi Karl,

I’m (quite) in the same approach as you do currently with a slightly difference coming that I learn Xenomai for this too -Thanks Charles btw- and use ADXL 335 and Invensense 9150.
For ADXL 335 -it’s analog not I2C right ?- you could 1st test it with the provided script : http://beagleboard.org/Support/BoneScript/accelerometer/
For invensense you are lucky as it’s more supported than 9150 : http://www.i2cdevlib.com/devices/mpu6050#source .
Anyway there are quite close so for C/C++ code you have things like this that are great : https://github.com/Pansenti/linux-mpu9150

Hope this helps.

David

Much appreciated David!

So the 9150 code can be used also for the 6050? I am not familiar with that sensor, but it sounds like it is the previous version of the 6150?

The ADXL335 should be I2C compliant; at least that’s what I was told, when I purchased it. The example that you posted is in the internal scripting language for cloud9, correct? I am not familiar with that…I know only C and C++, so I am not sure how can I use that to drive a C++ program on the BBB.

Thanks for the info, I have something to start to study at least :slight_smile:

You can find code for MPU-6050 and other sensors in MultiWii project
http://code.google.com/p/multiwii/downloads/list
Look for sensors.cpp or sensors.ino in version 2_2 MPU-6050 realy works.