(SKU:SEN0245)VL53L0 Distance Ranging Sensor

来自DFRobot Product Wiki
跳转至: 导航搜索
Gravity: VL53L0X ToF 激光测距传感器

目录

简介

VL53L0X激光测距传感器是一款基于意法半导体(STMicroelectronics)新出的基于飞行时间测距 (ToF) 原理设计的高精度测距传感器。与传统的技术不同,VL53L0X无论目标反射率如何,都能提供精确的距离测量,最高测量距离2米。
DFRobot基于VL53L0X设计的Gravity传感器模块,提供Gravity-I2C接口,即插即用,支持3.3V~5V供电使用,兼容更多的主板,适应更多的应用场景。
VL53L0X集成了尖端的SPAD (Single Photon Avalanche Diodes) 阵列,并嵌入ST的第二代FlightSenseTM专利技术。精度达±3%,响应时间小于30ms,正常工作模式下功耗仅20mW,待机功耗为5uA。
VL53L0X的940nm VCSEL发射器(垂直腔面发射激光器)对人眼来说是完全不可见的,加上内部物理红外滤波器,它可以实现更远的距离,更强的抗环境光的能力,以及更好的覆盖玻璃光学截面。

技术规格

  • 工作电压:3.3V-5V DC
  • 激光波长:940nm
  • 量程范围:30-2000mm
  • 测距角度:25°
  • 测距精度:±3%
  • 测距时间:<= 30ms
  • 工作温度:-20-70 ℃
  • 接口类型:标准Gravity接口
  • 产品尺寸:20*22 mm


引脚说明

引脚图
引脚描述
标号 名称 功能描述
1 绿线 D IIC数据线DATA
2 蓝线 C IIC时钟线CLK
3 黑线 - 电源负极GND
4 红线 + 电源正极VCC
  • GPIO1:传感器中断输出引脚,用来指示数据是否准备好
  • XSHUT:传感器关闭引脚,默认被拉高,当引脚被拉低时传感器进入关闭模式


使用教程

准备

硬件

  • Arduino UNO控制板 x1
  • VL53L0X Distance Ranging Sensor模块

软件


连接图

SEN0245连接图

样例代码

/*!
 * @file DFRobot_VL53L0X.ino
 * @brief DFRobot's Laser rangefinder library
 * @n The example shows the usage of VL53L0X in a simple way.

 * @copyright	[DFRobot](http://www.dfrobot.com), 2016
 * @copyright	GNU Lesser General Public License
 
 * @author [LiXin]
 * @version  V1.0
 * @date  2017-8-21
 * @https://github.com/DFRobot/DFRobot_VL53L0X
 timer*/
#include "Arduino.h"
#include "Wire.h"
#include "DFRobot_VL53L0X.h"

/*****************Keywords instruction*****************/
//Continuous--->Continuous measurement model
//Single------->Single measurement mode
//High--------->Accuracy of 0.25 mm
//Low---------->Accuracy of 1 mm
/*****************Function instruction*****************/
//setMode(ModeState mode, PrecisionState precision)
  //*This function is used to set the VL53L0X mode
  //*mode: Set measurement mode       Continuous or Single
  //*precision: Set the precision     High or Low
//void start()
  //*This function is used to enabled VL53L0X
//float getDistance()
  //*This function is used to get the distance
//uint16_t getAmbientCount()
  //*This function is used to get the ambient count
//uint16_t getSignalCount()
  //*This function is used to get the signal count
//uint8_t getStatus();
  //*This function is used to get the status
//void stop()
  //*This function is used to stop measuring

DFRobotVL53L0X sensor;

void setup() {
  //initialize serial communication at 115200 bits per second:
  Serial.begin(115200);
  //join i2c bus (address optional for master)
  Wire.begin();
  //Set I2C sub-device address
  sensor.begin(0x50);
  //Set to Back-to-back mode and high precision mode
  sensor.setMode(Continuous,High);
  //Laser rangefinder begins to work
  sensor.start();
}

void loop() 
{
  //Get the distance
  Serial.print("Distance: ");Serial.println(sensor.getDistance());
  //The delay is added to demonstrate the effect, and if you do not add the delay,
  //it will not affect the measurement accuracy
  delay(500);
}

测量结果

IDE串口打印

串口显示测量到的距离等信息


测量结果示意

测试数据表(单位:mm)
实际距离 测得距离(误差) 实际距离 测得距离(误差) 实际距离 测得距离(误差) 实际距离 测得距离(误差)
500 490(-10)

491.5(-8.5)

498(-2)

496.5(-3.5)

499.75(-0.25)

503.75(+3.75)

300 304.75(+4.75)

298.75(-1.25)

299.5(-0.5)

302(+2)

297.5(-2.5)

299.5(-0.5)

138 138.5(+0.5)

131.5(-6.5)

132.25(-5.75)

131.25(-6.75)

136(-2)

138.5(+0.5)

100 102(+2)

109(+9)

105.5(+5.5)

104.75(+4.75)

99.5(-0.5)

102.5(+2.5)

API列表

#include <DFRobot_EINK.h>
 
DFRobotVL53L0X sensor  //创建一个VL53L0X对象

/*
 * @函数功能:设置测距模式。
 * @参数1 mode: 测距模式。
 *     Single: 单次测距。
 *     Continuous: 连续测距。
 * @参数2 precision: 测量精度
 *     High: 高精度(0.25mm)。
 *     Low: 标准精度(1mm)。
 */
void setMode(uint8_t mode, uint8_t precision);

/*
 * @函数功能:开始测量距离。
 */
void start();

/*
 * @函数功能:停止测量。
 */
void stop();

/*
 * @函数功能:获取距离。
 */
uint16_t getDistance();

/*
 * @函数功能:获取环境量。
 */
uint16_t getAmbientCount();

/*
 * @函数功能:获取信号数。
 */
uint16_t getSignalCount();


兼容性测试

MCU 测试通过 测试失败 未测试 特别标注
FireBeetle-Board328P
FireBeetle-ESP32
FireBeetle-ESP8266
Arduino UNO/ Leonardo/ Mega2560

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

1、下载及安装软件。下载地址:http://www.mindplus.cc 详细教程:Mind+基础wiki教程-软件下载安装
2、切换到“上传模式”。 详细教程:Mind+基础wiki教程-上传模式编程流程
3、“扩展”中选择“主控板”中的“Arduino Uno”,“传感器”中加载“VL53L0X激光测距传感器”。 详细教程:Mind+基础wiki教程-加载扩展库流程
4、进行编程,程序如下图:
5、菜单“连接设备”,“上传到设备”
6、程序上传完毕后,打开串口即可看到数据输出。详细教程:Mind+基础wiki教程-串口打印

Mind+skusen0245.png

结果

打开串口监视器,将波特率调整到9600,移动传感器靠近物体,通过串口观察激光测距传感器测得的距离值。

产品尺寸

SEN0245 尺寸图 1.jpg


常见问题

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

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


更多


DFshopping car1.png DFRobot商城购买链接

个人工具
名字空间

变换
操作
导航
工具箱