Mpu9250 Class

Definition

MPU9250 - gyroscope, accelerometer, temperature and magnetometer (thru an embedded AK8963).

public class Mpu9250 : Iot.Device.Imu.Mpu6500
[System.Device.Model.Interface("MPU9250 - gyroscope, accelerometer, temperature and magnetometer (thru an embedded AK8963)")]
public class Mpu9250 : Iot.Device.Imu.Mpu6500
type Mpu9250 = class
    inherit Mpu6500
[<System.Device.Model.Interface("MPU9250 - gyroscope, accelerometer, temperature and magnetometer (thru an embedded AK8963)")>]
type Mpu9250 = class
    inherit Mpu6500
Public Class Mpu9250
Inherits Mpu6500
Inheritance
Mpu9250
Inheritance
Attributes

Constructors

Mpu9250(I2cDevice, Boolean)

Initialize the MPU9250

Mpu9250(I2cDevice, Boolean, I2cDevice)

Initialize the MPU9250

Fields

DefaultI2cAddress

Default address for MPU9250

(Inherited from Mpu6500)
SecondI2cAddress

Second address for MPU9250

(Inherited from Mpu6500)

Properties

AccelerationScale

Get the real accelerometer bandwidth. This allows to calculate the real degree per second

(Inherited from Mpu6500)
AccelerometerBandwidth

Get or set the accelerometer bandwidth

(Inherited from Mpu6500)
AccelerometerBias

Accelerometer bias data

(Inherited from Mpu6500)
AccelerometerLowPowerFrequency

Set or get the accelerometer low power mode

(Inherited from Mpu6500)
AccelerometerRange

Get or set the accelerometer range

(Inherited from Mpu6500)
DisableModes

Get or set the elements to disable. It can be any axes of the accelerometer and or the gyroscope

(Inherited from Mpu6500)
FifoCount

Get the number of elements to read from the FIFO (First In First Out) buffer

(Inherited from Mpu6500)
FifoModes

Get or set the FIFO (First In First Out) modes

(Inherited from Mpu6500)
GyroscopeBandwidth

Get or set the gyroscope bandwidth

(Inherited from Mpu6500)
GyroscopeBias

Gyroscope bias data

(Inherited from Mpu6500)
GyroscopeRange

Get or set the gyroscope range

(Inherited from Mpu6500)
GyroscopeScale

Get the real gyroscope bandwidth. This allows to calculate the real angular rate in degree per second

(Inherited from Mpu6500)
HasDataToRead

True if there is a data to read

MagnetometerAdjustment

Get the magnetometer hardware adjustment bias

MagnetometerMeasurementMode

Select the magnetometer measurement mode

MagnetometerOutputBitMode

Select the magnetometer output bit rate

MagnometerBias

Get the magnetometer bias

SampleRateDivider

Get or set the sample diver mode

(Inherited from Mpu6500)

Methods

CalibrateGyroscopeAccelerometer()

Perform full calibration the gyroscope and the accelerometer It will automatically adjust as well the offset stored in the device The result bias will be stored in the AcceloremeterBias and GyroscopeBias

(Inherited from Mpu6500)
CalibrateMagnetometer(Int32)

Calibrate the magnetometer. Make sure your sensor is as far as possible of magnet. Move your sensor in all direction to make sure it will get enough data in all points of space Calculate as well the magnetometer bias

Dispose()

Cleanup everything

GetAccelerometer()

Get the accelerometer in G

(Inherited from Mpu6500)
GetGyroscopeReading()

Get the gyroscope in degrees per seconds

(Inherited from Mpu6500)
GetMagnetometerVersion()

Check if the magnetometer version is the correct one (0x48)

GetTemperature()

Get the temperature

(Inherited from Mpu6500)
ReadByteFromReplicaDevice(I2cChannel, Byte, Byte, Span<Byte>)

Read data from any of the I2C replica attached to the MPU9250

(Inherited from Mpu6500)
ReadByteFromSlaveDevice(I2cChannel, Byte, Byte, Span<Byte>)

Read data from any of the I2C slave attached to the MPU9250

(Inherited from Mpu6500)
ReadFifo(Span<Byte>)

Read data in the FIFO (First In First Out) buffer, read as many data as the size of readData byte span You should read the number of data available in the FifoCount property then read them here. You will read only data you have selected in FifoModes. Data are in the order of the Register from 0x3B to 0x60. ACCEL_XOUT_H and ACCEL_XOUT_L ACCEL_YOUT_H and ACCEL_YOUT_L ACCEL_ZOUT_H and ACCEL_ZOUT_L TEMP_OUT_H and TEMP_OUT_L GYRO_XOUT_H and GYRO_XOUT_L GYRO_YOUT_H and GYRO_YOUT_L GYRO_ZOUT_H and GYRO_ZOUT_L EXT_SENS_DATA_00 to EXT_SENS_DATA_24

(Inherited from Mpu6500)
ReadMagnetometer(Boolean)

Read the magnetometer with bias correction and can wait for new data to be present

ReadMagnetometerWithoutCorrection(Boolean)

Read the magnetometer without bias correction and can wait for new data to be present

RunGyroscopeAccelerometerSelfTest()

Run a self test and returns the gyroscope and accelerometer vectores a. If factory Self-Test values ST_OTP≠0, compare the current Self-Test response (GXST, GYST, GZST, AXST, AYST and AZST) to the factory Self-Test values (ST_OTP) and report Self-Test is passing if all the following criteria are fulfilled: Axis | Pass criteria X-gyro | (GXST / GXST_OTP) > 0.5 Y-gyro | (GYST / GYST_OTP) > 0.5 Z-gyro | (GZST / GZST_OTP) > 0.5 X-Accel | 0.5 < (AXST / AXST_OTP) < 1.5 Y-Accel | 0.5 < (AYST / AYST_OTP) < 1.5 Z-Accel | 0.5 < (AZST / AZST_OTP) < 1.5 b. If factory Self-Test values ST_OTP=0, compare the current Self-Test response (GXST, GYST, GZST, AXST, AYST and AZST) to the ST absolute limits (ST_AL) and report Self-Test is passing if all the following criteria are fulfilled. Axis | Pass criteria X-gyro | |GXST| ≥ 60dps Y-gyro | |GYST| ≥ 60dps Z-gyro | |GZST| ≥ 60dps X-Accel| 225mgee ≤ |AXST| ≤ 675mgee Y-Accel| 225mgee ≤ |AXST| ≤ 675mgee Z-Accel| 225mgee ≤ |AXST| ≤ 675mgee c. If the Self-Test passes criteria (a) and (b), it’s necessary to check gyro offset values. Report passing Self-Test if the following criteria fulfilled. Axis | Pass criteria X-gyro | |GXOFFSET| ≤ 20dps Y-gyro | |GYOFFSET| ≤ 20dps Z-gyro | |GZOFFSET| ≤ 20dps

(Inherited from Mpu6500)
SetWakeOnMotion(UInt32, AccelerometerLowPowerFrequency)

Setup the Wake On Motion. This mode generate a rising signal on pin INT You can catch it with a normal GPIO and place an interruption on it if supported Reading the sensor won't give any value until it wakes up periodically Only Accelerator data is available in this mode

WriteByteToReplicaDevice(I2cChannel, Byte, Byte, Byte)

Write data on any of the I2C replica attached to the MPU9250

(Inherited from Mpu6500)
WriteByteToSlaveDevice(I2cChannel, Byte, Byte, Byte)

Write data on any of the I2C slave attached to the MPU9250

(Inherited from Mpu6500)

Applies to