

The Adafruit LIS331 (Manufacturer Part ID: 4626) is a high-performance 3-axis accelerometer designed to measure acceleration in three dimensions. It is capable of detecting both static acceleration (e.g., gravity) and dynamic acceleration (e.g., motion or vibration). The LIS331 is ideal for applications requiring precise motion sensing, such as robotics, wearable devices, gaming peripherals, and industrial equipment. Its compact size and digital output via I2C or SPI interfaces make it versatile and easy to integrate into a variety of projects.








The Adafruit LIS331 offers a range of features and specifications that make it suitable for a wide array of applications. Below are the key technical details:
The LIS331 is typically provided in a breakout board format by Adafruit, with the following pinout:
| Pin Name | Description |
|---|---|
| VIN | Power supply input (3.3V or 5V compatible). |
| GND | Ground connection. |
| SDA | I2C data line (connect to microcontroller's SDA pin). |
| SCL | I2C clock line (connect to microcontroller's SCL pin). |
| CS | Chip Select for SPI communication (active low). |
| SDO/SA0 | SPI Data Out or I2C address selection (connect to GND or VCC for I2C address). |
| INT1 | Interrupt 1 output (configurable for motion detection or other events). |
| INT2 | Interrupt 2 output (configurable for motion detection or other events). |
Below is an example of how to use the Adafruit LIS331 with an Arduino UNO via I2C:
#include <Wire.h>
#include <Adafruit_LIS331.h>
// Create an instance of the LIS331 class
Adafruit_LIS331 lis = Adafruit_LIS331();
void setup() {
Serial.begin(9600); // Initialize serial communication for debugging
while (!Serial) delay(10); // Wait for Serial to initialize (for boards like Leonardo)
// Initialize the LIS331 sensor
if (!lis.begin()) {
Serial.println("Failed to find LIS331 sensor! Check connections.");
while (1); // Halt execution if sensor is not found
}
Serial.println("LIS331 sensor initialized!");
// Set measurement range to ±4g
lis.setRange(LIS331_RANGE_4_G);
// Set output data rate to 100 Hz
lis.setDataRate(LIS331_DATARATE_100_HZ);
}
void loop() {
// Read acceleration data
sensors_event_t event;
lis.getEvent(&event);
// Print acceleration values
Serial.print("X: "); Serial.print(event.acceleration.x); Serial.print(" m/s^2 ");
Serial.print("Y: "); Serial.print(event.acceleration.y); Serial.print(" m/s^2 ");
Serial.print("Z: "); Serial.print(event.acceleration.z); Serial.println(" m/s^2");
delay(100); // Delay for readability
}
Sensor Not Detected:
No Data or Incorrect Readings:
Interrupts Not Triggering:
Q: Can the LIS331 operate at 5V logic levels?
A: The LIS331 operates at 3.3V logic levels. Use level shifters if your microcontroller uses 5V logic.
Q: How do I select between I2C and SPI?
A: The LIS331 automatically detects the communication protocol based on the connections. For I2C, connect SDA and SCL. For SPI, connect CS, SDO, and other SPI pins.
Q: What is the default I2C address of the LIS331?
A: The default I2C address is 0x18. You can change it to 0x19 by connecting the SDO/SA0 pin to VCC.
By following this documentation, you should be able to successfully integrate and use the Adafruit LIS331 in your projects.