NOOPLOOP TOFSense TOF Laser Ranging User Manual

July 31, 2024
Nooploop

NOOPLOOP TOFSense TOF Laser Ranging

Disclaimer

Document Information


Nooploop reserves the right to change product specifications without notice. As far as possible changes to functionality and specifications will be issued in product specific errata sheets or in new versions of this document. Customers are advised to check with Nooploop for the most recent updates on this product.

Life Support Policy


Nooploop products are not authorized for use in safety-critical applications (such as life support) where a failure of the Nooploop product would cause severe personal injury or death. Nooploop customers using or selling Nooploop products in such a manner do so entirely at their own risk and agree to fully indemnify Nooploop and its representatives against any damages arising out of the use of Nooploop products in such safety-critical applications.

Regulatory Approvals


The TOF Sense series sensors, as supplied from Nooploop currently have the following laser product certifications. Users need to confirm whether these certifications are applicable according to the region where such products are used or sold. All products developed by the user incorporating the TOF Sense series sensors must be approved by the relevant authority governing radio emissions in any given jurisdiction prior to the marketing or sale of such products in that jurisdiction and user bears all responsibility for obtaining such approval as needed from the appropriate authorities.

Certification instructions

  • TOF Sense series products comply with the Class1 standard specified in IEC 60825-1:2014 3rdedition
  1.  Caution – Use of controls or adjustments or performance of procedures other than those specified herein may result in hazardous radiation exposure.
  2.  According to IEC 60825-1:2014 Safety of laser products – Part 1:Equipment classification and requirements. The maximum output laser power of the product is 50.5uW.
  • TOF Sense series products comply with the Class 1 laser product standard specified in GB 7247.1-2012
  1. Attention: If control or adjustment devices are not used according to regulations, or if various steps of operation are not carried out according to regulations, it may cause harmful radiation exposure.
  2. According to GB 7247.1-2012 Safety of Laser Products – Part 1: Equipment Classification and Requirements. The maximum output laser power of the product is 50.5uW.

Introduction

This document mainly introduces how to use TOF Sense, TOF Sense-UART, TOF Sense S systems and the precautions to be taken during use. You may need to refer to the following materials to help you understand:

  • TOF Sense_Datasheet.pdf

UART Output

UART mode has two output modes: active output and query output. The two output modes can be switched by modifying the data output mode on NAssistant .

Connect TOF Sense series products to NAssistant through USB to TTL module (line sequence and power supply voltage reference datasheet). After successful recognition, click to enter the settings page. After configuring the parameters, click Write Parameter button to save the parameters. After the parameters are successfully written, the module will restart automatically. After waiting for the restart, the parameters can be read once to confirm whether the parameters are successfully written.

Active Output

UART active output mode can only be used in a single module.
Interface type is set to UART, data Output method is set to Active, and UART active output mode configuration is shown in Figure 1. After the parameter module is written and restarted, it will report data actively.
In this mode, the module actively outputs measurement information at a frequency of 30Hz, and the output format follows NLink_TOFSense_Frame0 protocol.

Query Output

UART query output mode can be used in single module and cascading situations.
Set Interface type as UART, set Output mode as INQUIRE. The configuration of UART query output mode is shown in Figure 2. After Write Parameter module is restarted, it will no longer actively report data.
In this mode, the controller sends a query instruction containing the module ID to the expected query module, and the module can output one frame of measurement information. The query frame format follows the protocol NLink_TOFSense_Read_Frame0, and the output frame format follows the protocol NLink_TOFSense_Frame0.

CAN Output

CAN Output mode has two output modes: Active Output and Query Output. The two output modes can be switched by modifying the data output mode on NAssistant .
Connect TOF Sense series products to NAssistant through the USB to TTL module (line sequence and power supply voltage reference datasheet). After successful recognition, click to enter the settings page. After configuring the parameters, click Write Parameter button to save the parameters. (If the CAN or IO mode has already been switched to before, the host computer will not be able to recognize it directly, you need to operate according to the method in Q6 of the FAQ.)

Active Output

CAN active output mode can be used in single module and cascading situations.
Interface type is set to CAN, data Output method is set to Active, and CAN active output mode configuration is shown in Figure 3. After Write Parameter module is restarted, it will report data actively(After writing the parameters, the module will return to CAN mode after being powered on again, and NAssistant will be temporarily unavailable for testing, requiring the use of equipment such as a CAN analyzer).
In this mode, the module actively outputs measurement information at a frequency of 30Hz, and the output format follows NLink_TOFSense_Frame0 protocol.

Query Output

CAN query output mode can be used in single module and cascading situations.
Interface type is set to CAN, Data Output Method is set to INQUIRE, and CAN query output mode configuration is shown in Figure 4. After Write Parameter module is restarted, it will no longer report data actively(After writing the parameters, the module will return to CAN mode after being powered on again, and NAssistant will be temporarily unavailable for testing, requiring the use of equipment such as a CAN analyzer).
In this mode, the controller sends a query instruction containing the module ID to the expected query module, and the module can output one frame of measurement information. The query frame format follows the protocol NLink_TOFSense_CAN_Read_Frame0, and the output frame format follows the protocol NLink_TOFSense_CAN_Frame0.

I/O Output

In I/O output mode, it can only be used in a single module. The module cannot output distance values.
TX/CAN_L and RX/CAN_H output complementary voltage levels, with the electrical states of the two signal lines being opposite to each other. The high level is 3.3V, and the low level is 0V. Additionally, it’s important to note that the output current is relatively low, so when driving other devices, it’s necessary to consider whether IO output pins can directly drive them. If not, methods such as using relays can be employed for driving purposes.
When the module is in UART mode (note that NAssistant cannot recognize modules in I/O mode), Connect TOF Sense series products to NAssistant software through USB to TTL module (line sequence and power supply voltage reference data manual). After successful recognition, click to enter the settings page. After configuring the parameters, click Write Parameter button to save the parameters.
Note: After switching to I/O mode, if you need to change parameters such as Band Start and Band Width, you can refer to the methods in the FAQ to change back to UART mode and then configure it.

Single Threshold

The interface type is set to IO, Band Start is set to 1000, Band Width is set to 0, and the IO single threshold configuration is shown in Figure 5. After the write parameter module is restarted, it will no longer output ranging values but output high and low levels.
After following the above settings, the threshold is Band Start=1000 (mm). In this mode, when the ranging value is less than 1m, RX is at a high level and TX is at a low level. When the ranging value is greater than 1m, RX is at a low level and TX is at a high level.
Example: When the ranging value is 0.3 meters, RX is high level and TX is low level. The ranging value increases to 1.2 meters, RX is low level, and TX is high level.

Double Threshold

The interface type is set to IO, the hysteresis starting point Band Start is set to 1000, and the hysteresis width Band is set to 500. The IO dual threshold configuration is shown in Figure 6. After the parameter module is written and restarted, it will no longer output ranging values but output high and low levels.

After following the above settings, the distance value in this mode is converted into high and low level output through hysteresis comparison. Invert the I/O port level when the distance increases from small to large and exceeds the high threshold, or when it decreases from large to small and falls below the low threshold.
For example, based on the above settings, the low threshold is 1 meter and the high threshold is 1.5 meters. (Low threshold=hysteresis starting point Band Start, high threshold=hysteresis starting point Band Start+ hysteresis width Band Width)
When the ranging value is 0.3 meters, RX is at a high level and TX is at a low level;
When the distance measurement value increases to 1.2 meters, RX is at a high level and TX is at a low level;
When the distance measurement value continues to increase by more than 1.5 meters, the level reverses, with RX being the low level and TX being the high level.
When the ranging value drops from over 1.5 meters to 1.2 meters, RX is at a low level and TX is at a high level.
When the distance measurement value continues to drop below 1 meter, the level reverses, with RX being the high level and TX being the low level.
The schematic diagram of hysteresis loop comparison is shown in Figure 7, The range of values for Band Start and Band Width is [0~8000], in millimeters.

FOV

The Field Of View angle parameter represents the angle that the module can cover by emitting ranging light. As shown in the figure below, the FOV area of the TOF Sense series products is a cone with a circular vertex on the bottom surface in the emission window. Taking a 27° field of view angle as an example, when facing a sufficiently large object under test, the diameter of the FOV coverage circle on the measured plane can be estimated using a trigonometric function to be R=L*tan27° (L: the distance between the TOF Sense module and the object under test).

The initial field of view angle parameters for the module are fov.x=27°, fov.y=27°, fov.x_offset=0°, fov.y_offset=0°. You can set the field of view angle in the X direction to 25° (corresponding to the top view in Figure 8), the field of view angle in the Y direction to 15° (corresponding to the side view in Figure 8), offset in the X direction by 1°, and offset in the Y direction by -1°. The region of interest of the module can be changed to the one shown on the right side of Figure 9.

When multiple measured objects are present within the FOV range of the module, as shown in Figure 10, the output measurement value will be abnormal. If high accuracy is required during use, such situations should be avoided as much as possible to reduce measurement errors.

A smaller FOV can improve the detection performance of modules in narrow spaces and small objects, but changes in the FOV field of view can also affect the farthest ranging distance of the module. The smaller the field of view angle, the smaller the farthest ranging distance. The relationship between the farthest ranging distance and the field of view angle FOV in a certain TOF Sense scene (indoor, white wall background) is shown in Figure 11. Users need to choose the appropriate field of view angle based on the actual scene.

Cascade Ranging

Multiple sensors can be configured with different IDs and connected in series, and the ranging information of all sensors can be read through a single communication interface. The connection schematic is shown in Figure 12. TOF Sense S only has one communication interface, so a converter is required for cascading.

Under cascade ranging, three methods are suitable: UART query, CAN query, and CAN active output.

Protocol Unpack

Introduction

This chapter’s protocol analysis examples are based on the NLink protocol, and you can also download the NlinkUnpack sample analysis code developed in C language from the official website, which can effectively reduce the user’s development cycle.
Based on the data situation of TOF Sense series products, in order to represent more data with fewer bytes, we use integers to represent floating- point numbers and transmit them through protocol frames.
Therefore, when unpacking, the actual data with the multiplier is actually a floating-point number and needs to be divided by the multiplier indicated in the protocol.
In particular, for type int24, we need to first convert it to type int32. To maintain the sign, we use the method of left shift and then divide by 256. For example, for position data, we use int24 to represent it, and the multiplier is 1000. The parsing code is as follows:
uint8_t byte[] = {0xe6,0x0e,0x00};//Decimal value:3.814
//uint8_t byte[] = {0xec,0xfb,0xff};//Decimal value:-1.044
int32_t temp = (int32_t)(byte[0] << 8 | byte[1] << 16 | byte[2] << 24) / 256;
float result = temp/1000.0f;
Currently, the protocol verification is mainly based on the single-byte checksum at the end of the
protocol frame. Example code:
uint8_t verify Check Sum(uint8_t *data, int32_t length){
uint8_t sum = 0;
for(int32_t i=0;i<length-1;++i){
sum += data[i];
}
return sum == data[length-1];}

Composition

UART

The default configuration of the serial port is: data bit 8 bit, stop bit 1 bit, no parity check, no flow control, default baud rate 921600bps.
Each data frame containing distance under the UART interface consists of 16 bytes of hexadecimal numbers. Distance and other data are arranged in little- endian mode.
The format of the serial communication output protocol data frame is shown in Table 1. The Protocol consists of Frame Header, Function Mark, Data, and Sum Check.

Table 1: Protocol Composition

Frame Header + Function Mark + Data + Sum Check

Frame Header: Frame header, fixed to 0x57.
Function Mark: Function word, the output protocol frame bit is fixed as 0x00, and the query protocol frame bit is fixed as 0x10.
Data: Data segment, the output protocol frame includes module ID, system time “System_ time”, measured value “dis”, distance status “dis status”, and signal strength “signal strength”. The query protocol frame only contains the ID of the queried module.
Sum Check: Checksum, perform a sum calculation on all bytes from Frame Header to except Sum Check, taking the lower 8 bits.
The output protocol frame can be found in Table 2: NLink_TOFSense_Frame0 parsing table, while the query protocol frame can be found in Table 3: NLink_TOFSenseRead_Frame0 parsing table.

CAN

CAN communication supports baud rate modification and ID modification protocol content as follows:
The default baud rate is 1000000bps, the receiving ID is 0x200+module ID, and the sending ID is fixed at 0x402.

Data: Data segment, output protocol frame containing measurement value “dis”, distance status “dis status”, signal strength “signal strength”, query protocol frame only containing the ID of the queried module.

The output protocol frame is detailed in Table 4: NLink_TOFSense_CAN_Frame0 parsing table, and the query protocol frame is detailed in Table 5: NLink_TOFSense_CAN_Read_Frame0 parsing table.

Example

This document takes single module continuous ranging as the application scenario.

NLink_TOFSense_Frame0

Data source : Connect the module to the host computer, configure UART as active output mode, using NLink_TOFSense_Frame0 protocol. For parsing distance data, please refer to FAQ.
Raw data : 57 00 ff 00 9e 8f 00 00 ad 08 00 00 03 00 ff 3a

Table 2: NLink_TOFSense_Frame0

Data Type Length (Bytes) Hex Result
Frame Header uint8 1 57 0x57
Function Mark uint8 1 00 0x00
reserved uint8 1 *
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
reserved uint8 1 *
Sum Check uint8 1 3a 0x3a

NLink_TOFSense_Read_Frame0

Data source : Connect the module to the host computer, configure it as UART query output mode with ID set to 0. To query data, send the following bytes from the host computer.
If you need to query modules with different IDs, simply change ID and checksum accordingly.
Example: The module query instruction for id=3 should be: 57 10 ff ff 03 ff ff 66.
Raw data : 57 10 ff ff 00 ff ff 63

Table 3 : NLink_TOFSense_Read_Frame0

Data Type Length (Bytes) Hex Result
Frame Header uint8 1 57 0x57
Function Mark uint8 1 10 0x10
reserved uint16 2 *
id uint8 1 00 0
reserved uint16 2 *
Sum Check uint8 1 63 0x63

NLink_TOFSense_CAN_Frame0

Data source : Configure the module as CAN active output mode with ID set to 1, and connect it to the CAN receiving device.
Raw data : StdID:0x201 + Data: ad 08 00 00 03 00 ff ff

Table 4: NLink_TOFSense_CAN_Frame0

Field name| Part| Level| Type| Length(bits)| Hex| Result
---|---|---|---|---|---|---
Start Of Frame| SOF| | | 1| |
Arbitration Field| ID| |
| 11| 0x200+id| 0x201
RTR| | | 1| |
Control Field| IDE| |
| 1| |
r0| | | 1| |
DLC| |
| 4| |
Data Field| dis1000| | uint24| 24| ad 08 00| 2.221m
dis status| | uint8| 8| 00| 0
signal
strength| | uint16| 16| 03 00| 3
reserved| | uint16| 16| …|

CRC Field| CRC| | | 15| |
CRC_ delimiter| |
| 1| |
ACK Field| ACK Slot| | | 1| |
ACK_ delimiter| |
| 1| |
End Of Frame| EOF| | | 7| | *
| Dominant level
---|---
| Dominant or recessive level
| Recessive level

NLink_TOFSense_CAN_Read_Frame0

Data source : The module is configured for CAN query output mode with an ID of 1. Connect the CAN query device, and the query device’s ID (id_ s) is 2.
Raw data : StdID:0x402 + Data: ff ff ff 01 ff ff ff ff

Table 5: NLink_TOFSense_CAN_Read_Frame0

Field name| Part| Level| Type| Length(bits)| Hex| Result
---|---|---|---|---|---|---
Start Of Frame| SOF| | | 1| |
Arbitration Field| ID| |
| 11| 0x400+ids| 0x402
RTR| | | 1| |
Control Field| IDE| |
| 1| |
r0| | | 1| |
DLC| |
| 4| |
Data Field| reserved| | uint24| 24| …|
id| | uint8| 8| 01| id = 1
reserved| | uint32| 32| …|

CRC Field| CRC| | | 15| | *
CRC
delimiter| | | 1| |
ACK Field| ACK Slot| |
| 1| |
ACK_ delimiter| | | 1| |
End Of Frame| EOF| |
| 7| |
| Dominant level
---|---
| Dominant or recessive level
| Recessive level

FAQ

Q1. Can it be used outdoors (in bright light) conditions?

The module is affected by natural light. Generally speaking, the stronger the natural light, the more it will be affected, resulting in shorter ranging distance, poorer accuracy, and larger fluctuations. In strong light conditions (such as sunlight), it is generally recommended to use the module for short- range detection scenarios.

Q2. Is there interference between multiple modules?

When multiple modules are working at the same time, even if the infrared light emitted from one module crosses or hits the same position as another module, it will not affect the actual measurement.
However, if two modules are at the same horizontal height and facing each other, the measurement may be affected for both of them.

Q3. Why is there no data output from TOF Sense?

Each module has undergone strict testing before shipping. If there is no data, please first check if the Mode, wiring (power supply voltage, wire sequence correctness, and whether the pins on both sides of the communication are conducting as recommended by using a multimeter to test), Baud Rate and other configurations are correct. For the CAN output mode, Please check if the bus contains terminal resistance (usually 120 Ω); For the I/O output mode, please refer to the relevant chapters on I/O mode.

Q4. What should be noted during installation?

If you do not want to detect the ground or other reflective surfaces, it is necessary to avoid obstructions within the FOV angle during installation. Additionally, the ground height should be taken into consideration, and it is necessary to avoid obstructions such as ground reflections within the FOV. If the installation height is close to the ground, the module can be slightly tilted upwards for installation.

Q5. Are the module’s UART, CAN, and I/O the same interface?

The UART interface and the CAN interface of the module share the same physical interface. To switch between different communication modes, simply convert the corresponding wire sequence. Please note that some models only support one communication mode.

Q6. After switching to CAN or IO mode, why can’t NAssistant recognize the module? How to switch between different communication modes?
Currently, NAssistant software only supports the recognition of modules in UART mode. In UART mode, after successful recognition by the host computer, the module can be configured as CAN or IO communication mode on the settings page. In CAN or IO communication mode, hold down the button and power on the module. When the indicator light changes from rapid flashing to slow flashing, release the button. At this time, the module will forcibly enter temporary UART mode. Then, select the UART mode on the settings page and write the parameters into the module through the host computer.
For TOF Sense S, in CAN mode, you can use a USB-to-TTL module to connect to the host computer.
Change the baud rate to 921600 and connect it to the corresponding port of the USB-to-TTL module. Click the recognition button several times to recognize the module normally.

Q7. What should be noted during firmware updates?

During the update process, do not power off or unplug the USB-to-TTL module. After clicking on the firmware update, wait for the indicator light to change from fast flashing to slow flashing before the module can be used normally.

Q8. Does the module output the shortest distance, the longest distance, or the average distance?

During a single measurement, the module will obtain multiple distance values within the FOV and process them internally to output the distance with the highest proportion.

Q9. Does the module support outputting point cloud information?

The module can only output a single distance value at a time and does not currently support point cloud information output.

Q10.How is distance output in different ranging modes, as well as when exceeding the range?

When the ranging exceeds the measurement range, the data will jump. It is recommended to judge the data availability directly through the distance status, and generally only a distance status of 0 indicates that the data is available.

Q11.What is the reason for not being able to query data in CAN query mode?

First, make sure that the wire sequence between the CAN devices is correct. Secondly, the TOF Sense series port does not contain a 120R matching resistor, so make sure that the resistance of the query device matches. Finally, check whether the format of the sent query frame meets the NLink_TOFSense_CAN_Read_Frame0 protocol, and pay special attention to the correct standard frame ID.

Q12. What is the reason for not being able to enter UART configuration mode when holding down the button?

The function button has been tested before shipment, if you cannot enter UART mode, please try again several times. Please note that the button needs to be pressed before power on, and released after the light flashes slowly.

Q13.What is the model of the serial communication terminal used by the module? What to do if there is no such terminal interface on the flight controller or microcontroller?

The module uses GH1.25 terminals. You can purchase GH1.25 to other terminal adapter cables, or cut the GH1.25-GH1.25 cable provided with the product and solder other terminals by yourself. For wire sequence, power supply voltage, signal line voltage level, please refer to the data manual.

Q14.How to calculate the distance value from the received data “ad 08 00”?

The data in the protocol frame is stored in little-endian mode and is encoded by multiplying a certain multiple. For example, if the hexadecimal data “ad 08 00” is restored, it becomes the decimal value of 2221 after conversion to hexadecimal as 0x0008ad, and divided by 1000 to obtain the value of 2.221 meters.

Q15.How is the checksum calculated?

The checksum is calculated by adding up all the previous bytes and taking the lowest byte of the result.
For example, the checksum of “55 01 00 ef 03” is calculated as follows:
0x55+0x01+0x00+0xef+0x03=0x0148. The checksum is 0x48, so the complete data frame is “55 01 00 ef 03 48”.

Q16.What should I do if there is an error during compilation or no data is obtained when using the ROS driver package?

Before using the ROS driver package, users need to read the README.MD document in the driver package, and follow the steps and precautions in the document to use it. Users can also refer to the “ROS Driver Application Tutorial” on the official website for instructions on how to use it.

Reference

  1.  TOFSense_Datasheet.pdf

Abbreviation and Acronyms

Table 6: Abbreviation and Acronyms

Abbreviation Full Title
TOF Time of Flight
FOV Field of View

Update Log

Table 7: Update Log

Version Firmware Version Data Description
1.0 1.0.0 20190817
  1. Published the first edition of the manual

1.1| 1.0.4| 20190923|

  1. Added an example of setting FOV through UART
  2. Added the description of setting FOV
  3. Added FAQ
  4. Corrected some data

1.2| 1.0.6| 20191213|

  1. Add explanation for FOV settings
  2. Corrected some data

2.0| 2.0.0| 20200730|

  1. Added the explanation of I/O mode
  2. Extended FAQ
  3. Corrected some data

2.1| 2.0.0| 20210623|

  1. Added descriptions of TOF Sense P and TOF Sense PS
  2. Extended FAQ
  3. Optimized manual description

2.2| 2.0.3| 20220211|

  1. Optimized manual description

2.3| 2.0.4| 20220924|

  1. Added certification related instructions

2.4| 2.0.4| 20221205|

  1. Optimized section description

2.5| 2.0.4| 20230404|

  1. Added the description of the firmware updating
  2. Expand FAQ and optimize partial description

2.6| 2.0.4| 20240221|

  1. Expand FAQ and optimize partial description
  2. Optimization section description
  3. Add protocol frame composition
  4. Remove firmware update description

2.7| 2.0.4| 20240401|

  1. Remove P-series
  2. Optimization section description
  3. Fix some image citation errors

3.0| 3.0.4| 20240703|

  1. Optimize some illustrations
  2. Optimization section FAQ description
  3. Remove some abbreviations

CUSTOMER SUPPORT

Further Information

Address: A2-218, Peihong building, No.1, Kehui Road, Science Park community, Yuehai street,
Nanshan District, Shenzhen
Email: sales@nooploop.com
Tel: +86 0755-86680090
Website: www.nooploop.com
Copyright©2024Nooploop. All Rights Reserved.

References

Read User Manual Online (PDF format)

Loading......

Download This Manual (PDF format)

Download this manual  >>

Related Manuals