Design of a multifunctional intelligent car based on modular control

Publisher:幸福之路Latest update time:2013-11-04 Source: dzsc Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  By embedding fuzzy control algorithms, the car can accurately track the road; ultrasonic detection of obstacles is used to make the car react in advance and bypass the obstacles; a sensitivity-adjustable light-seeking system is designed to drive the car to the light and enter the warehouse; metal blocks are detected by metal sensors; Hall devices are used to measure the distance traveled by the car; and finally the number of metal blocks, travel time and distance are displayed on the LCD screen, realizing a friendly human-machine interface. Experiments show that the intelligent car system can successfully complete various functions and can achieve high stability and accuracy requirements on each independent control module.

  0 Introduction

  Smart cars have various forms, various control methods and strong innovation, so they have always been popular in electronic competitions and technological innovation. The annual "Freescale" smart car competition is divided into electromagnetic group, photoelectric group and camera group, which respectively collect signals through electromagnetic sensors, photoelectric sensors and cameras to detect the tracking ability and running speed of the car; the remote control car is also equipped with a wireless module to receive the signal sent by the remote control end, so as to realize the intelligent control of the car; the fire-fighting robot adds a phototropism module and a temperature sensor on the basis of the obstacle avoidance car, so that the car moves towards the fire source to extinguish the fire.

  In view of the fact that most of the current designs based on smart cars are single-function tracking cars, obstacle avoidance cars or remote control cars, this paper will design a multifunctional smart car that integrates infrared tube tracking, metal detection, ultrasonic obstacle avoidance, silicon photocell phototropism and distance measurement in the same system to realize its multi-task processing function. At the same time, this system adopts an optimized control scheme for each module in the hope of obtaining more precise control. The entire smart car system has the characteristics of high efficiency, high accuracy and low cost.

  There are many control methods for intelligent car systems at present, the most common ones are path memory method, fuzzy control method, image recognition method and so on.

  These methods can achieve ideal results for single-task car control. In the intelligent car system designed in this paper, the multi-task nature of the car will be fully considered, and a modular control method will be adopted to achieve multi-functional control of the car. Fuzzy control methods are nested on the basis of modularization, so that the car can meet multi-functional requirements and realize independent and stable operation of each control module.

  1 System structure design

  System design generally includes hardware design and software design. The hardware design in this system consists of power module, drive module, tracking module, metal detection module, ultrasonic obstacle avoidance module, silicon photocell photosensitive module and display module. The overall structure of the system is shown in Figure 1.

  

  1.1 Driver Module

  The microcontroller generates two PWM waves, and the L298N motor driver chip controls two DC motors to drive the left and right wheels respectively. When going straight, the two PWM waves have the same frequency phase. When turning, the PWM wave is changed to control the corresponding motor to reverse, and the other motor to rotate forward. The difference between the two sides can achieve the turn. The size and speed of the turn can be controlled by adjusting the reversal time, and the speed of the car can be controlled by changing the duty cycle of the PWM wave.

  1.2 Tracking module

  This module mainly uses photoelectric tubes to detect the black line on the car track. When the light-emitting diode in the photoelectric tube is located on the black line, the light emitted by the light-emitting diode is absorbed by the black and cannot be reflected back. At this time, the base voltage of the photoelectric triode on the receiving end is zero, the triode cannot be turned on, and the output is low. The same-phase end of the comparator connected to it is also low, and finally a low level is input to the corresponding pin of the microcontroller. When the microcontroller detects the input low level, it will process the motor accordingly, drive the car to turn, and make the photoelectric tube deviate from the black line. Once it leaves the black line, the photoelectric triode can receive light, the triode turns on and outputs a high level, and inputs a high level to the microcontroller pin. After the microcontroller detects the high level, it gives the corresponding motor a forward command, and the car resumes straight driving. In this cycle, the car can eventually drive along the track set by the black line.

  When designing a tracking module, in order to reduce the interference of ambient light, a sliding variable resistor can be connected to the reverse end of the amplifier. By adjusting the size of the resistor, the threshold voltage of the comparator can be changed, thereby changing the sensitivity of the sensor. When weak ambient light enters the base of the phototransistor, the collector of the transistor will have a voltage, but as long as the resistance value of the sliding variable resistor is increased, the collector voltage will be lower than the threshold voltage when the ambient light is irradiated. At this time, the phototransistor still outputs a low level, thus achieving the purpose of eliminating ambient light. The larger the resistance value connected to the circuit, the higher the threshold, the less susceptible it is to the influence of ambient light, but the lower the sensitivity and the slower the reaction. On the contrary, the more susceptible it is to the influence of ambient light, the higher the sensitivity and the faster the reaction.

  At the same time, in order to make the car adapt to routes with different curvatures, a fuzzy control algorithm is embedded in the tracking module. First, a fuzzy set X={left deviation, left relatively deviation, left very deviation, right deviation, right relatively deviation, right very deviation} is established, and fuzzy rules are defined: when the first photoelectric tube on the left is located on the black line, the car is defined as right deviation, the left wheel of the car stops, and the right wheel rotates normally; when the second photoelectric tube on the left is located on the black line, the car is defined as right relatively deviation, the left wheel of the car reverses slightly, and the right wheel rotates normally; when the third photoelectric tube on the left is located on the black line, the car is defined as right very deviation, the left wheel of the car reverses significantly, and the right wheel rotates normally. Similarly, fuzzy rules are defined for the photoelectric tube on the right. The car can adapt to changing routes through fuzzy control.

  1.3 Metal Detection Module

  Fix the metal sensor at the bottom of the car. When the car passes by a metal sheet, the output end of the metal sensor will generate an electrical frequency jump. The jump signal is input to the external interrupt of the microcontroller. Each jump triggers an interrupt, and the microcontroller will control the buzzer to sound an alarm. The number of interrupts is recorded and sent to the LCD display to get the number of metal sheets detected.

  1.4 Ultrasonic obstacle avoidance module

  Use a single-chip microcomputer to input a pulse trigger signal to the input end of the ultrasonic generator, and the transmitter of the ultrasonic generator will generate a series of ultrasonic waves of the corresponding frequency. When the sound wave encounters an obstacle (within 3 m), it will be reflected back and received by the receiving end, and its output end will output a series of PWM waves. Record the high-level duration of this PWM wave and ignore the displacement of the car during this period of time, so that the distance from the car to the obstacle can be calculated. When the distance reaches a certain set value, control the motor to make the car turn and bypass the obstacle.

  In this system, the interrupt capture function of Mega128 microcontroller is fully utilized to input the output echo signal generated by the ultrasonic generator into the microcontroller. First, the falling edge trigger capture interrupt is set, and the timer starts timing. When the interrupt is triggered, the trigger mode is immediately changed to rising edge trigger. When the interrupt is responded to again, the timer value T1 is recorded at this time and the original count value is cleared. The high level time T1 recorded at this time is the time for the sound wave to propagate in the air. Change the trigger mode to falling edge trigger again to achieve dynamic real-time measurement. Compared with traditional interrupt response measurement, interrupt capture has the advantages of fast and accurate. Assume that the microcontroller crystal oscillator is M, the frequency division coefficient is N, and the speed of sound propagation is V. The time for sound wave propagation is (unit: s):

  

  Therefore, the distance L1 to the obstacle can be calculated as follows:

  

  1.5 Silicon Photovoltaic Cell Photovoltaic Module

  In order to make the car have a more ideal light-seeking effect, this system uses silicon photocells as sensors. When the light source shines on the surface of the silicon photocell, the resistance value of the silicon photocell will change. The greater the light intensity, the smaller the resistance value. A silicon photocell is installed on the left, middle and right sides of the front end of the car, and the light tube battery is connected to the same reference voltage source. The voltage at both ends is sent to the sampling channel of the single-chip microcomputer and converted into a digital quantity. By comparing the size of the three sampling values, it can be determined which direction has a greater light intensity, thereby controlling the car to go straight or turn, and then move towards the light source. [page]

  Due to the use of silicon photocell sampling scheme, the sensitivity of the system can be effectively adjusted. The program is set to compare the three sampling voltages only when the sampling voltage reaches a certain specified value. Adjusting this specified voltage value can change the system's phototropism sensitivity. Setting a suitable specified value according to the environment can better avoid the interference of ambient light.

  1.6 Distance Measurement Module

  Install two small magnets on the motor shaft, and fix the Hall sensor on the car body just above the shaft. When the motor rotates and the magnet passes through the Hall element, the output end of the Hall sensor will generate an electrical frequency jump. By recording the number of electrical frequency jumps N, the distance traveled by the car can be measured according to the travel distance formula L2=(N × 2πR)/2. R represents the wheel radius. The measured distance can be displayed on the LCD screen.

  2 Software Design

  On the basis of hardware design, the functions of the car are controlled by burning the program in the single-chip microcomputer. This system adopts a modular control method, which regards each independent function as an independent subroutine, and calls each subroutine in the main program in a logical order. This makes the program clear, improves the execution efficiency of the program, and facilitates program modification and debugging. The main program design process is shown in Figure 2.

  

  As described in the tracking module, in program 1, a fuzzy control algorithm is used to control the car to run along the track so as not to lose control. Subprogram 2 determines the distance between the car and the obstacle and controls the car to turn and avoid the obstacle. Subprogram 3 controls the left and right wheels of the car to rotate according to the light intensity collected by the silicon photocell to ensure that the car enters the warehouse successfully. The program uses dynamic scanning and real-time monitoring to keep the car in dynamic adjustment.

  3 Physical testing and result analysis

  In order to test the performance of the car, a car track as shown in Figure 3 was designed for the car according to the competition requirements. The test site was chosen in a place with open surroundings and weak natural light. The car walked along the black traction line from the starting point, avoided obstacles after leaving the traction line, and began to move towards the light into the warehouse. Several coins for detection were placed under the traction line. When the car passed by, the coins were detected and an alarm was sounded, and the number of coins recorded was displayed on the LCD screen.

  

  Since sensitivity adjustment is added to the hardware design of the tracking module and fuzzy control algorithm is adopted in the software design, the tracking test results of the car are relatively ideal and can drive according to the designed route. The test results are shown in Table 1.

  

  In the obstacle avoidance module, since the ultrasonic module has requirements for the shape and surface area of ​​the reflective object, when the placed obstacle does not meet the requirements, the reflected signal will not be received, resulting in obstacle avoidance failure. At the same time, when there are people standing around during the test, they can also form a reflection source and interfere with the test. The test results are shown in Table 2. Table 3 shows the test results of the phototaxis module.

  

  The photosensitive module uses silicon photocell sampling and has a continuously variable stepless comparison, which is more sensitive and accurate than the currently widely used photoresistors that only compare high and low levels, thereby improving the accuracy of the system. However, like photoresistors, the influence of natural light cannot be completely avoided, so it still cannot achieve 100% accuracy.

  4 Conclusion

  This system uses an 8-bit single-chip microcomputer and adopts modular design ideas to realize the multifunctional design of the intelligent car. During the design, multiple sensors are integrated into one system, and the collected multi-channel signals are sent to the single-chip microcomputer for analysis and processing to make judgments.

  At the same time, the system is also designed with a friendly human-computer exchange interface, which can easily read out the number of metal pieces detected, the distance traveled and the driving time. Due to the use of modular control methods, the modules have little influence on each other, so the system can also be redeveloped to add more modules to the system to achieve other extended functions. For example, adding a voice chip to the system can realize the voice broadcast function; adding a camera and a wireless module can realize the detection function of the car, etc.

Reference address:Design of a multifunctional intelligent car based on modular control

Previous article:Design of smart grid terminal based on ZigBee protocol wireless meter reading
Next article:Design of RFID card reader based on ATMEGA64L and TRH031M

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号