Mpu6050

javadoc

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.

Examples:


#file : service/Mpu6050.py edit raw
#########################################
# Mpu6050.py
# more info @: http://myrobotlab.org/service/Mpu6050
#########################################
# port = "/dev/ttyUSB0"
port = "COM3"

mpu6050 = Runtime.createAndStart("Mpu6050","Mpu6050")
# start optional virtual arduino service, used for test
# virtual = True
if ('virtual' in globals() and virtual):
    virtualArduino = Runtime.start("virtualArduino", "VirtualArduino")
    virtualArduino.connect(port)
# end test
# raspi controler :
# raspi = Runtime.createAndStart("RasPi","RasPi")
arduino = Runtime.start("arduino","Arduino")
arduino.connect(port)

# mpu6050.attach(raspi,"1","0x68")
mpu6050.attach(arduino,"1","0x68")
mpu6050.refresh()
print mpu6050.filtered_x_angle
print mpu6050.filtered_y_angle
print mpu6050.filtered_z_angle