This part has a page of its own, with a note on using it and a circuit to try: the part page.
Alias: LSM6DS, LSM6DS33, LSM6DSO, Adafruit LSM6DSOX, IMU de seis ejes. Es el sensor de movimiento de las placas más recientes de Adafruit y Arduino: menos ruido que el MPU6050 y un núcleo de aprendizaje automático propio, que el modelo omite.
Pins
| Pin | Qué hace |
|---|---|
VIN, GND |
Alimentación, de 3 a 5 V en la placa. |
SCL, SDA |
I2C. La placa incluye las resistencias pull-up. |
INT1, INT2 |
Interrupciones, dejadas en alta impedancia por el modelo. |
Propiedades
address es 0x6A o 0x6B. pitch, roll y heading indican cómo está colocada la placa; los tres deslizadores la inclinan y giran, y el giroscopio lee la velocidad mientras se mueve un deslizador.
Leerlo en un Arduino
Con la biblioteca de Adafruit, que Mokxi incluye como 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);
}
Cómo se comunica
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.
Lo que no modela
El FIFO, las funciones integradas (podómetro, toque, inclinación, el núcleo de aprendizaje automático), los pines de interrupción, filtros, ruido y 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.