MMA8452Q Accelerometer

Developers looking for finer control over boards with the MMA8452Q accelerometer should use the MMA8452Q accelerometer interface. This sensor supports many of the same features as the Bosch accelerometers and is currently only on MetaWear R boards.

using MbientLab.MetaWear.Sensor;

IAccelerometerMma8452q accMma8452q = metawear.GetModule<IAccelerometerMma8452q>();

Configuration

Unlike the Bosch accelerometers, the MMA8452Q only has a max range of +/-8g and does not have a data rate over 1Khz.

using MbientLab.MetaWear.Sensor;
using MbientLab.MetaWear.Sensor.AccelerometerMma8452q;

// Set data rate to 12.5Hz
// Set range to +/-8g
accMma8452q.Configure(odr: OutputDataRate._12_5Hz, range: DataRange._8g);

Movement Detection

To be added later

Tap Detection

To be added later

Orientation Detection

The orientation detector alerts you when the sensor’s orientation changes between portrait/landscape and front/back. Data is represented as a SensorOrientation enum.

await accMma8452q.Orientation.AddRouteAsync(source => source.Stream(
    data => Console.WriteLine(data.Value<SensorOrientation>())
);
accMma8452q.Orientation.Start();
accMma8452q.Start();

Shake Detection

To be added later