Javadoc link

 

MPU6050 is a service for Accelerometer and Gyro. Several different boards exists that has the MPU-6050 circuit. Different boards can be found at the Arduino site http://playground.arduino.cc/Main/MPU-6050. The board that has been used for testing on both Arduino and Raspberry Pi is the GY-521 board. 

MPU-6050 can deliver data as raw Gyro and Accelerometer values. It also has a built in DMP ( Digital Motoion Processor ). The MPU6050 currently uses the raw values and a Complementary filter to deliver filtered values. It also has the base for the DMP code, based on the reverse enginering and libraries made by Jeff Rowberg. But it still needs some testing and changing.

It has been tested with both Arduino and Raspberry PI.

Here's the same Mpu6050 service running on an Arduino mega

Script generates the following

Example code (from branch develop):
#file : Mpu6050.py (github)
#########################################
# Mpu6050.py
# more info @: http://myrobotlab.org/service/Mpu6050
#########################################
port = '/dev/ttyACM0'
# port = 'COM5'
 
mpu6050 = runtime.start('mpu6050','Mpu6050')
mpu6050.setDeviceBus('0') # When using the Arduino, we must use bus 0, on the Raspberry Pi use Bus 1
mpu6050.setDeviceAddress('0x68')
mpu6050.setSampleRate(10) # in Hz default is 3Hz
 
# end test
# raspi controler :
# raspi = runtime.start('RasPi','RasPi')
mega = runtime.start('mega','Arduino')
mega.connect(port)
 
sleep(3)
 
# mpu6050.attach(raspi,'1','0x68')
mpu6050.attach(mega)
 
# for simple orientation
python.subscribe('mpu6050', 'publishOrientation')
 
# for "all" the data !
python.subscribe('mpu6050', 'publishMpu6050Data')
 
def onOrientation(data):
    print(data)
 
def onMpu6050Data(data):
    print(data)
 
# tell refresh the current mpu data.
mpu6050.start()
Example configuration (from branch develop):
#file : Mpu6050.py (github)
!!org.myrobotlab.service.config.Mpu6050Config
address: null
bus: null
controller: null
listeners: null
peers: null
sampleRate: null
start: false
type: Mpu6050