MPU6050 Sensor module
MPU6050 6-DoF Accelerometer and Gyro module for Micropython
|
Driver class for the MPU6050 sensor. More...
Classes | |
class | AccelRange |
Accelerometer measurement range. More... | |
class | FilterBandwidth |
Digital Low Pass Filter bandwidth. More... | |
class | GyroRange |
Gyroscope measurement range. More... |
Public Member Functions | |
__init__ (self, I2C i2c, int address=_MPU6050_DEFAULT_ADDR) | |
Initializes the MPU6050 sensor. | |
tuple[float, float, float] | get_accel_data (self, bool as_g=False) |
Reads and converts the accelerometer data. | |
dict | get_all_data (self) |
Reads all sensor data in a single, efficient transaction. | |
tuple[float, float, float] | get_gyro_data (self) |
Reads and converts the gyroscope data in degrees per second. | |
float | get_temp_data (self) |
Reads and converts the temperature data. | |
reset (self) | |
Resets sensor registers to their default values. | |
set_accel_range (self, int accel_range) | |
Sets the accelerometer measurement range. | |
set_filter_bandwidth (self, int bandwidth) | |
Sets the Digital Low-Pass Filter bandwidth. | |
set_gyro_range (self, int gyro_range) | |
Sets the gyroscope measurement range. |
Public Attributes | |
address = address | |
i2c = i2c |
Protected Member Functions | |
bytes | _read_bytes (self, int register, int length) |
int | _read_u8 (self, int register) |
_write_u8 (self, int register, int value) |
Protected Attributes | |
_accel_range = self.AccelRange.RANGE_2_G | |
_gyro_range = self.GyroRange.RANGE_250_DEG |
Static Protected Attributes | |
dict | _ACCEL_SCALES |
dict | _GYRO_SCALES |
Driver class for the MPU6050 sensor.
Allows reading of acceleration, gyroscope, and temperature data.
__init__ | ( | self, | |
I2C | i2c, | ||
int | address = _MPU6050_DEFAULT_ADDR ) |
Initializes the MPU6050 sensor.
i2c | The Micropython I2C object. |
address | The I2C address of the sensor (default is 0x68). |
|
protected |
|
protected |
|
protected |
tuple[float, float, float] get_accel_data | ( | self, | |
bool | as_g = False ) |
Reads and converts the accelerometer data.
as_g | If True, returns values in 'g'. Otherwise, returns in m/s^2 (default). |
dict get_all_data | ( | self | ) |
Reads all sensor data in a single, efficient transaction.
tuple[float, float, float] get_gyro_data | ( | self | ) |
Reads and converts the gyroscope data in degrees per second.
float get_temp_data | ( | self | ) |
Reads and converts the temperature data.
reset | ( | self | ) |
Resets sensor registers to their default values.
set_accel_range | ( | self, | |
int | accel_range ) |
Sets the accelerometer measurement range.
accel_range | Use constants from MPU6050.AccelRange. |
set_filter_bandwidth | ( | self, | |
int | bandwidth ) |
Sets the Digital Low-Pass Filter bandwidth.
bandwidth | Use constants from MPU6050.FilterBandwidth. |
set_gyro_range | ( | self, | |
int | gyro_range ) |
Sets the gyroscope measurement range.
gyro_range | Use constants from MPU6050.GyroRange. |
|
protected |
|
staticprotected |
|
protected |
|
staticprotected |
address = address |
i2c = i2c |