Difference between revisions of "SIngle ToF"
From Diustou Wiki
Yousimaier17 (talk | contribs) |
Yousimaier17 (talk | contribs) (→上位机) |
||
Line 95: | Line 95: | ||
***写入0x01,传感器进入Modbus模式(默认)。 | ***写入0x01,传感器进入Modbus模式(默认)。 | ||
***写入0x02,传感器进入校准模式,校准完成后自动恢复为Modbus模式。 | ***写入0x02,传感器进入校准模式,校准完成后自动恢复为Modbus模式。 | ||
− | === | + | === Host Computer === |
− | *''' | + | *'''Hardware Preparation:''' Single ToF Module, USB to TTL Module, Computer |
− | *''' | + | *'''Hardware Connection:''' |
**[[File:SIngle ToF_上位机1.png|600px]] | **[[File:SIngle ToF_上位机1.png|600px]] | ||
− | *''' | + | *'''Usage Steps:''' |
− | ** | + | **Connect the Single ToF module to the interface of the USB to TTL module, insert the wired USB to TTL module into the computer's USB port, and open the [https://wiki.diustou.com/cn/%E6%96%87%E4%BB%B6:SIngle_ToF_windows%E4%B8%8A%E4%BD%8D%E6%9C%BA.zip Host Computer]. |
− | ** | + | **Click "Refresh Serial Port" in the host software, then select the corresponding port number for the module, and click "Connect" after selecting the port number. At this point, the phrase "Serial Port Opened Successfully" will appear in the dialog box on the right. |
**[[File:SIngle ToF_上位机2.png|400px]][[File:SIngle ToF_上位机3.png|400px]] | **[[File:SIngle ToF_上位机2.png|400px]][[File:SIngle ToF_上位机3.png|400px]] | ||
− | ** | + | **Click "Add Device" in the bottom left corner, and in the dialog box that appears, enter the module ID (default ID is 0x50), then click "OK". |
**[[File:SIngle ToF_上位机4.png|400px]][[File:SIngle ToF_上位机5.png|400px]] | **[[File:SIngle ToF_上位机4.png|400px]][[File:SIngle ToF_上位机5.png|400px]] | ||
− | ** | + | **After successfully setting the ID, a new interface will pop up for viewing the measured distance and configuring the module. At the same time, the phrase "Device Added Successfully ID: 0x50" will appear on the right side of the main interface. |
**[[File:SIngle ToF_上位机6.png|600px]] | **[[File:SIngle ToF_上位机6.png|600px]] | ||
− | *''' | + | *'''Calibration:''' |
− | ** | + | **Connect the module. |
− | ** | + | **Place the module 10cm away from a piece of white paper, click the "Calibrate" button to calibrate the module with the corresponding ID. |
**[[File:SIngle ToF_上位机7.png|300px]] | **[[File:SIngle ToF_上位机7.png|300px]] | ||
− | *''' | + | *'''Set ID:''' |
− | ** | + | **Connect the module. |
− | ** | + | **Click the "Set ID" button, enter a new ID within the range of 01~fe in hexadecimal. |
− | ** | + | **Restart the module for the changes to take effect. After it takes effect, you need to reconnect the module using the new ID. |
**[[File:SIngle ToF_上位机8.png|300px]] | **[[File:SIngle ToF_上位机8.png|300px]] | ||
− | *''' | + | *'''Factory Reset:''' |
− | ** | + | **Connect the module. |
− | ** | + | **Click the "Factory Reset" button. |
− | ** | + | **The module will restart for the changes to take effect. After it takes effect, you need to reconnect the module using the default ID (50). |
− | ** | + | **After a factory reset, the calibration parameters will be cleared, and recalibration is required. |
**[[File:SIngle ToF_上位机9.png|300px]] | **[[File:SIngle ToF_上位机9.png|300px]] | ||
− | *''' | + | *'''Restart:''' |
− | ** | + | **Connect the module. |
− | ** | + | **Click the "Restart" button, and the module with the corresponding ID will restart. |
**[[File:SIngle ToF_上位机10.png|300px]] | **[[File:SIngle ToF_上位机10.png|300px]] | ||
Revision as of 17:32, 10 January 2025
| ||||||||||||||||||||||
| ||||||||||||||||||||||
| ||||||||||||||||||||||
|
Contents
测距原理
TOF是Time of Flight的缩写,即飞行时间。具体是指通过周期性的向外发出红外光调制波,当调制波遇到被测目标后反射,然后用传感器接收从被测目标反射回来的调制波。通过测量调制波往返的相位差,可得到飞行时间,从而计算出传感器与物体目标之间的相对距离。示意图如下所示。
引脚说明
产品参数
使用说明
演示示例
Modbus协议
- 单点TOF激光测距传感器采用了工业标准Modbus协议,Modbus通信指令分为两种,读命令与写命令,
- 读命令(0x03):读取相应寄存器数据。
- 写命令(0x06):向相应寄存器写入数据。
- 具体读写格式如下表:
Modbus寄存器
- 波特率设置
- 系统模式
Host Computer
- Hardware Preparation: Single ToF Module, USB to TTL Module, Computer
- Hardware Connection:
- Usage Steps:
- Connect the Single ToF module to the interface of the USB to TTL module, insert the wired USB to TTL module into the computer's USB port, and open the Host Computer.
- Click "Refresh Serial Port" in the host software, then select the corresponding port number for the module, and click "Connect" after selecting the port number. At this point, the phrase "Serial Port Opened Successfully" will appear in the dialog box on the right.
- Click "Add Device" in the bottom left corner, and in the dialog box that appears, enter the module ID (default ID is 0x50), then click "OK".
- After successfully setting the ID, a new interface will pop up for viewing the measured distance and configuring the module. At the same time, the phrase "Device Added Successfully ID: 0x50" will appear on the right side of the main interface.
- Calibration:
- Set ID:
- Factory Reset:
- Restart:
Arduino
- Hardware Preparation: Single ToF Module, Arduino
- Hardware Connection:
- Usage Steps:
- Connect the Single ToF module to the Arduino interface, and connect the wired Arduino to the computer.
- Open the code with Arduino IDE and select the corresponding board type and serial port number.
- Modify the IO port number for the serial port where the sensor is connected, based on the actual hardware connection between the sensor and the Arduino.
- Modify the number of sensors and sensor IDs according to the actual situation.
- Compile and upload the code.
- Open the Serial Monitor, set the baud rate to 115200, and observe the results.
Raspberry Pi
- Hardware Preparation: Single ToF Module, Raspberry Pi
- Hardware Connection:
- Usage Steps
- Burn the Raspberry Pi OS onto an SD card and copy the example code to the system files on the Raspberry Pi.
- Connect the Single ToF module to the Raspberry Pi interface and insert the SD card with the burned OS into the Raspberry Pi.
- Enable the serial port function on the Raspberry Pi.
Execute Command:sudo raspi-config Select:Interfacing Options Select:Serial Select:NO(Would you like a login shell to be accessible over serial?) Select:YES(Would you like the serial port hardware to be enabled) Select:YES(The serial login shell is disabled.....) Restart the Raspberry Pi
sudo gcc vl53_tof.c -o vl53_tof
sudo ./vl53_tof
Product Information
FAQ
|