当前位置:网站首页>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】库.
边栏推荐
猜你喜欢
随机推荐
GO开发环境配置
Automated test browser driver download version
015-Balanced binary tree (1)
慢 SQL 分析与优化
进入 SQL Client 创建 table 后,在另外一个节点进入 SQL Client 查询不到
MySql数据库索引优化
媒体查询代码
MySQL的存储过程
Go操作Redis数据库
Go Redis database operation
C语言二维数组用一维数组进行调用
WinCheck Script
type=“module“ 你了解,但 type=“importmap“ 你知道吗
LeetCode第三题(Longest Substring Without Repeating Characters)三部曲之二:编码实现
SQL exam questions
Promise 1: Basic Questions
子查询和关联查询的区别
ImportError: DLL load failed with error code -1073741795
面试突击71:GET 和 POST 有什么区别?
MySQL中tinytext、text、mediumtext和longtext等各个类型详解[通俗易懂]












