Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use Adafruit_LIS331: Examples, Pinouts, and Specs

Image of Adafruit_LIS331
Cirkit Designer LogoDesign with Adafruit_LIS331 in Cirkit Designer

Introduction

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.

Explore Projects Built with Adafruit_LIS331

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Arduino UNO R4 WiFi and Adafruit LIS3DH Accelerometer-Based Motion Detection System
Image of circuit: A project utilizing Adafruit_LIS331 in a practical application
This circuit consists of an Arduino UNO R4 WiFi connected to an Adafruit LIS3DH Triple-Axis Accelerometer via I2C communication. The Arduino reads acceleration data from the LIS3DH sensor and outputs it to the serial monitor for further analysis or processing.
Cirkit Designer LogoOpen Project in Cirkit Designer
Teensy 4.1 Based Biometric Data Acquisition System with AD8232 Heart Rate Monitor and LIS3DH Accelerometer
Image of Teensy 4.1 accelerometer: A project utilizing Adafruit_LIS331 in a practical application
This circuit integrates a Teensy 4.1 microcontroller with an Adafruit LIS3DH Triple-Axis Accelerometer and an AD8232 Heart Rate Monitor. The accelerometer communicates with the Teensy via I2C (SCL and SDA lines), while the heart rate monitor's output and lead-off detection (LO+ and LO-) are connected to the Teensy's analog inputs. The circuit is designed to measure both acceleration and heart rate signals, likely for a wearable or health monitoring device.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino Mega 2560-Based Multi-Sensor System with Distance, Magnetometer, and Camera Integration
Image of Junior Design - Sensors: A project utilizing Adafruit_LIS331 in a practical application
This circuit features an Arduino Mega 2560 microcontroller interfaced with multiple VL53L0X distance sensors, an OV7725 camera module, and an Adafruit LIS3MDL triple-axis magnetometer. The Arduino reads data from these sensors and the camera, likely for a robotics or environmental sensing application, and processes the data for further use or transmission.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP32-C3 Mini Based Health Monitoring System with LiPo Battery Power
Image of pp 2: A project utilizing Adafruit_LIS331 in a practical application
This circuit is designed for health monitoring, featuring an ESP32-C3 Mini microcontroller that collects data from a MAX30102 heart rate and SpO2 sensor, and an Adafruit LSM303DLHC accelerometer and magnetometer. The system is powered by a 3.7V LiPo battery with a 3.3V regulator, and uses I2C communication with pull-up resistors for sensor interfacing.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with Adafruit_LIS331

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of circuit: A project utilizing Adafruit_LIS331 in a practical application
Arduino UNO R4 WiFi and Adafruit LIS3DH Accelerometer-Based Motion Detection System
This circuit consists of an Arduino UNO R4 WiFi connected to an Adafruit LIS3DH Triple-Axis Accelerometer via I2C communication. The Arduino reads acceleration data from the LIS3DH sensor and outputs it to the serial monitor for further analysis or processing.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Teensy 4.1 accelerometer: A project utilizing Adafruit_LIS331 in a practical application
Teensy 4.1 Based Biometric Data Acquisition System with AD8232 Heart Rate Monitor and LIS3DH Accelerometer
This circuit integrates a Teensy 4.1 microcontroller with an Adafruit LIS3DH Triple-Axis Accelerometer and an AD8232 Heart Rate Monitor. The accelerometer communicates with the Teensy via I2C (SCL and SDA lines), while the heart rate monitor's output and lead-off detection (LO+ and LO-) are connected to the Teensy's analog inputs. The circuit is designed to measure both acceleration and heart rate signals, likely for a wearable or health monitoring device.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Junior Design - Sensors: A project utilizing Adafruit_LIS331 in a practical application
Arduino Mega 2560-Based Multi-Sensor System with Distance, Magnetometer, and Camera Integration
This circuit features an Arduino Mega 2560 microcontroller interfaced with multiple VL53L0X distance sensors, an OV7725 camera module, and an Adafruit LIS3MDL triple-axis magnetometer. The Arduino reads data from these sensors and the camera, likely for a robotics or environmental sensing application, and processes the data for further use or transmission.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of pp 2: A project utilizing Adafruit_LIS331 in a practical application
ESP32-C3 Mini Based Health Monitoring System with LiPo Battery Power
This circuit is designed for health monitoring, featuring an ESP32-C3 Mini microcontroller that collects data from a MAX30102 heart rate and SpO2 sensor, and an Adafruit LSM303DLHC accelerometer and magnetometer. The system is powered by a 3.7V LiPo battery with a 3.3V regulator, and uses I2C communication with pull-up resistors for sensor interfacing.
Cirkit Designer LogoOpen Project in Cirkit Designer

Technical Specifications

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:

Key Features

  • Measurement Range: ±2g, ±4g, ±8g (selectable)
  • Output Data Rate (ODR): Up to 1 kHz
  • Interface: I2C (up to 400 kHz) and SPI (up to 10 MHz)
  • Supply Voltage: 2.16V to 3.6V
  • Current Consumption: 300 µA (typical in normal mode)
  • Operating Temperature: -40°C to +85°C
  • Resolution: 12-bit digital output
  • Interrupts: Configurable interrupt pins for motion detection

Pin Configuration and Descriptions

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).

Usage Instructions

How to Use the Adafruit LIS331 in a Circuit

  1. Power the Sensor: Connect the VIN pin to a 3.3V or 5V power source and GND to ground.
  2. Choose Communication Protocol:
    • For I2C: Connect SDA and SCL to the corresponding pins on your microcontroller. Use pull-up resistors (typically 4.7kΩ) if not already present on the breakout board.
    • For SPI: Connect CS, SDO, and other SPI pins to your microcontroller's SPI interface.
  3. Set the I2C Address: Use the SDO/SA0 pin to select the I2C address (0x18 or 0x19).
  4. Configure the Sensor: Use the appropriate library or write custom code to initialize the sensor, set the measurement range, and configure the output data rate.
  5. Read Data: Continuously read acceleration data from the sensor's registers via I2C or SPI.

Important Considerations and Best Practices

  • Voltage Compatibility: Ensure your microcontroller's logic levels are compatible with the LIS331 (3.3V logic). Use level shifters if necessary.
  • Interrupts: Configure the INT1 and INT2 pins for specific events, such as free-fall detection or motion thresholds, to reduce the need for constant polling.
  • Mounting: Secure the sensor to minimize vibrations or noise that could affect measurements.
  • Filtering: Use software filtering to smooth out noisy data if required.

Example Code for Arduino UNO (I2C)

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
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. Sensor Not Detected:

    • Ensure the I2C or SPI connections are correct.
    • Verify the I2C address (0x18 or 0x19) matches your configuration.
    • Check for loose wires or poor solder joints.
  2. No Data or Incorrect Readings:

    • Confirm the sensor is properly powered (check VIN and GND connections).
    • Verify the measurement range and data rate settings.
    • Ensure the sensor is mounted securely to avoid excessive vibrations.
  3. Interrupts Not Triggering:

    • Double-check the interrupt configuration in your code.
    • Verify the INT1/INT2 pins are connected to the correct microcontroller pins.

FAQs

  • 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.