Odor Tracking Vehicle Design Based on STC12C5A60S2 Single Chip Microcomputer and PID Control Algorithm

The tracking of odor sources is one of the current research hotspots, and it has been widely used in daily life and production. This paper introduces a simple and intelligent odor tracking car based on STC12C5A60S2 microcontroller design. Two odor sensors are used to judge the odor flow according to the concentration difference, and the rudder angle is controlled by the PID algorithm to make the car follow the odor. The design structure of the whole hardware module is simple and flexible. Through experimental simulation, the car can achieve the odor tracking requirement in the environment of the indoor time-varying airflow field.

Odor tracking can be used to find leaking sources of toxic and harmful gases, and to find explosive sources. It has been highly concerned by researchers and developed very rapidly. At the same time, with the enhancement of people's daily life intelligence, cars and robots with intelligent control systems emerge in an endless stream, and these agents will play a more important role in industrial production and daily life in the future. A smart car is a comprehensive system that senses the environment and automatically travels purposefully. We can also think that the smart car is also a form of intelligent robot, and its legs are replaced by wheels, which makes it easier to implement and control.

The long time-consuming and poor follow-up performance is a common situation in the current tracking process of intelligent scent tracking vehicles. The control core of the intelligent odor tracking vehicle introduced in this paper is the STC12 single-chip microcomputer, which can automatically sense the specific odor nearby and apply it.

The PID algorithm adjusts the steering gear, and the control direction follows the scent to move forward. The experimental results show that the tracking time can be effectively shortened and the following performance of the smart car can be improved.

1 hardware system and its working principle

1.1 Hardware System Design

The components of the smart car system (Fig. 1) are: power module (variable voltage regulator), control processing module, sensor module (exploration of smell), steering control module, motor drive module and status display module. The control processing module is STC12 C5A single-chip microcomputer. The motor is driven by ULN2003APC, which adopts rear wheel drive. The servo is directly controlled by the single-chip microcomputer, and the steering gear controls the front wheel steering. Part of the circuit diagram (Figure 2) and the board physical diagram (Figure 3) are as follows.

A.jpg

B.jpg

1.2 Introduction to working principle

In this design, the smart car first senses the odor concentration in two directions by the odor sensor, and transmits it to the AD port of the single chip microcomputer, and judges by the single chip microcomputer to judge the concentration of the two directions, and then controls the steering gear to make the declination through the PID algorithm. Follow the track.

C.jpg

2 chip configuration and its functions

2.1 Introduction of Single Chip Microcomputer STC12C5A60S2

The pin diagram of STC12C5A60S2 is shown in Figure 4.

The device has the following configuration: The RAM has 1 280 bytes and has 40 general-purpose I/O ports. After reset, it is a quasi-bidirectional port/weak pull-up. With EEPROM, watchdog function. The 5.0 V microcontroller is 11 to 17 MHz, and the 3.3 V microcontroller is 8 to 12 MHz. Power Down mode can be awakened by an external interrupt, INT0/P3.2, INT1/P3.3, T0/P3.4, T1/P3.5, RxD/P3.0, CCPO/P1.3, CCPO/P1.3.

Dual serial port, RxD2/P1.2, TxD2/P1.3.

The odor sensor is the key module of the odor tracking car. The accuracy of the gas sensing is related to whether the car can finally find the odor source. This experiment uses an MS5100 sensor. After the MS5100 is energized, the metal compound in the circle can sense a specific odor, and its resistance decreases as the odor concentration increases, and then increases, and is sent to the AD port of the single chip microcomputer, because the single chip can judge the odor concentration of the odor sensor. (The circuit diagram is shown in Figure 5)

D.jpg

2.2 steering gear module

In this design, the steering gear (the servo part in Fig. 2) uses the PWM signal (pulse width modulation signal) as the control signal with a control period of 20 ms, a pulse width of 0.5 to 2.5 ms, and a steering wheel offset of 0 to 180 degrees. The angle of movement changes linearly. That is to say, to provide it with a certain pulse width, its output shaft will remain at a corresponding angle, no matter how the external torque changes, it will change the output until it is given a pulse signal of another width. Angle to the new corresponding position.

2.3 Motor drive module

Since the current provided by the single-chip microcomputer cannot directly drive the DC motor on the trolley, this design uses an external drive chip Darlington tube, that is, ULN2003 as the motor drive (the motor drive part in Fig. 2) to control the motor rotation. The chip can withstand high operating voltage and current, and uses programming to generate an orderly PWM wave to control the motor to achieve adjustable speed.

2.4 indicator display module

In this design, the light-emitting diode is used, and the collection result of the sensor will be directly output, and the working condition of each sensor can be intuitively understood. By observing the working condition of the sensor and the state of the traveling car, it can be judged whether the car is working normally.

E.jpg

2.5 Power Module

In this design, the normal operation of the single-chip microcomputer, motor drive and other components requires a stable voltage. Therefore, the LM7805 and LM7806 are equipped with a voltage-stabilizing filter circuit to directly convert the power supply of the dry battery into a 5 V and 6 V DC power supply. Provide power supply for the operation of components such as single chip microcomputer, servo, motor and so on.

F.jpg

3 experiment

The key to tracking the smell source of a smart car is to quickly analyze the flow of the scent and quickly and accurately control the steering angle of the steering gear. However, in the case of continuous turning, because the curvature changes too much, and the car has a certain speed, the servo response needs a certain time, so in practice, the car often has no time to turn around and collide at random. In this design, the PID algorithm is used to control the steering of the steering gear, and the intelligent vehicle has improved the odor tracking performance, which can achieve fast and accurate control (Fig. 8). PID algorithm formula:

G.jpg

Where: Kp is a proportional control parameter;

KI is the integral control parameter;

KD is the differential control parameter.

H.jpg

The C language is the main programming language of the experiment. The above PID algorithm code can be implemented by the following statement:

PID_out=(servo_P*error_history[2]//proportion

+servo_I*error_sum/10//Points

+servo_D*(error_history[2]-error_history[1]) // differential

)/10; / / here can convert the decimal calculation into an integer calculation to reduce the burden of the microcontroller

4 Conclusion

The STC12C5A60S2 single-chip microcomputer used in the main control module of this design system can convert the analog quantity input by the odor sensor into digital quantity through AD conversion, which makes the calculation more convenient. With proper PID calculation, the steering gear can be controlled more accurately. Thereby, the purpose of the smart car following the scent walking can be achieved. The system design of this scheme is reasonable and orderly. The shortcoming is the sensitivity of the sensor. This design requires the sensor to accurately judge the difference in concentration between the two sensors. The general sensor does not meet this requirement well. The final result of this experiment achieved the perception of the scent of the smart car and the ability to find a high concentration direction. The experiment of adding PID algorithm to the intelligent odor tracking vehicle proves that after adding the algorithm, the car tracking is more rapid and accurate, and has strong adaptability.

High Density MPO MTP Cabling

High Density Mpo Mtp Cabling,Pre Terminated Cable For Data Center,Mpo-Lc 12F Aqua Hybrid Cable,Mpo To 4Lc Duplex Om4 Hybrid Cable

ShenZhen JunJin Technology Co.,Ltd , https://www.jjtcl.com