Accelerometer Advanced Usage
Raw And Translated Data
Raw and translated acceleration datas are available. Calling mpu925x_get_acceleration
function also calls mpu925x_get_acceleration_raw
function internally. Both functions stores data in given mpu925x_t
struct.
Full-Scale Select
One can set accelerometer full-scale range of 2g, 4g, 8g and 16g.
-
void mpu925x_set_accelerometer_scale(mpu925x_t *mpu925x, mpu925x_accelerometer_scale scale)
Set accelerometer full-scale range.
- Parameters
mpu925x – MPU-925X struct pointer.
scale – Accelerometer full-scale range to be set.
Digital Low Pass Filter
One can enable hardware digital low pass filter. Look datasheet for more info.
Offset Cancellation
Offset cancellation consist 2 steps: Getting and setting offset cancellation values. While getting offset cancellation values, sensor must stand still. Also orientation of sensor is very important. Set orientation of sensor with .sensor_settings.orientation
variable in mpu925x_t
struct.
-
enum mpu925x_orientation
Orientation of the sensor.
Values:
-
enumerator mpu925x_x_plus
-
enumerator mpu925x_x_minus
-
enumerator mpu925x_y_plus
-
enumerator mpu925x_y_minus
-
enumerator mpu925x_z_plus
-
enumerator mpu925x_z_minus
-
enumerator mpu925x_x_plus
-
void mpu925x_get_accelerometer_offset(mpu925x_t *mpu925x, uint16_t sampling_amount, int16_t *offset)
Get accelerometer offset cancellation value.
- Parameters
mpu925x – MPU-925X struct pointer.
sampling_amount – Sampling amount for acceleration values.
offset – 3d array which will hold accelerometer offset cancellation values.
-
void mpu925x_set_accelerometer_offset(mpu925x_t *mpu925x, int16_t *offset)
Set accelerometer offset cancellation value.
- Parameters
mpu925x – MPU-925X struct pointer.
offset – 3d array which holds accelerometer offset cancellation values.
One can use these two methods to get and set offset values or call one unified function which does 2 of them at once.
-
void mpu925x_accelerometer_offset_cancellation(mpu925x_t *mpu925x, uint16_t sampling_amount)
Get and set accelerometer offset cancellation values.
See also
mpu925x_get_accelerometer_offset
See also
mpu925x_set_accelerometer_offset
- Parameters
mpu925x – MPU-925X struct pointer.
sampling_amount – Sampling amount for acceleration values.
mpu925x.settings.orientation = mpu925x_y_plus; // Depends on how sensor is mounted.
// Sensor must stand still while offset cancellation.
mpu925x_accelerometer_offset_cancellation(&mpu925x, 200);