三轴加速度计

产品简介

DFRobot超低功耗3轴加速度传感器,采用MEMS LIS2DH芯片解决方案,支持高性能超低功耗工作模式。模块使用Gravity I2C接口设计,上手简单,即插即用。内置LDO电源管理芯片,支持3.3~5V宽电压供电,并且板载I2C电平转换,兼容Arduino 3.3V以及5V主控器。 LIS2DH加速度计相对传统的ADXL345在稳定性以及功耗上都有一定的优化,低功耗模式下仅为2μA(普通模式11μA),并且最高支持5.3KHz输出频率,拥有±2g/±4g/±8g/±16g四档可选量程,支持16位数据输出。传感器内置2个独立的可编程中断发生器的自由落体和运动检测,能够实现低功耗下自动检测,实现中断唤醒。可以广泛应用于各类可穿戴设备的原型设计中。

技术规格

应用

引脚说明

LIS2DH Arduino
VCC 5V / 3V3
GND GND
SDA IIC数据
SCL IIC时钟
INT1 中断1
INT2 中断2

注意:V1.0版本有一处设计错误:INT1和INT2丝印标注与实际电气连接是相反的,后续版本的产品已修正了该错误。

连线图

Arduino LIS2DH 三轴加速度传感器

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

样例代码

/**!
 * @file getAcceleration.ino
 * @brief Get the acceleration in the three directions of xyz, the range can be ±2g、±4g、±8g、±16g
 * @copyright  Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
 * @license     The MIT License (MIT)
 * @author [tangjie](jie.tang@dfrobot.com)
 * @version  V1.0
 * @date  2021-01-16
 * @url https://github.com/DFRobot/DFRobot_LIS
 */

#include <DFRobot_LIS2DH12.h>

/*!
 * @brief Constructor 
 * @param pWire I2c controller
 * @param addr  I2C address(0x18/0x19)
 */
DFRobot_LIS2DH12 acce(&Wire,0x18);

void setup(void){

  Serial.begin(9600);
  //Chip initialization
  while(!acce.begin()){
     Serial.println("Initialization failed, please check the connection and I2C address settings");
     delay(1000);
  }
  //Get chip id
  Serial.print("chip id : ");
  Serial.println(acce.getID(),HEX);

  /**
    set range:Range(g)
              eLIS2DH12_2g,/< ±2g>/
              eLIS2DH12_4g,/< ±4g>/
              eLIS2DH12_8g,/< ±8g>/
              eLIS2DH12_16g,/< ±16g>/
  */
  acce.setRange(/*Range = */DFRobot_LIS2DH12::eLIS2DH12_16g);

  /**
    Set data measurement rate:
      ePowerDown_0Hz 
      eLowPower_1Hz 
      eLowPower_10Hz 
      eLowPower_25Hz 
      eLowPower_50Hz 
      eLowPower_100Hz
      eLowPower_200Hz
      eLowPower_400Hz
  */
  acce.setAcquireRate(/*Rate = */DFRobot_LIS2DH12::eLowPower_10Hz);
  Serial.print("Acceleration:\n");
  delay(1000);
}

void loop(void){

  //Get the acceleration in the three directions of xyz
  long ax,ay,az;
  //The measurement range can be ±100g or ±200g set by the setRange() function
  ax = acce.readAccX();//Get the acceleration in the x direction
  ay = acce.readAccY();//Get the acceleration in the y direction
  az = acce.readAccZ();//Get the acceleration in the z direction
  //Print acceleration
  Serial.print("Acceleration x: ");
  Serial.print(ax);
  Serial.print(" mg\t  y: ");
  Serial.print(ay);
  Serial.print(" mg\t  z: ");
  Serial.print(az);
  Serial.println(" mg");
  delay(300);

}

SEN0032 Diagram

Mind+(基于Scratch3.0)图形化编程

  1. 下载及安装软件。下载地址:https://www.mindplus.cc 详细教程:Mind+基础wiki教程-软件下载安装

  2. 切换到“上传模式”。 详细教程:Mind+基础wiki教程-上传模式编程流程

  3. “扩展”中选择“主控板”中的“Arduino Uno”。 "扩展"“传感器”中搜索选择“LIS2DH三轴加速度计”。详细教程:Mind+基础wiki教程-加载扩展库流程

  4. 进行编程,程序如下图:

  5. 菜单“连接设备”,“上传到设备”

  6. 程序上传完毕后,打开串口即可看到数据输出。详细教程:Mind+基础wiki教程-串口打印

常见问题

还没有客户对此产品有任何问题,欢迎通过qq或者论坛联系我们!

更多问题及有趣的应用,可以 访问论坛 进行查阅或发帖。

更多资料

DFshopping_car1.png Link DFRobot商城购买链接