Part

Six-axis IMU, LSM6DSOX

An accelerometer and a gyroscope at 12.5 Hz to 6.66 kHz over I2C, little-endian sixteen-bit outputs.

See every part
  • 6 pins
  • 4 settings
  • In 1 project
Drawn live by the editor's own code, at the size you see it.
Six-axis IMU, LSM6DSOX as drawn in the Mokxi simulator
At a glance

The Six-axis IMU, LSM6DSOX in brief

What it is, and every setting the properties panel gives it.

The ST LSM6DSOX is a six-axis inertial measurement unit. It reads acceleration and turn rate, sixteen bits each, over I2C at 0x6A, with data rates from 12.5 Hz to 6.66 kHz. It is the motion sensor on newer Adafruit and Arduino boards, with lower noise than the MPU6050 and a machine learning core of its own, which the model leaves out. Pins are VIN and GND for supply, SCL and SDA for I2C with the board carrying the pull-ups, and INT1 and INT2 left high-Z. Properties are the address, 0x6A or 0x6B, plus pitch, roll and heading sliders that tip and turn the board. The gyroscope reads a rate, so it moves only while a slider moves. The model leaves out the FIFO, embedded functions, interrupt pins, filters, noise and offsets. For 10 ms after power-on it boots and does not answer.

Family
Sensors
Pins
6
address
106
pitch
0
roll
0
heading
0
Pins

6 pins

Named as the editor names them, so a wire lands where you expect it.

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

How to use the LSM6DSOX accelerometer with an Arduino

The built-in project "Nine axes" shows this part wired to an Arduino Uno. An LSM6DSOX accelerometer and gyroscope sits beside an LIS3MDL magnetometer. Together they give pitch, turn rate and compass heading: the three things a drone or a head tracker needs. The project runs beside the words and opens in the editor as drawn.

Pitch comes from the accelerometer alone. The gyroscope reads turn rate only while the board is moving. Drag the pitch slider on the LSM6DSOX to tilt the board, and drag the heading slider on the LIS3MDL, plus the one on the LSM6DSOX, to see the gyro move.

With default settings, the serial monitor printed: "pitch 20 turn 0 dps heading 90". Pitch 20 comes from the default pitch slider, and the turn is 0 because the board is still.

After changing the pitch setting to 40, the serial monitor printed: "pitch 40 turn 0 dps heading 90". Only the pitch number changed, because the slider tipped the board while it stayed at rest.

Part pin
Goes to
SCL
Arduino Uno R3 pin SCL
SDA
Arduino Uno R3 pin SDA
GND
Arduino Uno R3 pin GND
VIN
5 V
Nine axeslive0.000 s 0.00x
Click to open it in the editor
This is the simulator itself, running here. Click anything to open it in the editor.
sketch.ino · Arduino Uno R3 · the first 45 lines
// Nine axes: an LSM6DSOX accelerometer and gyroscope with an LIS3MDL
// magnetometer beside it, the three sensors a drone or a head tracker
// needs: which way is down, how fast it turns, and which way is north.
//
//   LSM6DSOX   SDA -> SDA   SCL -> SCL
//   LIS3MDL    SDA -> A4    SCL -> A5
//
// Pitch comes from the accelerometer alone; the gyroscope reads the turn
// rate only while the board is moving.
//
// Things to try. Drag the pitch slider on the LSM6DSOX. Drag the heading
// slider on the LIS3MDL, and the one on the LSM6DSOX to see the gyro move.

#include <Adafruit_LSM6DSOX.h>
#include <Adafruit_LIS3MDL.h>

Adafruit_LSM6DSOX imu;
Adafruit_LIS3MDL mag;

void setup() {
  Serial.begin(9600);
  if (!imu.begin_I2C()) {
    Serial.println("No LSM6DSOX");
  }
  if (!mag.begin_I2C()) {
    Serial.println("No LIS3MDL");
  }
  Serial.println("Nine axes");
}

void loop() {
  delay(100);
  float ax, ay, az, gx, gy, gz;
  imu.readAcceleration(ax, ay, az);
  imu.readGyroscope(gx, gy, gz);
  sensors_event_t field;
  mag.getEvent(&field);
  float pitch = atan2(-ax, az) * 180 / PI;
  float heading = atan2(field.magnetic.y, field.magnetic.x) * 180 / PI;
  if (heading < 0) heading += 360;
  Serial.print("pitch ");
  Serial.print(pitch, 0);
  Serial.print("  turn ");
  Serial.print(gz, 0);
  Serial.print(" dps  heading ");
Common errors

Common Six-axis IMU, LSM6DSOX errors and fixes

What goes wrong
The fix
The sketch prints "No LSM6DSOX" and reads nothing.
Check the wiring: SCL to SCL, SDA to SDA, GND to GND, VIN to 5 V.
Both sensors read zeros.
Both sensors power up off. Write a data rate before reading, which begin_I2C and the Adafruit library handle for you.
The gyroscope never moves.
It reads a rate, so it is zero whenever the board is still. Drag a pitch or heading slider and the turn rate appears.
The chip does not answer right after power-on.
It boots for 10 ms after power-on. Wait a moment before talking to it.
Questions

Questions and answers

what is the lsm6dsox

It is a six-axis IMU from ST. It reads acceleration and turn rate, sixteen bits each, over I2C.

what is the lsm6dsox i2c address

The default is 0x6A. The address property can also be set to 0x6B.

lsm6dsox vs mpu6050

The LSM6DSOX has lower noise than the MPU6050. It also has a machine learning core, though the model does not include it.

why is my gyroscope reading zero

The gyroscope reads a turn rate, so it reads zero whenever the board is still. Drag the pitch or heading slider to move it.

How it is modeled

What is true about the Six-axis IMU, LSM6DSOX, here

In its help article’s own words: what the simulation gets right, and where it stops.

Not modeled

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

From LSM6DSOX accelerometer and gyroscope, in full.

Projects

See the Six-axis IMU, LSM6DSOX in a project

One built-in project uses it. It opens in the editor, already wired.

Boards

The boards it is shown on

This board has a built-in project with the Six-axis IMU, LSM6DSOX in it.

Wire up the Six-axis IMU, LSM6DSOX

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.