Current location - Music Encyclopedia - Today in History - Can the tracking car take the planned route?
Can the tracking car take the planned route?
Yes, but you need to be able to write programs.

1. Selection of car control and drive unit This part is the brain of the whole car, the core component of the whole car operation, and plays a role in controlling all the running states of the car. Usually, single-chip microcomputer is selected as the core control unit of the car, and SPCE06 1A single-chip microcomputer of Taiwan Province Lingyang Company is used as the control unit of the car. SPCE06 1 is a 16-bit microprocessor with 2K RAM, 32KFlash, 32 I/O ports and powerful AD/DA functions. It also has rich speech processing functions, which provides a considerable space for the expansion of automobile functions. As long as it is programmed according to the requirements of the microcontroller, many different functions can be realized. Generally, the motor of automobile drive adopts the DC motor matched with the ready-made toy car. Considering that the car must be able to move forward, backward, stop and turn flexibly, a motor is installed on the left and right wheels to drive them respectively. When the left wheel motor speed is higher than the right wheel motor speed, the car turns right, otherwise it turns left. In order to control the wheel speed, PWM speed regulation can be adopted, that is, IOB8 and IOB9 of single chip microcomputer output a series of square waves with fixed frequency, and then drive the motor through power amplification. The average voltage applied to the motor can be changed by programming the duty ratio of the output square waves through single chip microcomputer, thus changing the motor speed. The coordination of the rotational speeds of the two motors on the left and right wheels can realize the functions of car forward, backward and turning. 2. The principle of car tracking The tracking here refers to the car walking along the black line on the white floor. The usual method is infrared detection. Infrared detection method, that is, using the characteristics that infrared rays have different reflective properties on the surfaces of objects with different colors, continuously emits infrared rays to the ground during the driving process of the automobile, and diffuse reflection occurs when the infrared rays meet the white floor, and the reflected light is received by the receiving tube installed on the automobile; If you encounter a black line, the infrared light will be absorbed, and the receiving tube on the car will not receive the infrared light. The single chip microcomputer determines the position of the black line and the running route of the car according to whether it receives the reflected infrared light or not. The detection distance of infrared detector is limited, generally the maximum should not exceed 15cm. For the infrared probe that emits and receives infrared rays, we can make our own or directly adopt the integrated infrared probe. (1) The self-made infrared probe circuit is shown in figure 1, and the model is ST 168, which is used to send and receive infrared light. When the car runs on the white ground, the infrared emission tube installed under the car sends out infrared signals, which are reflected by white light and received by the receiving tube. Once the receiving tube receives the signal, the phototransistor in the figure will be turned on and the output of the comparator will be low. When the car drives to the black guide line, after the infrared signal is absorbed by black, the phototransistor is turned off and the comparator outputs a high level, thus realizing the function of detecting the signal through infrared. Send the detected signal to the I/O port of the single chip microcomputer. When the signal detected by the I/O port is high level, it means that the infrared light is absorbed by the black conductor on the ground, indicating that the car is on the black conductor; Similarly, when the signal detected by the I/O port is low, it means that the car is driving on the white ground. This method is simple, cheap and adjustable in sensitivity, but it is easily influenced by the surrounding environment, especially under the strong fluorescent lamp of figure 1, which has certain influence on the detected signal. (2) The integrated infrared probe can adopt E3F-DS 10C4 integrated intermittent photoelectric switch detector with simple and reliable working performance, and the sensitivity of the probe can be controlled by adjusting the knob on the probe. There are only three wires (power wire, ground wire and signal wire) at the output end of the probe. As long as the signal line is connected to the I/O port of the single chip microcomputer, the I/O port is continuously scanned and detected, and white paper is detected at high level and black line is detected at low level. The probe can also effectively prevent the interference of ordinary light sources (such as fluorescent lamps). Its disadvantage is that it is relatively large and takes up limited space in the car. 3. The infrared probe is installed in the specific tracking process of the automobile. In order to accurately determine the position of the black line and the direction of the car, it is necessary to install four infrared probes on the chassis at the same time to carry out two-stage direction correction control to improve its tracking reliability. The specific positions of these four infrared probes are shown in Figure 2. In the figure, four tracking sensors are installed, all in a straight line. Among them, InfraredMR and InfraredML are the first-stage direction control sensors, and InfraredSR and InfraredSL are the second-stage direction control sensors. When the car is walking, always keep the black line between the two primary sensors, InfraredMR and InfraredML (as shown in Figure 2). When the car deviates from the black line, once the primary detector detects the black line, the single chip microcomputer will send instructions to the control system of the car according to the pre-programmed program, and the control system will correct the path of the car. If the car returns to the track, that is, all four detectors only detect white paper, the car will continue to walk; If the car still deviates from the track due to excessive inertia, which is beyond the detection range of the two detectors in the first stage, then the movement of the car in the second stage will be corrected again to make it return to the correct track. It can be seen that the second-stage direction detector is actually the first-stage backup protection, thus improving the reliability of automobile tracking. 4. The program control block diagram of software control is shown in Figure 3. After the car enters the tracking mode, it begins to scan the I/O port of the single chip microcomputer connected with the detector. Once the signal is detected at the I/O port, it enters the judgment processing program (switch), and first determines which of the four detectors has detected the black line. If the InfraredML (left primary sensor) or InfraredSL (left secondary sensor) detects the black line, that is, the left half of the car presses the black line. If the black line is detected by InfraredMR (the first sensor on the right) or InfraredSR (the second sensor on the right), that is, the right half of the car body presses the black line and the car deviates from the track to the left, then the car should turn to the right. After the direction is adjusted, the car will continue to move forward, continue to detect the black line and repeat the above actions. Since the second stage direction control is the backup of the first stage, the steering force between the two stages must cooperate with each other. Design of electric tracking vehicle 1. The control and drive unit selection of the vehicle is the brain of the vehicle, the core component of the vehicle operation, and plays a role in controlling all the running states of the vehicle. Usually, single-chip microcomputer is selected as the core control unit of the car, and SPCE06 1A single-chip microcomputer of Taiwan Province Lingyang Company is used as the control unit of the car. SPCE06 1 is a 16-bit microprocessor with 2K RAM, 32KFlash, 32 I/O ports and powerful AD/DA functions. It also has rich speech processing functions, which provides a considerable space for the expansion of automobile functions. As long as it is programmed according to the requirements of the microcontroller, many different functions can be realized. Generally, the motor of automobile drive adopts the DC motor matched with the ready-made toy car. Considering that the car must be able to move forward, backward, stop and turn flexibly, a motor is installed on the left and right wheels to drive them respectively. When the left wheel motor speed is higher than the right wheel motor speed, the car turns right, otherwise it turns left. In order to control the wheel speed, PWM speed regulation can be adopted, that is, IOB8 and IOB9 of single chip microcomputer output a series of square waves with fixed frequency, and then drive the motor through power amplification. The average voltage applied to the motor can be changed by programming the duty ratio of the output square waves through single chip microcomputer, thus changing the motor speed. The coordination of the rotational speeds of the two motors on the left and right wheels can realize the functions of car forward, backward and turning. 2. The principle of car tracking The tracking here refers to the car walking along the black line on the white floor. The usual method is infrared detection. Infrared detection method, that is, using the characteristics that infrared rays have different reflective properties on the surfaces of objects with different colors, continuously emits infrared rays to the ground during the driving process of the automobile, and diffuse reflection occurs when the infrared rays meet the white floor, and the reflected light is received by the receiving tube installed on the automobile; If you encounter a black line, the infrared light will be absorbed, and the receiving tube on the car will not receive the infrared light. The single chip microcomputer determines the position of the black line and the running route of the car according to whether it receives the reflected infrared light or not. The detection distance of infrared detector is limited, generally the maximum should not exceed 15cm. For the infrared probe that emits and receives infrared rays, we can make our own or directly adopt the integrated infrared probe. (1) The self-made infrared probe circuit is shown in figure 1, and the model is ST 168, which is used to send and receive infrared light. When the car runs on the white ground, the infrared emission tube installed under the car sends out infrared signals, which are reflected by white light and received by the receiving tube. Once the receiving tube receives the signal, the phototransistor in the figure will be turned on and the output of the comparator will be low. When the car drives to the black guide line, after the infrared signal is absorbed by black, the phototransistor is turned off and the comparator outputs a high level, thus realizing the function of detecting the signal through infrared. Send the detected signal to the I/O port of the single chip microcomputer. When the signal detected by the I/O port is high level, it means that the infrared light is absorbed by the black conductor on the ground, indicating that the car is on the black conductor; Similarly, when the signal detected by the I/O port is low, it means that the car is driving on the white ground. This method is simple, cheap and adjustable in sensitivity, but it is easily influenced by the surrounding environment, especially under the strong fluorescent lamp of figure 1, which has certain influence on the detected signal. (2) The integrated infrared probe can adopt E3F-DS 10C4 integrated intermittent photoelectric switch detector with simple and reliable working performance, and the sensitivity of the probe can be controlled by adjusting the knob on the probe. There are only three wires (power wire, ground wire and signal wire) at the output end of the probe. As long as the signal line is connected to the I/O port of the single chip microcomputer, the I/O port is continuously scanned and detected, and white paper is detected at high level and black line is detected at low level. The probe can also effectively prevent the interference of ordinary light sources (such as fluorescent lamps). Its disadvantage is that it is relatively large and takes up limited space in the car. 3. The infrared probe is installed in the specific tracking process of the automobile. In order to accurately determine the position of the black line and the direction of the car, it is necessary to install four infrared probes on the chassis at the same time to carry out two-stage direction correction control to improve its tracking reliability. The specific positions of these four infrared probes are shown in Figure 2. In the figure, four tracking sensors are installed, all in a straight line. Among them, InfraredMR and InfraredML are the first-stage direction control sensors, and InfraredSR and InfraredSL are the second-stage direction control sensors. When the car is walking, always keep the black line between the two primary sensors, InfraredMR and InfraredML (as shown in Figure 2). When the car deviates from the black line, once the primary detector detects the black line, the single chip microcomputer will send instructions to the control system of the car according to the pre-programmed program, and the control system will correct the path of the car. If the car returns to the track, that is, all four detectors only detect white paper, the car will continue to walk; If the car still deviates from the track due to excessive inertia, which is beyond the detection range of the two detectors in the first stage, then the movement of the car in the second stage will be corrected again to make it return to the correct track. It can be seen that the second-stage direction detector is actually the first-stage backup protection, thus improving the reliability of automobile tracking. 4. The program control block diagram of software control is shown in Figure 3. After the car enters the tracking mode, it begins to scan the I/O port of the single chip microcomputer connected with the detector. Once the signal is detected at the I/O port, it enters the judgment processing program (switch), and first determines which of the four detectors has detected the black line. If the InfraredML (left primary sensor) or InfraredSL (left secondary sensor) detects the black line, that is, the left half of the car presses the black line. If the black line is detected by InfraredMR (the first sensor on the right) or InfraredSR (the second sensor on the right), that is, the right half of the car body presses the black line and the car deviates from the track to the left, then the car should turn to the right. After the direction is adjusted, the car will continue to move forward, continue to detect the black line and repeat the above actions. Since the second stage direction control is the backup of the first stage, the steering force between the two stages must cooperate with each other. The second stage usually works outside the control scope of the first stage and is also the last layer of protection. Therefore, it must ensure that the car returns to the right track, so the steering force in the second stage is usually greater than that in the first stage, that is, level2 & gt level1(level1and level 2 are the steering forces of the car, and their magnitude can be changed by changing the duty ratio output by the single chip microcomputer), and the specific values are obtained in the field experiments. According to the method introduced above, we can easily make an intelligent electric car that walks along a certain trajectory. However, if the car goes straight in this way, it may move into a snake shape. In order to make the car walk more smoothly according to the trajectory, some simple algorithms can be used in software programming. For example, when correcting the car, stop correcting the car appropriately in advance, instead of waiting until the car is completely impartial to prevent the car from overshooting. The second stage usually works outside the control scope of the first stage and is also the last layer of protection. Therefore, it must ensure that the car returns to the right track, so the steering force in the second stage is usually greater than that in the first stage, that is, level2 & gt level1(level1and level 2 are the steering forces of the car, and their magnitude can be changed by changing the duty ratio output by the single chip microcomputer), and the specific values are obtained in the field experiments. According to the method introduced above, we can easily make an intelligent electric car that walks along a certain trajectory. However, if the car goes straight in this way, it may move into a snake shape. In order to make the car walk more smoothly according to the trajectory, some simple algorithms can be used in software programming. For example, when correcting the car, stop correcting the car appropriately in advance, instead of waiting until the car is completely impartial to prevent the car from overshooting.