Difference between revisions of "Template:TOF Laser Range Sensor B Spec"

From Waveshare Wiki
Jump to: navigation, search
 
(50 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
== Introduction ==
 
== Introduction ==
The TOF Laser Range Sensor (B) is a TOF-based (time of flight) laser ranging sensor with an embedded MCU and ranging algorithm, which is capable of offering up to 15m measuring range, ±2% accuracy, and 1mm resolution. It supports UART or I2C communication bus, features a longer measuring distance and higher light interference resistance capability due to its ultra-narrow FOV, suitable for either indoor or outdoor conditions. <br />
+
The TOF Laser Range Sensor (B) is a TOF-based (time of flight) laser ranging sensor with an embedded MCU and ranging algorithm, which is capable of offering up to 15m measuring range, ±2% accuracy, and 1mm resolution. It supports UART or I2C communication bus, featuring a longer measuring distance and higher light interference resistance capability due to its ultra-narrow FOV, suitable for either indoor or outdoor conditions. <br />
 
This sensor can be widely used in applications like common distance measuring, robot obstacle avoidance/route planning, as well as drone altitude setting/ceiling detection, and more... <br />
 
This sensor can be widely used in applications like common distance measuring, robot obstacle avoidance/route planning, as well as drone altitude setting/ceiling detection, and more... <br />
  
 
==Specification==
 
==Specification==
{|class="list"
+
{| class="list table table-striped table-bordered"
! Typical measuring range
 
| 0.10 ~ 15.0m
 
 
|-
 
|-
!Typical measuring accuracy
+
!
| 0.10 ~ 2m ±2cm; 2 ~ 15m ±2%
+
! TOF Laser Range Sensor
 +
! TOF Laser Range Sensor (B)
 +
|-
 +
! rowspan="3" | Typical measuring range
 +
| Short range: 0.012 ~ 2.16m
 +
| rowspan="3" | 0.10 ~ 15.0m
 +
|-
 +
| Mid range: 0.012 ~ 3.60m
 +
|-
 +
| Long range: 0.01 ~ 5.00m
 +
|-
 +
! rowspan="3" | Typical measuring accuracy
 +
| Short range: accuracy ±1.0cm, standard deviation<0.3cm
 +
| rowspan="3" | 0.10 ~ 2m ±2cm;2 ~ 15m ±2%
 +
|-
 +
| Mid range: accuracy ±1.0cm, standard deviation<1.5cm
 +
|-
 +
| Long range: accuracy ±1.5cm, standard deviation<[email protected]~3m, <br/>standard deviation<8cm@3~5m 
 
|-
 
|-
 
! Resolution
 
! Resolution
| 1mm
+
| colspan="2" | 1mm
 +
|-
 +
! Power supply
 +
| colspan="2" | 3.7 ~ 5.2V (reverse-proof)
 +
|-
 +
! Operating temperature
 +
| colspan="2" | -10°C ~ 60°C
 
|-
 
|-
 
! Wavelength
 
! Wavelength
| 750 ~ 830nm, compliant with IEC 60825-1:2014 version 3 Class2 standard
+
| 940nm (Class1 standard compliant)
 +
| 750 ~ 830nm compliant with IEC 60825-1:2014 version 3 Class2 standard
 
|-
 
|-
 
! Field of view (FOV)
 
! Field of view (FOV)
 +
| 15° ~ 27° (adjustable)
 
| 1° ~ 2°
 
| 1° ~ 2°
 
|-
 
|-
!scope="col"; rowspan=2 | Communication interface
+
! rowspan="2" | Communication interface
| UART (3.3V TTL signal level)
+
| colspan="2" | UART (3.3V TTL signal level)
 
|-
 
|-
 +
| CAN (both of the two ports can be used as CAN simultaneously)
 
| I2C (cascading support, the slave address is 0x08+module ID)
 
| I2C (cascading support, the slave address is 0x08+module ID)
 
|-
 
|-
! scope="col"; rowspan=2 | Baudrate
+
! rowspan="2" | Baudrate
 +
| colspan="2" | UART: 115200 ~ 3000000bps (921600bps by default)
 +
|-
 
| UART: 115.2Kbps ~ 3000Kbps (921.6Kbps by default)
 
| UART: 115.2Kbps ~ 3000Kbps (921.6Kbps by default)
|-
 
 
| I2C: up to 400Kbps
 
| I2C: up to 400Kbps
 
|-
 
|-
 
! Cascade support
 
! Cascade support
| up to 8x cascades via I2C
+
| UART: supports up to 8x cascades, CAN: supports up to 7x cascades
 +
| I2C: supports up to 8x cascades
 
|-
 
|-
! Power supply
+
! Ambient light resistance
| 3.7 ~ 5.2V (reverse-proof)
+
| weak resistance, indoor only
 +
| about 100K LUX resistance, suits both indoor and outdoor
 
|-
 
|-
 
! Power consumption
 
! Power consumption
 +
| 290mW (UART active output, long-range mode, 5.0V power supply, 58mA current)
 
| 610mW (UART active output, 5.0V power supply, 122mA current)
 
| 610mW (UART active output, 5.0V power supply, 122mA current)
 
|-
 
|-
 
! Weight
 
! Weight
 +
| 2.7g
 
| 7.7g
 
| 7.7g
 
|-
 
|-
! Operating temperature
+
! Dimensions (L × W × H)
| -10°C ~ 60°C
+
| 35.58 × 12 × 8.05mm
|-
+
| 22.7 × 28 × 13.6mm
! Dimensions
 
| 22.7 × 28 × 13.6mm (L × W × H)
 
 
|}
 
|}
  
 
==Applications==
 
==Applications==
*  Unmanned aerial vehicle height setting,ceiling detection
+
*  Unmanned aerial vehicle height setting, ceiling detection
 
*  Robot obstacle avoidance
 
*  Robot obstacle avoidance
 
*  Measuring and detecting
 
*  Measuring and detecting
Line 57: Line 84:
  
 
==Technology Overview==
 
==Technology Overview==
TOF is one absolute distance detecting technology, that is the sensor emits the near-infrared light to
+
TOF is an absolute distance detection technology, where the sensor emits calibrated near-infrared light, which is reflected upon encountering an object. By calculating the time or phase difference between light emission and reflection, the sensor converts it into distance information about the captured scene, thus generating depth information. Compared to stereo vision and 3D structured light approaches, TOF offers advantages such as longer working distances, broader applicability, and higher accuracy at longer distances. Therefore, it is commonly used in applications such as proximity detection of individuals, obstacle avoidance for robots, and automatic focusing in cameras. However, in outdoor environments, near-infrared light from sunlight can affect the measurement accuracy of the module.
be debugged, and it will reflect after encountering the object. The sensor calculates the distance of the subject being photographed by calculating the time difference or phase difference for the emission and reflection of light so as to produce depth information. Compared with the binocular plan and 3D
 
structural light plan, TOF has the advantages of long working distance, wide application scenarios, and
 
high precision of long-distance, etc. Therefore, it is always applied to personnel proximity detection,
 
robot obstacle avoidance, camera automatic focusing, etc. The near-infrared light coming from the sunlight in the outdoor environment will generate an impact on the measuring effect of the module.
 
  
 
[[File:TOF-Laser-Range-Sensor-work.jpg|600px]]
 
[[File:TOF-Laser-Range-Sensor-work.jpg|600px]]
  
==Function description==
+
==Function Description==
 
===【ID】===
 
===【ID】===
*ID is one variable set up for distinguishing the different sensors, which is used to identify each sensor during the cascade connection.
+
*ID is one variable designed for distinguishing the different sensors, which is used to identify each sensor during the cascade connection.
  
 
===【Interface & Baudrate】===
 
===【Interface & Baudrate】===
TOFSense supports two communication modes with configurations are UART, I2C and I/O .<br />
+
TOF Laser Range Sensor (B) supports UART, I2C, and I/O.<br />
 
====UART====
 
====UART====
 
The communication baud rate setting range is as follows:
 
The communication baud rate setting range is as follows:
Line 77: Line 100:
 
! UART Baud Rate  !! Note
 
! UART Baud Rate  !! Note
 
|-
 
|-
| 115200,230400,460800,921600,1000000,1200000,2000000,3000000 || Baud Rate is 921600 in default
+
| 115200,230400,460800,921600,1000000,1200000,2000000,3000000 || 921600 (by default)
 
|}
 
|}
Interface data output mode setting:<br />
+
The UART interface mode supports "active output" and "query output":<br />
*Active Output:
+
PC Download:<br />
 +
*[https://files.waveshare.com/upload/2/23/Waveshare_TOFAssistant.zip TOF Assistant (For Windows 7/10 64 bits)]<br />
 +
*[https://files.waveshare.com/upload/e/e4/TOFAssistant4.2.3.2_x86.zip TOF Assistant (For Windows 7/10 32 bits)]<br />
 +
*Active Output:
 
**The active output mode can only be used with a single module. In this mode, the module actively outputs measurement information at a frequency of 50 Hz, the format of output data is based on the NLink_TOFSense_Frame0 protocol.
 
**The active output mode can only be used with a single module. In this mode, the module actively outputs measurement information at a frequency of 50 Hz, the format of output data is based on the NLink_TOFSense_Frame0 protocol.
 
**Users can connect the Sensor to Windows PC by USB to TTL module and configure the module by Waveshare TOFAssistant software. Just like the picture below. You need to click the "Write Parameter" button to save the setting and don't forget to check them by "Read Parameter".
 
**Users can connect the Sensor to Windows PC by USB to TTL module and configure the module by Waveshare TOFAssistant software. Just like the picture below. You need to click the "Write Parameter" button to save the setting and don't forget to check them by "Read Parameter".
 
:[[File:TOF-B-UART-Active-inquire.jpg|500px]]
 
:[[File:TOF-B-UART-Active-inquire.jpg|500px]]
  
*Query Output:
+
*Query Output:
**The query output mode can be used in a single module. In this mode, the controller sends a query command containing the module ID to the desired query module, and the module can output one frame of measurement information. The query command is based on NLink_TOFSense _Read_Frame0 protocol, and the output data from module is based on NLink_TOFSense_Frame0 protocol.
+
**The query output mode can be used in a single module. In this mode, the controller sends a query command containing the module ID to the desired query module, and the module can output one frame of measurement information. The query command is based on NLink_TOFSense _Read_Frame0 protocol, and the output data from the module is based on the NLink_TOFSense_Frame0 protocol.
:[File:TOF-B-UART-Inquire.jpg|500px]]
+
**Connect the TOF series products to the Waveshare TOFAssistant software through the USB TO TTL module (line sequence and power supply voltage reference data sheet), click to enter the setting page after the identification is successful, the UART query output mode configuration is as shown in the figure below, after configuring the parameters, you need to click the write parameter button To save the parameters after the parameters are written successfully, you can read the parameters once to confirm whether the parameters are written successfully. (After changing the baud rate parameter of the module, you need to re-plug the USB TO TTL module to automatically identify the module):
 +
:[[File:TOF-B-UART-Inquire.jpg|500px]]
  
 
====I2C====
 
====I2C====
 
*The baudrate rate
 
*The baudrate rate
{|class="list"
+
{|class="wikitable" style="text-align:center"
! I2C baudate !! Description
+
! I2C baudrate !! Description
 
|-
 
|-
 
|Max 400KHz || Max 4000KHz, it is defined by the host device
 
|Max 400KHz || Max 4000KHz, it is defined by the host device
 
|}
 
|}
 
*I2C address
 
*I2C address
{|class="list"
+
{|class="wikitable" style="text-align:center"
 
! I2C address !! Description
 
! I2C address !! Description
 +
|-
 
| 0x08 ~ 0x77
 
| 0x08 ~ 0x77
| The default address is 0x08 (7 bits), the slaver address of the module is 0x08 + ID, you can change the device address by modifying the module ID. Please take care of offset and the behavior bit while communicating. for example, if the device address is 0x08, if you need to write data, you need to add the write bit and the byte sent should be 0x10, if you need to read data, you need to add the read bit and the byte sent should be 0x11.
+
| The default address is 0x08 (7 bits), and the slaver address of the module is 0x08 + ID, you can change the device address by modifying the module ID. Please take care of offset and the behavior bit while communicating. for example, if the device address is 0x08, if you need to write data, you need to add the write bit and the byte sent should be 0x10, if you need to read data, you need to add the read bit and the byte sent should be 0x11.
 
|}
 
|}
: In the I2C communication mode, the controller sends a reading frame to the expected query module of the specified slave address, and then the information such as the distance of the module can be obtained. In addition, various parameters such as the output mode of the module can also be changed through I2C communication. The reading frame and write frame format follow the protocol NLink_TOFSense_IIC_Frame0. You can connect the sensor to the PC by USB to the TTL module and change the device address (0x08 + ID, the ID should in the range 0 ~111) by the Waveshare TOFAssistant software. Note that, the Waveshare ToFAssitant software can only support UART mode.  
+
: In the I2C communication mode, the controller sends a reading frame to the expected query module of the specified slave address, and then the information such as the distance of the module can be obtained. In addition, various parameters such as the output mode of the module can also be changed through I2C communication. The reading frame and write frame format follow the protocol NLink_TOFSense_IIC_Frame0. You can connect the sensor to the PC by USB to the TTL module and change the device address (0x08 + ID, the ID should be in the range 0 ~111) by the Waveshare TOFAssistant software. Note that, the Waveshare ToFAssitant software can only support UART mode.  
 
:[[File:TOF-B-I2C.jpg|500px]]
 
:[[File:TOF-B-I2C.jpg|500px]]
  
 
====I/O output====
 
====I/O output====
*In I/O output mode, it doesn't output distance data. The voltage of I/O is toggled when the distance is over threshold.
+
*In I/O output mode, it doesn't output distance data. The voltage of I/O is toggled when the distance is over the threshold.
:When the module is in UART mode, users can connect it to the Windows PC by USB to TTL module and configure the band data by the Waveshare TOFAssistant software. The distance value is converted to high and low level output through hysteresis comparison. TX/SCL and RX/SDA output complementary levels. The hysteresis comparison diagram is shown in Figure 5. After configuring the parameters, you need to click the Write Parameters button to save the parameters. Note: After switching to I/O mode, you can refer to the FAQ chapter to change back to UART mode. <br />
+
: When the module is in UART mode, users can connect it to the Windows PC by USB to TTL module and configure the band data by the Waveshare TOFAssistant software. The distance value is converted to high and low-level output through hysteresis comparison. TX/SCL and RX/SDA output complementary levels. The hysteresis comparison diagram is shown in Figure 5. After configuring the parameters, you need to click the Write Parameters button to save the parameters. Note: After switching to I/O mode, you can refer to the FAQ chapter to change back to UART mode. <br />
 
: For example, Band_Start and Bandwidth are both set to 500, which corresponds to 0.5 meters. When the distance measurement value is 0.3 meters, RX is high, TX is low, the distance measurement value increases to 0.8 meters, RX is high, TX is low, and when the distance measurement value exceeds 1 meter, the level is reversed and RX is low, TX is high. When the distance measurement value drops from more than 1 meter to 0.8 meters, RX is low and TX is high. When the distance measurement value drops below 0.5 meters, the level is reversed, RX is high and TX is low.  
 
: For example, Band_Start and Bandwidth are both set to 500, which corresponds to 0.5 meters. When the distance measurement value is 0.3 meters, RX is high, TX is low, the distance measurement value increases to 0.8 meters, RX is high, TX is low, and when the distance measurement value exceeds 1 meter, the level is reversed and RX is low, TX is high. When the distance measurement value drops from more than 1 meter to 0.8 meters, RX is low and TX is high. When the distance measurement value drops below 0.5 meters, the level is reversed, RX is high and TX is low.  
 
:[[File:TOF-B-IO.jpg|400px]]
 
:[[File:TOF-B-IO.jpg|400px]]
*The range of Band_Start, Bandwidth is 0~15000 and 0~25000
+
*The range of Band_Start, Bandwidth is 0~15000 and 0~25000.
 
:[[File:TOF-B-Bandwidth.jpg|400px]]
 
:[[File:TOF-B-Bandwidth.jpg|400px]]
  
 
===【Distance Status】===
 
===【Distance Status】===
 
The module can output the current distance status, the user can perform the data processing with the
 
The module can output the current distance status, the user can perform the data processing with the
combination of distance status,The meaning of distance status is as follows:
+
combination of distance status. The meaning of distance status is as follows:
 
{| class="wikitable" style="padding:5px;"
 
{| class="wikitable" style="padding:5px;"
 
|-
 
|-
Line 126: Line 154:
  
 
===【Signal Strength】===
 
===【Signal Strength】===
Indicate the strength of current return signal, and the larger this value indicates the stronger the
+
Indicate the strength of the current return signal, and the larger this value indicates the stronger the
 
return signal.
 
return signal.
  
 
===【Range Precision】===
 
===【Range Precision】===
Indicate the precision of current signal, smaller the data, higher the prevision.
+
Indicate the precision of the current signal, the smaller the data, the higher the prevision.
  
 
===【FOV】===
 
===【FOV】===
The field angle FOV determines the vision scope of TOFSense. The FoV of the ToF Sensor (B) is  1~2°
+
The field angle FOV determines the vision scope of TOFSense. The FoV of the ToF Sensor (B) is  1~2°.
  
 
===【Mode Switch】===
 
===【Mode Switch】===
If the sensor is in UART mode, users can connect it to PC and chnage it to I2C or I/O mode by the Waveshare TOFAssistant software. If the sensor is in I2C mode, users can send commands to switch the mode to UART. And users can check the FAQ chapter about how to change to UART from I/O mode.
+
If the sensor is in UART mode, users can connect it to the PC and change it to I2C or I/O mode by the Waveshare TOFAssistant software. If the sensor is in I2C mode, users can send commands to switch the mode to UART. Users can check the FAQ chapter about how to change to UART from I/O mode.
  
==Protocol analysis==
+
==Protocol Analysis==
 
*The protocol is composed of Frame Header, Function Mark, Data, and Sum Check.
 
*The protocol is composed of Frame Header, Function Mark, Data, and Sum Check.
 
**The Frame Header and Function Mark are fixed values;
 
**The Frame Header and Function Mark are fixed values;
Line 148: Line 176:
 
</pre>
 
</pre>
 
''Note: Protocol packets follow the principle of little-endian mode, that is, the low byte is first and the high byte is last.''
 
''Note: Protocol packets follow the principle of little-endian mode, that is, the low byte is first and the high byte is last.''
*The frame:
+
*The frame:
{|class="list"
+
{|class="wikitable" style="text-align:center"
 
! Protocol !! Type !! Description
 
! Protocol !! Type !! Description
 
|-
 
|-
| NLINK_TOFSENSE_FRAME0 || Fixed length || UART output data, contain the timestamp, distance, distance status and signal strength, etc.
+
| NLINK_TOFSENSE_FRAME0 || Fixed length || UART output data, contains the timestamp, distance, distance status, and signal strength, etc.
 
|-
 
|-
 
|NLINK_TOFSENSE_READ _FRAME0 || Fixed length || UART read, contain device ID
 
|NLINK_TOFSENSE_READ _FRAME0 || Fixed length || UART read, contain device ID
 
|-
 
|-
|NLINK_TOFSENSE_IIC_FRAME0 || Flexible length || I2C data, contain distance, distance status and signal strength, etc.
+
|NLINK_TOFSENSE_IIC_FRAME0 || Flexible length || I2C data, contain distance, distance status, and signal strength, etc.
 
|}
 
|}
  
*NLink_TOFSense_Frame0:
+
===NLink_TOFSense_Frame0===
**'''Data Sources:''' Connect the module to the host computer and configure the UART as active output mode.
+
**''' Data Sources:''' Connect the module to the host computer and configure the UART as active output mode.
**'''Raw data:'''  
+
**'''Raw data:'''  
 
<pre>
 
<pre>
 
  57 00 ff 00 9e 8f 00 00 ad 08 00 00 03 00 06 41
 
  57 00 ff 00 9e 8f 00 00 ad 08 00 00 03 00 06 41
 
</pre>
 
</pre>
:*'''Analysis table:'''<br />
+
:*'''Analysis table:'''<br />
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
Line 191: Line 219:
 
|}
 
|}
  
*TNLink_TOFSense_Read_Frame0:
+
===NLink_TOFSense_Read_Frame0===
**'''Data Sources:''' Connect the module to the host computer, configure it as UART query output mode, id is 0, send the following data through the host computer to achieve data query.
+
**''' Data Sources:''' Connect the module to the host computer, and configure it as UART query output mode. The host device sends the command to query the data
**'''Raw data:'''
 
<pre>
 
57 00 ff 00 9e 8f 00 00 ad 08 00 00 03 00 06 41
 
</pre>
 
:*'''Analysis table:'''<br />
 
{| class="wikitable"
 
|-
 
! Data !! Type !! Length (Bytes) !! Hex !! Result
 
|- style="background:#ddd;"
 
| Frame Header || uint8 || 1 || 57 || 0x57
 
|- style="background:#ddd;"
 
| Function Mark || uint8 || 1 || 00 || 0x00
 
|-
 
| reserved || uint8 || 1 || ff || *
 
|-
 
| id || uint8 || 1 || 00 || 0
 
|-
 
|System_time || uint32 || 4 || 9e 8f 00 00 || 36766ms
 
|-
 
|dis*1000 || uint24 || 3 || ad 08 00 || 2.221m
 
|-
 
|dis_status || uint8 || 1 || 00 || 0
 
|-
 
|signal_strength || uint16 || 2 || 03 00 || 3
 
|-
 
|range_precision || uint8 || 1 || 06 || 6cm
 
|- style="background:#ddd;"
 
| Sum Check || uint8 || 1 || 3a || 0x3a
 
|}
 
 
 
*NLink_TOFSense_Read_Frame0:
 
**'''Data Sources:''' Connect the module to the host computer, configure it as UART query output mode. Host device send cmmand to query the data
 
  
**'''Raw data:'''  
+
**'''Raw data:'''  
 
  57 10 FF FF 00 FF FF 63
 
  57 10 FF FF 00 FF FF 63
:*'''Analysis table:'''<br />
+
:*'''Analysis table:'''<br />
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! Data !! Type !! Length (Bytes) !! Hex !! Result
 
! Data !! Type !! Length (Bytes) !! Hex !! Result
|-  style="background:rgb(255 145 8);"
+
|-   
 
| Frame Header || uint8 || 1 || 57 || 0x57
 
| Frame Header || uint8 || 1 || 57 || 0x57
|- style="background:rgb(255 145 8);"
+
|-  
| Function Mark || uint8 || 1 || 00 || 0x00
+
| Function Mark || uint8 || 1 || 10 || 0x10
|- style="background:rgb(255 204 141);"
+
|-  
 
| reserved || uint8 || 2 || ff || *
 
| reserved || uint8 || 2 || ff || *
|- style="background:rgb(255 204 141);"
+
|-  
 
| id || uint8 || 1 || 00 || 0
 
| id || uint8 || 1 || 00 || 0
|- style="background:rgb(255 204 141);"
+
|-  
 
| reserved || uint8 || 2 || ff || *
 
| reserved || uint8 || 2 || ff || *
|- style="background:rgb(255 145 8);"
+
|-  
 
| Sum Check || uint8 || 1 || 63 || 0x63
 
| Sum Check || uint8 || 1 || 63 || 0x63
 
|}
 
|}
  
*NLink_TOFSense_IIC_Frame0:
+
===NLink_TOFSense_IIC_Frame0===
**'''Device Address''': The sensor works as slaver device, the default device address is 0x08 (7bits), the whole device address is 0x08 + ID, user can change the device address by modifying the ID.
+
*''' Device Address''': The sensor works as a slaver device, the default device address is 0x08 (7bits), the whole device address is 0x08 + ID, user can change the device address by modifying the ID.
  
**'''Register address:'''  If the register is NULL, the output is 0xff by default
+
*'''Register address:'''  If the register is NULL, the output is 0xff by default
 
  AD 08 00 00 03 00 FF FF
 
  AD 08 00 00 03 00 FF FF
:*'''Analysis table:'''<br />
+
:*'''Analysis table:'''<br />
 +
 
 
:[[File:NLink TOFSense IIC Frame.png|700px]]
 
:[[File:NLink TOFSense IIC Frame.png|700px]]
*I2C communication
+
====I2C communication====
:[[File:NLink TOFSense IIC comunication.png|500px]]
+
:[[File:NLink TOFSense IIC comunication3.png|800px]]
 +
Start: starting signal<br/>
 +
W: read the flag bit 1<br/>
 +
R: Write the flag bit 0<br/>
 +
ACK: response<br/>
 +
NACK: no response<br/>
 +
Stop: stoping signal<br/>
 +
:[[File:NLink TOFSense IIC comunication4.png|250px|left]]
 +
Host sends<br/>
 +
Slave sends<br/>
 +
 
 +
=== NLink_TOFSense_Setting_Frame0 ===
 +
**'''Data Sources:''': Setting Commands
 +
:*'''Analysis table:'''<br />
 +
[[File:TOFSense-B-Setting-Frame.png|800px]]
 +
 
 
==Software==
 
==Software==
NAssistant is the accessory debug software for TOFSense with the main functions are: Debug
+
TOF Assistant is the debugging software supporting the TOF laser ranging module. Its main functions are configuration debugging, status display, function application, and firmware upgrade:<br/>
configuration, Status display, Function application, Firmware upgrade:
+
*''' Configuration and debugging:''' used to configure node-related parameters, such as ID, working mode, baud rate, etc.
*Debug configuration: Used for configuring the relevant parameters of nodes, e.g. ID, working
+
*''' Functional application: ''' used for application development, such as data import and export, motion track storage, historical track playback, etc.
mode, Baud rate etc.
+
*''' Firmware upgrade:''' used to upgrade the product by wired firmware.
*Function application: Used for the application development, e.g. data import and export, motion
 
trail storage, historical trial replay etc.
 
*Firmware upgrade: Used for carrying out the wired firmware upgrade for product.
 
 
 
*Hardware connection reference(you also need a USB TO TTL module):
 
[[File:TOF-Connect.jpg|800px]]<br />
 
*Software setup video:<br />
 
<video type="html5">https://www.waveshare.com/w/upload/3/30/TOF-Setting.mp4</video>
 
[[File:TOF-Setting.mp4]]
 
  
 
==Dimensions==
 
==Dimensions==
 
*[[File:TOF-Laser-Range-Sensor-B-details-size.jpg|600px]]
 
*[[File:TOF-Laser-Range-Sensor-B-details-size.jpg|600px]]

Latest revision as of 01:41, 15 March 2024

Introduction

The TOF Laser Range Sensor (B) is a TOF-based (time of flight) laser ranging sensor with an embedded MCU and ranging algorithm, which is capable of offering up to 15m measuring range, ±2% accuracy, and 1mm resolution. It supports UART or I2C communication bus, featuring a longer measuring distance and higher light interference resistance capability due to its ultra-narrow FOV, suitable for either indoor or outdoor conditions.
This sensor can be widely used in applications like common distance measuring, robot obstacle avoidance/route planning, as well as drone altitude setting/ceiling detection, and more...

Specification

TOF Laser Range Sensor TOF Laser Range Sensor (B)
Typical measuring range Short range: 0.012 ~ 2.16m 0.10 ~ 15.0m
Mid range: 0.012 ~ 3.60m
Long range: 0.01 ~ 5.00m
Typical measuring accuracy Short range: accuracy ±1.0cm, standard deviation<0.3cm 0.10 ~ 2m ±2cm;2 ~ 15m ±2%
Mid range: accuracy ±1.0cm, standard deviation<1.5cm
Long range: accuracy ±1.5cm, standard deviation<[email protected]~3m,
standard deviation<8cm@3~5m
Resolution 1mm
Power supply 3.7 ~ 5.2V (reverse-proof)
Operating temperature -10°C ~ 60°C
Wavelength 940nm (Class1 standard compliant) 750 ~ 830nm compliant with IEC 60825-1:2014 version 3 Class2 standard
Field of view (FOV) 15° ~ 27° (adjustable) 1° ~ 2°
Communication interface UART (3.3V TTL signal level)
CAN (both of the two ports can be used as CAN simultaneously) I2C (cascading support, the slave address is 0x08+module ID)
Baudrate UART: 115200 ~ 3000000bps (921600bps by default)
UART: 115.2Kbps ~ 3000Kbps (921.6Kbps by default) I2C: up to 400Kbps
Cascade support UART: supports up to 8x cascades, CAN: supports up to 7x cascades I2C: supports up to 8x cascades
Ambient light resistance weak resistance, indoor only about 100K LUX resistance, suits both indoor and outdoor
Power consumption 290mW (UART active output, long-range mode, 5.0V power supply, 58mA current) 610mW (UART active output, 5.0V power supply, 122mA current)
Weight 2.7g 7.7g
Dimensions (L × W × H) 35.58 × 12 × 8.05mm 22.7 × 28 × 13.6mm

Applications

  • Unmanned aerial vehicle height setting, ceiling detection
  • Robot obstacle avoidance
  • Measuring and detecting
  • Intelligent gesture control
  • 1-dimension gesture identification

Technology Overview

TOF is an absolute distance detection technology, where the sensor emits calibrated near-infrared light, which is reflected upon encountering an object. By calculating the time or phase difference between light emission and reflection, the sensor converts it into distance information about the captured scene, thus generating depth information. Compared to stereo vision and 3D structured light approaches, TOF offers advantages such as longer working distances, broader applicability, and higher accuracy at longer distances. Therefore, it is commonly used in applications such as proximity detection of individuals, obstacle avoidance for robots, and automatic focusing in cameras. However, in outdoor environments, near-infrared light from sunlight can affect the measurement accuracy of the module.

TOF-Laser-Range-Sensor-work.jpg

Function Description

【ID】

  • ID is one variable designed for distinguishing the different sensors, which is used to identify each sensor during the cascade connection.

【Interface & Baudrate】

TOF Laser Range Sensor (B) supports UART, I2C, and I/O.

UART

The communication baud rate setting range is as follows:

UART Baud Rate Note
115200,230400,460800,921600,1000000,1200000,2000000,3000000 921600 (by default)

The UART interface mode supports "active output" and "query output":
PC Download:

  • TOF Assistant (For Windows 7/10 64 bits)
  • TOF Assistant (For Windows 7/10 32 bits)
  • Active Output:
    • The active output mode can only be used with a single module. In this mode, the module actively outputs measurement information at a frequency of 50 Hz, the format of output data is based on the NLink_TOFSense_Frame0 protocol.
    • Users can connect the Sensor to Windows PC by USB to TTL module and configure the module by Waveshare TOFAssistant software. Just like the picture below. You need to click the "Write Parameter" button to save the setting and don't forget to check them by "Read Parameter".
TOF-B-UART-Active-inquire.jpg
  • Query Output:
    • The query output mode can be used in a single module. In this mode, the controller sends a query command containing the module ID to the desired query module, and the module can output one frame of measurement information. The query command is based on NLink_TOFSense _Read_Frame0 protocol, and the output data from the module is based on the NLink_TOFSense_Frame0 protocol.
    • Connect the TOF series products to the Waveshare TOFAssistant software through the USB TO TTL module (line sequence and power supply voltage reference data sheet), click to enter the setting page after the identification is successful, the UART query output mode configuration is as shown in the figure below, after configuring the parameters, you need to click the write parameter button To save the parameters after the parameters are written successfully, you can read the parameters once to confirm whether the parameters are written successfully. (After changing the baud rate parameter of the module, you need to re-plug the USB TO TTL module to automatically identify the module):
TOF-B-UART-Inquire.jpg

I2C

  • The baudrate rate
I2C baudrate Description
Max 400KHz Max 4000KHz, it is defined by the host device
  • I2C address
I2C address Description
0x08 ~ 0x77 The default address is 0x08 (7 bits), and the slaver address of the module is 0x08 + ID, you can change the device address by modifying the module ID. Please take care of offset and the behavior bit while communicating. for example, if the device address is 0x08, if you need to write data, you need to add the write bit and the byte sent should be 0x10, if you need to read data, you need to add the read bit and the byte sent should be 0x11.
In the I2C communication mode, the controller sends a reading frame to the expected query module of the specified slave address, and then the information such as the distance of the module can be obtained. In addition, various parameters such as the output mode of the module can also be changed through I2C communication. The reading frame and write frame format follow the protocol NLink_TOFSense_IIC_Frame0. You can connect the sensor to the PC by USB to the TTL module and change the device address (0x08 + ID, the ID should be in the range 0 ~111) by the Waveshare TOFAssistant software. Note that, the Waveshare ToFAssitant software can only support UART mode.
TOF-B-I2C.jpg

I/O output

  • In I/O output mode, it doesn't output distance data. The voltage of I/O is toggled when the distance is over the threshold.
When the module is in UART mode, users can connect it to the Windows PC by USB to TTL module and configure the band data by the Waveshare TOFAssistant software. The distance value is converted to high and low-level output through hysteresis comparison. TX/SCL and RX/SDA output complementary levels. The hysteresis comparison diagram is shown in Figure 5. After configuring the parameters, you need to click the Write Parameters button to save the parameters. Note: After switching to I/O mode, you can refer to the FAQ chapter to change back to UART mode.
For example, Band_Start and Bandwidth are both set to 500, which corresponds to 0.5 meters. When the distance measurement value is 0.3 meters, RX is high, TX is low, the distance measurement value increases to 0.8 meters, RX is high, TX is low, and when the distance measurement value exceeds 1 meter, the level is reversed and RX is low, TX is high. When the distance measurement value drops from more than 1 meter to 0.8 meters, RX is low and TX is high. When the distance measurement value drops below 0.5 meters, the level is reversed, RX is high and TX is low.
TOF-B-IO.jpg
  • The range of Band_Start, Bandwidth is 0~15000 and 0~25000.
TOF-B-Bandwidth.jpg

【Distance Status】

The module can output the current distance status, the user can perform the data processing with the combination of distance status. The meaning of distance status is as follows:

Value Note
0 Measuring distance is invalid
1 Measuring distance is valid

【Signal Strength】

Indicate the strength of the current return signal, and the larger this value indicates the stronger the return signal.

【Range Precision】

Indicate the precision of the current signal, the smaller the data, the higher the prevision.

【FOV】

The field angle FOV determines the vision scope of TOFSense. The FoV of the ToF Sensor (B) is 1~2°.

【Mode Switch】

If the sensor is in UART mode, users can connect it to the PC and change it to I2C or I/O mode by the Waveshare TOFAssistant software. If the sensor is in I2C mode, users can send commands to switch the mode to UART. Users can check the FAQ chapter about how to change to UART from I/O mode.

Protocol Analysis

  • The protocol is composed of Frame Header, Function Mark, Data, and Sum Check.
    • The Frame Header and Function Mark are fixed values;
    • Data is the content of the transmitted data;
    • Sum Check is the lowest byte after the addition of Frame Header, Function Mark, and Data (that is, the addition of all the previous bytes).
  • Agreement composition:
 Frame Header + Function Mark + Data + Sum Check

Note: Protocol packets follow the principle of little-endian mode, that is, the low byte is first and the high byte is last.

  • The frame:
Protocol Type Description
NLINK_TOFSENSE_FRAME0 Fixed length UART output data, contains the timestamp, distance, distance status, and signal strength, etc.
NLINK_TOFSENSE_READ _FRAME0 Fixed length UART read, contain device ID
NLINK_TOFSENSE_IIC_FRAME0 Flexible length I2C data, contain distance, distance status, and signal strength, etc.

NLink_TOFSense_Frame0

    • Data Sources: Connect the module to the host computer and configure the UART as active output mode.
    • Raw data:
 57 00 ff 00 9e 8f 00 00 ad 08 00 00 03 00 06 41
  • Analysis table:
Data Type Length (Bytes) Hex Result
Frame Header uint8 1 57 0x57
Function Mark uint8 1 00 0x00
reserved uint8 1 ff *
id uint8 1 00 0
System_time uint32 4 9e 8f 00 00 36766ms
dis*1000 uint24 3 ad 08 00 2.221m
dis_status uint8 1 00 0
signal_strength uint16 2 03 00 3
range_precision uint8 1 06 6cm
Sum Check uint8 1 41 0x41

NLink_TOFSense_Read_Frame0

    • Data Sources: Connect the module to the host computer, and configure it as UART query output mode. The host device sends the command to query the data
    • Raw data:
57 10 FF FF 00 FF FF 63
  • Analysis table:
Data Type Length (Bytes) Hex Result
Frame Header uint8 1 57 0x57
Function Mark uint8 1 10 0x10
reserved uint8 2 ff *
id uint8 1 00 0
reserved uint8 2 ff *
Sum Check uint8 1 63 0x63

NLink_TOFSense_IIC_Frame0

  • Device Address: The sensor works as a slaver device, the default device address is 0x08 (7bits), the whole device address is 0x08 + ID, user can change the device address by modifying the ID.
  • Register address: If the register is NULL, the output is 0xff by default
AD 08 00 00 03 00 FF FF
  • Analysis table:
NLink TOFSense IIC Frame.png

I2C communication

NLink TOFSense IIC comunication3.png

Start: starting signal
W: read the flag bit 1
R: Write the flag bit 0
ACK: response
NACK: no response
Stop: stoping signal

NLink TOFSense IIC comunication4.png

Host sends
Slave sends

NLink_TOFSense_Setting_Frame0

    • Data Sources:: Setting Commands
  • Analysis table:

TOFSense-B-Setting-Frame.png

Software

TOF Assistant is the debugging software supporting the TOF laser ranging module. Its main functions are configuration debugging, status display, function application, and firmware upgrade:

  • Configuration and debugging: used to configure node-related parameters, such as ID, working mode, baud rate, etc.
  • Functional application: used for application development, such as data import and export, motion track storage, historical track playback, etc.
  • Firmware upgrade: used to upgrade the product by wired firmware.

Dimensions

  • TOF-Laser-Range-Sensor-B-details-size.jpg