The module mainly uses a grayscale sensor for line detection, which is a photoelectric sensor with strong anti-interference, in which the light source of the transmitter tube adopts a bright white concentrating LED, and the light emitted from the end of the transmitter tube is reflected by different environmental backgrounds, and finally received by the photosensitive receiver tube, and the impedance of the photosensitive receiver tube changes with the change of the intensity of the reflected light (the stronger the reflected light, the smaller the resistance value), and finally the dual output of digital and analog signals is realized through the voltage division and op-amp comparison circuit. The grayscale sensor module has a very good recognition effect on different background environments of white light reflection, and the greater the background difference, the better the resolution effect. Compared with ordinary infrared sensors, grayscale sensors have higher anti-interference ability. The module supports five digital outputs, identifying the black line output 0 and not recognizing the black line output 1, and we can adjust the tracking detection height by setting the grayscale reflection simulation threshold.The module can also directly read the analog voltage value on the five-way grayscale receiver sensor, and the value is larger when the black line is detected or closer to the black line, and vice versa.
- Working voltage: 3~5V
- Communication method: IIC
- Interface Type: PH2.0-4Pin (G V SDA SCL)
- Detection height: 0.5cm ~ 4 cm
- Output values: analog and digital values
- I2C address: 0x50
| PIN Name | Description |
|---|---|
| V | 3~5V power pin |
| G | GND |
| SDA | IIC data pin |
| SCL | IIC clock pin |
The Trace module reads the received analog and digital values for each optical probe. Each probe has a high threshold and a low threshold. When the analog value is above the high threshold, the numerical value is 0, and when the analog value is below the low threshold, the numeric value is 1. If the analog value is between the high threshold and the low threshold, the numerical value does not change. In other words, when the analog value increases, it needs to be higher than the high threshold for the numerical value to become 0, and when the analog value decreases, it needs to be below the low threshold for the numerical value to become 1, so as to achieve the effect of delay reversal.The high and low threshold can be set by the user according to the actual scenario. If the user does not set it, the default value in the factory firmware will be used. It is recommended to install the module on the trolley first, so that the probe is about 1CM above the ground. Then, put the car on the line so that all the probes can detect the line, and then use the program to read out the analog value and calculate the average value, which is written as X. Then, put the car offline so that all probes can detect the non-line ground, and use the program to read out the analog value again and calculate the average value, which is written as Y. The high threshold can be set to (X - Y) * 2 / 3 + Y, and the low threshold can be set to (X - Y) / 3 + Y
Click here to download the Arduino library and sample code
Click here to download the ESP32MicroPython sample code
Click here to download the micro:bit MicroPython sample code
Makecode extensions: https://github.com/emakefun-makecode-extensions/emakefun_five_line_tracker_v3