当前位置:网站首页>VL53L0X V2 laser ranging sensor collects distance data serial output
VL53L0X V2 laser ranging sensor collects distance data serial output
2022-08-03 10:03:00 【Optimal electronic letter】
一、简介
The laser ranging sensor module has low power consumption,体积小,安装方便.It is based on infraredLED发光,照射到被测物体后,返回光经过MCU接收,MCUCalculate the time difference to get the distance,直接输出距离值.
VL53LOXis a new generation of fully integrated sensors,Equipped with embedded infrared、Eye-safe laser,Advanced filters and arrays for ultrafast photon detection,longer measuring distance,Higher speed and precision.
The sensing capability of the laser ranging sensor can support various functions,Gesture sensing or proximity detection including various innovative user interfaces,扫地机器人、Obstacle detection and collision avoidance systems for service robots,Home appliance induction panel、User presence detection or power switch monitor for laptops,As well as drones and IoT products, etc.
VL53LOX进行IICDescription of the mailing address
VL53LOX读写说明
引脚说明
名称 | 描述 |
---|---|
VIN | 电源3~5V |
GND | 接地 |
SCL | IIIC串行时钟线 |
SDA | IIC串行数据线 |
GPIO1 | 中断 |
XSHUT | 复位 |
二、使用前准备
VL53L0X V2激光测距模块 激光测距传感器 ToF飞行时间测距 | 1个 |
---|---|
原装正版Arduino uno r3开发板 | 1个 |
USB2.0打印机数据线高速方口连接转接线 A公对B公 | 1条 |
杜邦线 | 若干 |
三、测试方法
用USB2.0打印机数据线高速方口连接转接线与Arduino uno r3开发板连接在一起.Arduino uno r3开发板和VL53L0X V2Laser ranging module connection,如下图所示
接线
5V —— VCC
GND —— GND
SCL —— SCL
SDA —— SDA
安装Arduino IDE,打开ArduinoIDE,先安装【IRremote】库,点击【项目】,再点击【新建】,输入代码,如下图所示
最后点击上传,如下图所示
代码如下:
/* This example shows how to get single-shot range measurements from the VL53L0X. The sensor can optionally be configured with different ranging profiles, as described in the VL53L0X API user manual, to get better performance for a certain application. This code is based on the four "SingleRanging" examples in the VL53L0X API. The range readings are in units of mm. */
#include <Wire.h>
#include <VL53L0X.h>
VL53L0X sensor;
// Uncomment this line to use long range mode. This
// increases the sensitivity of the sensor and extends its
// potential range, but increases the likelihood of getting
// an inaccurate reading because of reflections from objects
// other than the intended target. It works best in dark
// conditions.
//#define LONG_RANGE
// Uncomment ONE of these two lines to get
// - higher speed at the cost of lower accuracy OR
// - higher accuracy at the cost of lower speed
//#define HIGH_SPEED
//#define HIGH_ACCURACY
void setup()
{
Serial.begin(9600);
Wire.begin();
sensor.init();
sensor.setTimeout(500);
#if defined LONG_RANGE
// lower the return signal rate limit (default is 0.25 MCPS)
sensor.setSignalRateLimit(0.1);
// increase laser pulse periods (defaults are 14 and 10 PCLKs)
sensor.setVcselPulsePeriod(VL53L0X::VcselPeriodPreRange, 18);
sensor.setVcselPulsePeriod(VL53L0X::VcselPeriodFinalRange, 14);
#endif
#if defined HIGH_SPEED
// reduce timing budget to 20 ms (default is about 33 ms)
sensor.setMeasurementTimingBudget(20000);
#elif defined HIGH_ACCURACY
// increase timing budget to 200 ms
sensor.setMeasurementTimingBudget(200000);
#endif
}
void loop()
{
Serial.print(sensor.readRangeSingleMillimeters());
if (sensor.timeoutOccurred()) {
Serial.print(" TIMEOUT"); }
Serial.println();
}
四、实验现象
程序下载进去之后,显示测量的距离78mm.
总结
注意事项
(1)波特率要选择正确.
(2)要先安装【VL53L0X】库.
边栏推荐
猜你喜欢
随机推荐
夏季整治百日行动进行时:700余交通安全隐患被揪出
文旅部:进一步加强旅游景区暑期安全管理工作
MySQL 主从切换步骤
System io statistics
bihashSummary
ECCV2022 | RU&谷歌:用CLIP进行zero-shot目标检测!
使用 Scrapy 框架对重复的 url 无法获取数据,dont_filter=True
10 Convolutional Neural Networks for Deep Learning 2
面试突击71:GET 和 POST 有什么区别?
CRT命令按键
DOM0, DOM2, DOM3 events
函数指针数组
cmd(命令行)操作或连接mysql数据库,以及创建数据库与表
select statement in go
罕见的数学天才,靠“假结婚”才得到追求事业的机会
Does setting the following sysctl settings require a system reboot?
梯度消失和梯度爆炸
MySQL_关于JSON数据的查询
GoogLeNet系列解读「建议收藏」
Let‘s Encrypt 使用