The Adafruit LSM9DS1 9DoF Breakout with Stemma QT connectors is a versatile, all-in-one sensor module that provides motion, orientation, and magnetic readings. This breakout board combines a 3-axis accelerometer, a 3-axis gyroscope, and a 3-axis magnetometer onto a single board, offering nine degrees of freedom (9DoF) for comprehensive motion and orientation data. It is ideal for applications in robotics, wearable devices, motion tracking, and any project where you need to measure movement, orientation, or magnetic fields.
Pin Number | Name | Description |
---|---|---|
1 | VIN | Supply voltage input (2.4V to 3.6V) |
2 | 3Vo | 3.3V output from the voltage regulator |
3 | GND | Ground connection |
4 | SCL | I2C clock (also SPI SCL) |
5 | SDA | I2C data (also SPI SDA) |
6 | SDO/SA0 | SPI data output (also I2C SA0) |
7 | CSAG | Chip select for the accelerometer and gyroscope |
8 | CSM | Chip select for the magnetometer |
9 | SDA1 | Secondary I2C data (for Stemma QT connector) |
10 | SCL1 | Secondary I2C clock (for Stemma QT connector) |
To use the LSM9DS1 breakout in a circuit:
Below is an example of how to interface the LSM9DS1 with an Arduino UNO using I2C:
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_LSM9DS1.h>
// Create an instance of the LSM9DS1 class
Adafruit_LSM9DS1 lsm = Adafruit_LSM9DS1();
void setup() {
Serial.begin(115200);
// Initialize the sensor
if (!lsm.begin()) {
Serial.println("Failed to initialize LSM9DS1. Check your wiring!");
while (1);
}
// Configure the sensor
lsm.setupAccel(lsm.LSM9DS1_ACCELRANGE_2G);
lsm.setupMag(lsm.LSM9DS1_MAGGAIN_4GAUSS);
lsm.setupGyro(lsm.LSM9DS1_GYROSCALE_245DPS);
}
void loop() {
// Read the sensor
lsm.read();
// Print accelerometer data
Serial.print("Accel X: "); Serial.print(lsm.accelData.x); Serial.print(" ");
Serial.print("Y: "); Serial.print(lsm.accelData.y); Serial.print(" ");
Serial.print("Z: "); Serial.println(lsm.accelData.z);
// Print gyroscope data
Serial.print("Gyro X: "); Serial.print(lsm.gyroData.x); Serial.print(" ");
Serial.print("Y: "); Serial.print(lsm.gyroData.y); Serial.print(" ");
Serial.print("Z: "); Serial.println(lsm.gyroData.z);
// Print magnetometer data
Serial.print("Mag X: "); Serial.print(lsm.magData.x); Serial.print(" ");
Serial.print("Y: "); Serial.print(lsm.magData.y); Serial.print(" ");
Serial.print("Z: "); Serial.println(lsm.magData.z);
// Delay before the next reading
delay(1000);
}
This code initializes the LSM9DS1 sensor and configures its accelerometer, magnetometer, and gyroscope with basic settings. It then reads the sensor data and prints it to the Serial Monitor.
Q: Can I use this sensor with a 5V microcontroller? A: Yes, but ensure that the logic level for the I2C or SPI communication is within the sensor's specified range (1.8V to 3.6V).
Q: How do I change the I2C address? A: The I2C address can be changed by connecting the SDO/SA0 pin to either ground or VDD.
Q: Can I use multiple LSM9DS1 sensors on the same I2C bus? A: Yes, you can use multiple sensors by assigning different I2C addresses to each sensor using the SDO/SA0 pin.
For further assistance, consult the Adafruit LSM9DS1 datasheet and the Adafruit support forums.