日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Arduino驱动VL53L0X V2激光测距(串口输出)

發布時間:2023/12/20 编程问答 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Arduino驱动VL53L0X V2激光测距(串口输出) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Arduino驅動VL53L0X V2激光測距(串口輸出)

  • 一、簡介
  • 二、使用前準備
  • 三、測試方法
  • 四、實驗現象
  • 總結

一、簡介

激光測距傳感器模塊功耗小,體積小,安裝方便。它是根據紅外LED發光,照射到被測物體后,返回光經過MCU接收,MCU計算時間差得到距離,直接輸出距離值。
VL53LOX是新一代完全集成的傳感器,配有嵌入式紅外、人眼安全激光,先進的濾波器和超高速光子探測陣列,測量距離更長,速度和精度更高。
激光測距傳感器的感測能力可以支持各種功能,包括各種創新用戶界面的手勢感應或接近檢測,掃地機器人、服務性機器人的障礙物探測與防撞系統,家電感應面板、筆記本電腦的用戶存在檢測或電源開關監控器,以及無人機和物聯網產品等。

原理框圖

VL53LOX進行IIC通訊地址說明

VL53LOX讀寫說明



引腳說明

名稱描述
VIN電源3~5V
GND接地
SCLIIIC串行時鐘線
SDAIIC串行數據線
GPIO1中斷
XSHUT復位

二、使用前準備


點擊圖片購買

VL53L0X V2激光測距模塊 激光測距傳感器 ToF飛行時間測距


點擊圖片購買

原裝正版Arduino uno r3開發板


點擊圖片購買

USB2.0打印機數據線高速方口連接轉接線 A公對B公

點擊圖片購買

杜邦線 VL53L0X V2激光測距模塊 激光測距傳感器 ToF飛行時間測距1個
原裝正版Arduino uno r3開發板1個
USB2.0打印機數據線高速方口連接轉接線 A公對B公1條
杜邦線若干

三、測試方法

用USB2.0打印機數據線高速方口連接轉接線與Arduino uno r3開發板連接在一起。Arduino uno r3開發板和VL53L0X V2激光測距模塊連接,如下圖所示

接線
5V —— VCC
GND —— GND
SCL —— SCL
SDA —— SDA
安裝Arduino IDE,打開ArduinoIDE,先安裝【IRremote】庫,點擊【項目】,再點擊【新建】,輸入代碼,如下圖所示

最后點擊上傳,如下圖所示

代碼如下:

/* This example shows how to get single-shot rangemeasurements from the VL53L0X. The sensor can optionally beconfigured with different ranging profiles, as described inthe VL53L0X API user manual, to get better performance fora 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_ACCURACYvoid 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 mssensor.setMeasurementTimingBudget(200000); #endif }void loop() {Serial.print(sensor.readRangeSingleMillimeters());if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }Serial.println(); }

四、實驗現象


程序下載進去之后,顯示測量的距離78mm。

總結

注意事項
(1)波特率要選擇正確。
(2)要先安裝【VL53L0X】庫。

總結

以上是生活随笔為你收集整理的Arduino驱动VL53L0X V2激光测距(串口输出)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。