Hardware Connection
The output of TOFSense is TTL level, which can be directly connected to the serial port (UART) pin of the microcontroller. If you need to use the NAssistant host computer, you need to use USB to TTL to connect TOFSense to the USB interface. If you need to connect to RS232, RS485 and other interfaces, you need to use the corresponding adapter module.
1 Interface and Line Sequence
TOFSense/-UART/F/FP/F2/F2 Mini/F2 P/F2 PH/M models all use the following standard GH1.25 4P female connector, while TOFSense-S/MS models use GH1.25 4P male connector.
For the GH1.25 4P female connector with the UART mode snap groove facing upwards, the line sequence from right to left is VCC, GND, RX, TX.
For the GH1.25 4P female connector with the IIC mode buckle groove facing upward, the line sequence from right to left is VCC, GND, SDA, SCL.
For the GH1.25 4P female connector with the CAN mode buckle groove facing upwards, the line sequence from right to left is VCC, GND, CAN_H, CAN_L.
2 USB to TTL
The default baud rate of TOFSense is 921600. It is recommended that users use a USB to TTL converter that supports high baud rates and can work stably at high baud rates. Generally, it is recommended to use CP2102, CH343 and some CH340 models that support high baud rates.
Generally, first-time users are advised to directly purchase the TOFSense adapter kit, which contains a USB to TTL converter of CH343 with a GH1.25 interface, avoiding secondary wiring for users.
The module comes with a double-ended GH1.25 interface data cable. If the user does not have a USB to TTL converter with a GH1.25 interface, the user can cut the free small black wire in half, and then use DuPont wire to solder the adapter by themselves. If you solder by yourself, please pay attention to the following points
- Use solder to connect the two data lines, do not twist the two data lines together directly.
- It is not recommended to use quick crimping connectors to directly crimp the wire ends.
- Take protective measures and do not leave the wires exposed.
- If you don't have the hands-on skills, I suggest you buy a NUTT-B USB to TTL adapter from the Nooploop store, or buy a GH1.25 4P to Dupont cable adapter from Taobao.
- The adapter cable should not be too long. It is generally recommended that the data cable be around 30~50cm.
The following figure shows the wiring example of USB to TTL and TOFSense:
After correctly wiring and installing the corresponding USB to TTL driver, you can find the corresponding port in the device manager. However, some USB to TTL converters may have the following problems. If you encounter them, you can try to change a USB to TTL converter or search for related solutions on Baidu.
Common Ground
When wiring the TOFSense laser distance sensor, if the USB-to-TTL adapter does not provide 5V power and the user opts for an external power supply, it is crucial to ensure that the USB-to-TTL adapter, TOFSense, and the power supply share a common ground. Failure to do so may result in the following issue: although the serial debugging tool may display structured data, the lack of a common ground could lead to data anomalies, making it impossible for the NAssistant software to recognize the data correctly.
3 Cascade
Some TOFSense models support cascading. For modules with two interfaces, you only need to set the corresponding mode and parameters on NAssistant in advance and then directly connect the two interfaces of the module.
For models with only one line, users need to make the connection by themselves. The wiring diagram is as follows: connect the VCC, GND, RX, and TX of all TOFSense modules one by one and then connect them to the main controller.
Or the user can draw a cascade board specifically for cascading.
PS: Notes
When using cascade, you need to pay attention to the power supply. For example, the TOFSense-M model consumes slightly more power than the TOFSense, so the current required for cascade is greater. It is recommended that users calculate and reserve enough power in advance.At the same time, in order to ensure stable operation, it is generally recommended that users use a separate power supply to power the TOFSense group, and do not share a power supply with other high-power electrical appliances.
There will be voltage drop in cascading. With each additional TOFSense module, the voltage obtained by the next TOFSense module will become lower. If the voltage is lower than the minimum operating voltage, the module will restart frequently and fail to work properly. Therefore, it is generally not recommended to cascade too many TOFSense on one line. Solutions: 1. Use star power supply 2. Group TOFSense and use one power supply for every group of 3.
4 TTL to 485
Since TOFSense is TTL level, if the user needs to connect to the 485 bus, it cannot be connected directly and an adapter module must be used. The general line sequence is as shown in the figure below (the specific line sequence needs to be checked in the instructions for the user to use the adapter module).
Example
Wiring: TOFSense —— TTL to 485 —— 485 to TTL —— USB to TTL —— Computer USB
Adapter module used in the exampleLink
5 TTL to 232
Since TOFSense is TTL level, if the user needs to connect to the 232 bus, it cannot be connected directly and an adapter module must be used. The general line sequence is as shown in the figure below (the specific line sequence requires reference to the user's instructions for using the adapter module).
Example
Wiring: TOFSense —— TTL to 232 —— 232 to TTL —— USB to TTL —— Computer USB
Adapter module used in the exampleLink