adafruit_mpu6050

CircuitPython helper library for the MPU6050 6-DoF Accelerometer and Gyroscope

  • Author(s): Bryan Siepert

Implementation Notes

Hardware: * Adafruit’s MPU6050 Breakout: https://adafruit.com/products/3886

Software and Dependencies:

class adafruit_mpu6050.Bandwidth

Allowed values for filter_bandwidth.

  • Bandwidth.BAND_260_HZ
  • Bandwidth.BAND_184_HZ
  • Bandwidth.BAND_94_HZ
  • Bandwidth.BAND_44_HZ
  • Bandwidth.BAND_21_HZ
  • Bandwidth.BAND_10_HZ
  • Bandwidth.BAND_5_HZ
class adafruit_mpu6050.GyroRange

Allowed values for gyro_range.

  • GyroRange.RANGE_250_DPS
  • GyroRange.RANGE_500_DPS
  • GyroRange.RANGE_1000_DPS
  • GyroRange.RANGE_2000_DPS
class adafruit_mpu6050.MPU6050(i2c_bus, address=104)

Driver for the MPU6050 6-DoF accelerometer and gyroscope.

Parameters:
  • i2c_bus (I2C) – The I2C bus the MPU6050 is connected to.
  • address – The I2C slave address of the sensor
acceleration

Acceleration X, Y, and Z axis data in m/s^2

accelerometer_range

The measurement range of all accelerometer axes. Must be a Range

cycle

Enable or disable perodic measurement at a rate set by cycle_rate. If the sensor was in sleep mode, it will be waken up to cycle

cycle_rate

The rate that measurements are taken while in cycle mode. Must be a Rate

filter_bandwidth

The bandwidth of the gyroscope Digital Low Pass Filter. Must be a GyroRange

gyro

Gyroscope X, Y, and Z axis data in º/s

gyro_range

The measurement range of all gyroscope axes. Must be a GyroRange

reset()

Reinitialize the sensor

sample_rate_divisor

The sample rate divisor. See the datasheet for additional detail

sleep

Shuts down the accelerometers and gyroscopes, saving power. No new data will be recorded until the sensor is taken out of sleep by setting to False

temperature

The current temperature in º C

class adafruit_mpu6050.Range

Allowed values for accelerometer_range.

  • Range.RANGE_2_G
  • Range.RANGE_4_G
  • Range.RANGE_8_G
  • Range.RANGE_16_G
class adafruit_mpu6050.Rate

Allowed values for cycle_rate.

  • Rate.CYCLE_1_25_HZ
  • Rate.CYCLE_5_HZ
  • Rate.CYCLE_20_HZ
  • Rate.CYCLE_40_HZ