How can we make the car detect the black line and drive along it? This experiment will demonstrate this using the Arduino UNO R3 DS 6-channel line patrol smart robot car as an example.
1. Experimental Overview
Use ArduinoUNO motherboard, six-channel infrared sensor module and PWR.AR series power driver board from XiaoR Technology to program and detect black lines.
Through this experiment, you can learn and master the most basic I/O port control and infrared principles.
2. Experimental Equipment
1. Arduino mainboard 2. PWR powerboard
3. 6-channel infrared tracking module 4. Download cable
5. Some Dupont wires
6. Batteries
3. Principle of tracking
The front end of the infrared sensor contains an infrared transmitter and an infrared receiver. The infrared emission intensity is adjusted by the tail knob (clockwise to increase, counterclockwise to decrease). After the infrared ray hits the surface of the object, it is reflected. After receiving the reflected infrared light signal, the infrared receiver will change its own resistance. When the intensity of the reflected light reaches a certain level and the resistance is lower than the set value, it will trigger the comparator state change and output a low level. In our opinion, an obstacle is detected. The closer the obstacle is, the stronger the reflection intensity is; the farther the obstacle is, the weaker the reflection intensity is; different surface colors have different reflectivity, white is the strongest and black is the weakest.
4 Simple tracking algorithm
A six-channel infrared obstacle avoidance module is installed on the front of the car as a sensor to detect black lines. When the level returned by the sensor is 0, it indicates that it is a normal ground, and when the level returned by the sensor is 1, it indicates that it is a black line. According to the status of the two infrared probes, the position of the front of the car on the black line is judged, and then the direction of the car body is calibrated. Each program cycle will perform a direction calibration until the car consistently maintains a state parallel to the black line and the sensor will not be triggered.
Note: Red represents the state of the sensor light on, and gray represents the state of the sensor light off.