Introduction

DFRobot presents the ultra low-power Arduino triple axis accelerometer! This device is based around a MEMS LIS2DH chip solution and has high-performance ultra-low power mode. The module is fitted with a Gravity I2C interface for easy plug and play integration in to your projects. The build in LDO power management chip gives you a wide range of input voltages, from 3.3 – 5V. The on-board I2C level conversion also makes it compatible with 3.3 and 5V devices. Compared to traditional ADXL345, The LIS2DH accelerometer has advantages such as extra stability and more efficient power consumption. Low power mode requires only 2μA, while normal mode requires 11μA. At maximum the module supports an output frequency of 5.3KHz. Sensitivity levels are adjustable to either +-2g, +-4g, +-8g or +-16g and the module supports 16-bit data outputs. There are 2 independent programmable interrupt generators for free-fall and motion detection, that will activate interrupt wake-up. This module has many potential applications including wearable tech, display orientation and impact recognition.

Application

Features

Specification

Tutorial

In this tutorial, we'll show you how does the sensor work.

Requirements

Connection Diagram

Arduino LIS2DH 3 Axis Accelerometer

LIS2DH Arduino
VCC 5V / 3V3
GND GND
SDA A4(SDA)
SCL A5(SCL)

Sample Code

Click to download Arduino LIS2DH Library How to install Libraries in Arduino IDE

/*!
 * @file testLIS2DH12.ino
 * @brief DFRobot's Read LIS2DH12 data
 * @n This example is in order to achieve the serial port to receive LIS2DH12 back to the data
 *
 * @copyright   [DFRobot](http://www.dfrobot.com), 2016
 * @copyright   GNU Lesser General Public License
 * @author [Wuxiao](xiao.wu@dfrobot.com)
 * @version  V1.0
 * @date  2016-10-13
 * @https://github.com/DFRobot/DFRobot_LIS2DH12
 */

#include <Wire.h>
#include <DFRobot_LIS2DH12.h>


DFRobot_LIS2DH12 LIS; //Accelerometer

void setup(){
  Wire.begin();
  Serial.begin(115200);
  while(!Serial);
  delay(100);

  // Set measurement range
  // Ga: LIS2DH12_RANGE_2GA
  // Ga: LIS2DH12_RANGE_4GA
  // Ga: LIS2DH12_RANGE_8GA
  // Ga: LIS2DH12_RANGE_16GA
  while(LIS.init(LIS2DH12_RANGE_16GA) == -1){  //Equipment connection exception or I2C address error
    Serial.println("No I2C devices found");
    delay(1000);
  }
}

void loop(){
  acceleration();
}

/*!
 *  @brief Print the position result.
 */
void acceleration(void)
{
  int16_t x, y, z;

  delay(100);
  LIS.readXYZ(x, y, z);
  LIS.mgScale(x, y, z);
  Serial.print("Acceleration x: "); //print acceleration
  Serial.print(x);
  Serial.print(" mg \ty: ");
  Serial.print(y);
  Serial.print(" mg \tz: ");
  Serial.print(z);
  Serial.println(" mg");
}

Expected Results

Open the Serial monitor, you'll get the following data.
SEN0224_Accekeration_data.png

FAQ

For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More

DFshopping_car1.png Shopping from Gravity: I2C Triple Axis Accelerometer - LIS2DH or DFRobot Distributor.

Turn to the Top