LSM6DSOX accelerometer and gyroscope

The ST LSM6DSOX six-axis IMU reads acceleration and turn rate, sixteen bits each, over I2C at 0x6A, from 12.5 Hz to 6.66 kHz.

Aliases: LSM6DS, LSM6DS33, LSM6DSO, Adafruit LSM6DSOX, six-axis IMU. It is the motion sensor of the newer Adafruit and Arduino boards: lower noise than the MPU6050 and a machine learning core of its own, which the model leaves out.

Pins

Pin What it does
VIN, GND Supply, 3 to 5 V on the board.
SCL, SDA I2C. The board carries the pull-ups.
INT1, INT2 Interrupts, left high-Z by the model.

Properties

address is 0x6A or 0x6B. pitch, roll and heading are how the board sits; the three sliders tip and turn it, and the gyroscope reads the rate while a slider moves.

Reading it on an Arduino

With Adafruit's library, which Mokxi ships as Adafruit_LSM6DSOX.h:

#include <Adafruit_LSM6DSOX.h>
Adafruit_LSM6DSOX sox;

void setup() {
  Serial.begin(9600);
  sox.begin_I2C();
}

void loop() {
  sensors_event_t accel, gyro, temp;
  sox.getEvent(&accel, &gyro, &temp);
  Serial.println(accel.acceleration.z);   // 9.81 flat on the bench
  delay(200);
}

How it talks

WHO_AM_I (0x0F) reads 0x6C. CTRL1_XL (0x10) and CTRL2_G (0x11) set each sensor's data rate (zero is off, the reset) and range; CTRL3_C (0x12) has the reset bits and IF_INC, which steps the address. At each sample STATUS_REG (0x1E) flags new data, and the outputs follow: the temperature at 0x20, the gyroscope at 0x22 and the accelerometer at 0x28, low byte first. For 10 ms after power-on it boots and does not answer.

What it does not model

The FIFO, the embedded functions (pedometer, tap, tilt, the machine learning core), the interrupt pins, filters, noise and offsets.

Common mistakes

Reading zeros: both sensors power up off until a data rate is written. Reading a gyroscope that never moves: it reads a rate, so it is zero whenever the board is still.