DFROBOT SEN0405 LIS2DW12 三轴加速度计 产品资料 使用教程 |
您所在的位置:网站首页 › jeep多轴加速传感器 › DFROBOT SEN0405 LIS2DW12 三轴加速度计 产品资料 使用教程 |
LIS2DW12三轴加速度计是一款超低功耗的线性加速度计,该传感器拥有两个独立的可编程中断及专用内部引擎,可实现超多功能,例如自由落体检测、纵向/横向检测、朝向(6D/4D)检测、可配置的单击/双击识别、运动检测、运动唤醒以实现高级省电等,我们为您提供了以上功能的示例程序,方便您在项目中轻松使用。 该传感器具有±2g /±4g /±8g /±16g的用户可选全刻度,并能够以1.6 Hz至1600 Hz的输出数据速率测量加速度,它内置多种带宽的多种运行模式,您可以按需选择合适的模式。 特性 可选量程:±2g /±4g /±8g /±16g 16位数据输出 两个独立的可编程中断 专用的内部引擎以实现丰富功能:自由落体检测、纵向/横向检测、6D/4D检测、可配置的单击/双击识别、运动检测、运动唤醒以实现高级省电等 技术规格![]()
注意: 所有数据输出电压均为3.3V micro:bit(v1.5版本)的I2C地址与传感器I2C地址0x19冲突,所以请选择0x18 将SDO引脚拉低可切换I2C地址为:0x18不同通信方式连线提示: - I2C:0x19(默认) - I2C:0x18 - SPI - 中断引脚连接 主板 默认连接引脚 UNO/MEGA2560 D2 Leonardo D3 Micro:bit P0 ESP32/ESP8266/ARDUINO_SAM_ZERO D6 Raspberry Pi GPIO25 M0使用教程请按接线图所示将传感器与M0(或其它主板)相连接即可。 关于如何安装库文件,点击链接 关于如何使用Firebeetle Board-M0,点击链接 样例代码 样例代码1-读取x,y,z轴加速度(getAcceleration.ino) 样例代码2-睡眠唤醒功能(wakeUp.ino) 样例代码3-敲击检测功能(tap.ino) 样例代码4-敲击中断功能(tapInterrupt.ino) 样例代码5-自由落体检测功能(freeFall.ino) 样例代码6-自由落体中断功能(freeFallInterrupt.ino) 样例代码7-运动检测功能(activityDetect.ino) 样例代码8-朝向检测功能(orientation.ino)主要API接口函数列表 DFRobot_LIS(); /** * @brief Initialize the function * @return true(Succeed)/false(Failed) */ bool begin(void); /** * @brief Get chip id * @return 8 bit serial number */ uint8_t getID(); /** * @brief Enable interrupt * @param source Interrupt pin selection eINT1 = 0,// eINT2,// * @param event Interrupt event selection eXLowerThanTh ,// eXHigherThanTh ,// eYLowerThanTh,// eYHigherThanTh,// eZLowerThanTh,// eZHigherThanTh,// */ void enableInterruptEvent(eInterruptSource_t source, eInterruptEvent_t event); /** * @brief Set measurement range * @param range Range(g) eH3lis200dl_100g, //±100g eH3lis200dl_200g, //±200g eLis331hh_6g = 6,//±6g eLis331hh_12g = 12 //±12g eLis331hh_24g = 24 //±24g @return true(Set successfully)/false(Set failed) */ bool setRange(eRange_t range); /** * @brief Set data measurement rate * @param rate rate(HZ) ePowerDown_0HZ //Measurement off eLowPower_halfHZ //0.5 hz eLowPower_1HZ eLowPower_2HZ eLowPower_5HZ eLowPower_10HZ eNormal_50HZ eNormal_100HZ eNormal_400HZ eNormal_1000HZ */ void setAcquireRate(ePowerMode_t rate); /** * @brief Set data filtering mode * @param mode Four modes eCutOffMode1 = 0, eCutOffMode2, eCutOffMode3, eCutOffMode4, eShutDown, no filering eg: Select eCutOffMode1 in 50HZ, and the filtered frequency is 1HZ *|---------------------------High-pass filter cut-off frequency configuration-----------------------------| *|--------------------------------------------------------------------------------------------------------| *| | ft [Hz] | ft [Hz] | ft [Hz] | ft [Hz] | *| mode |Data rate = 50 Hz| Data rate = 100 Hz | Data rate = 400 Hz | Data rate = 1000 Hz | *|--------------------------------------------------------------------------------------------------------| *| eCutOffMode1 | 1 | 2 | 8 | 20 | *|--------------------------------------------------------------------------------------------------------| *| eCutOffMode2 | 0.5 | 1 | 4 | 10 | *|--------------------------------------------------------------------------------------------------------| *| eCutOffMode3 | 0.25 | 0.5 | 2 | 5 | *|--------------------------------------------------------------------------------------------------------| *| eCutOffMode4 | 0.125 | 0.25 | 1 | 2.5 | *|--------------------------------------------------------------------------------------------------------| */ void setHFilterMode(eHighPassFilter_t mode); /** * @brief Set the threshold of interrupt source 1 interrupt * @param threshold The threshold we set before is within measurement range(unit:g) */ void setInt1Th(uint8_t threshold); /** * @brief Set interrupt source 2 interrupt generation threshold * @param threshold The threshold we set before is within measurement range(unit:g) */ void setInt2Th(uint8_t threshold); /** * @brief Enable sleep wake function * @param enable true(enable)\false(disable) * @return false Indicate enable failed/true Indicate enable successful */ bool enableSleep(bool enable); /** * @brief Check whether the interrupt event'event' is generated in interrupt 1 * @param event Interrupt event eXLowerThanTh ,// eXHigherThanTh ,// eYLowerThanTh,// eYHigherThanTh,// eZLowerThanTh,// eZHigherThanTh,// * @return true This event generated false This event not generated */ bool getInt1Event(eInterruptEvent_t event); /** * @brief Check whether the interrupt event'event' is generated in interrupt 2 * @param event Interrupt event eXLowerThanTh ,// eXHigherThanTh ,// eYLowerThanTh,// eYHigherThanTh,// eZLowerThanTh,// eZHigherThanTh,// * @return true This event generated false This event not generated */ bool getInt2Event(eInterruptEvent_t event); /** * @brief Get the acceleration in the x direction * @return acceleration from x */ int32_t readAccX(); /** * @brief Get the acceleration in the y direction * @return acceleration from y */ int32_t readAccY(); /** * @brief Get the acceleration in the z direction * @return acceleration from z */ int32_t readAccZ(); /** * @brief Get the acceleration in the three directions of xyz * @param accx Store the variable of acceleration in x direction * @param accy Store the variable of acceleration in y direction * @param accz Store the variable of acceleration in z direction * @return true(Get data successfully/false(Data not ready) */ bool getAcceFromXYZ(int32_t &accx,int32_t &accy,int32_t &accz); /** * @brief Get whether the sensor is in sleep mode * @return true(In sleep mode)/false(In normal mode) */ bool getSleepState(); /** * @brief Set the sleep state flag * @param into true(Flag the current mode as sleep mode) false(Flag the current mode as normal mode) */ void setSleepFlag(bool into); 样例代码1-读取x,y,z轴加速度(getAcceleration.ino) 选择getAcceleration.ino |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |