In the smart car competition, the participating teams should make a smart car that can autonomously identify the route based on the car model platform, and then automatically identify the road and drive on the specially designed track. The smart car designed in this paper uses the 16-bit MC9S12DG128 microcontroller as a digital controller. The black and white CMOS camera installed on the front of the car is responsible for collecting track information. After the microcontroller judges and processes the signal, the PWM generation module sends out a PWM wave to control the steering servo, thereby completing the steering of the smart car. A rotary encoder is installed on the rear wheel of the smart car, which can be used to collect the pulse signal of the wheel speed. Then the microcontroller uses the control quantity processed by the PID control algorithm to change the PWM wave duty cycle of the motor drive module, thereby controlling the driving speed of the smart car.
1 System hardware circuit composition
To design an effective smart car control system, we must first understand the characteristics of the control object. Based on the analysis of the characteristics of smart cars, it can be concluded that the transfer function of the smart car steering control system is approximately a first-order integral plus pure lag, and the transfer function of the speed control object is approximately a first-order inertia plus pure lag.
The steering control system mainly requires fast response speed, but does not require high steady-state control accuracy. In addition, the control object only has integral and lag links, without the common inertia link. Based on the above characteristics, the steering control can use a PD controller.
The significance of speed detection and control is to make the smart car run at the highest speed allowed by road conditions as much as possible. The speed should be limited to the highest speed without derailment on the curve, and the rapid acceleration should be appropriately carried out on the straight road to shorten the single lap time and improve the competition results. The hardware circuit of the smart car is mainly composed of the video processing module, the direction control module and the speed control module. The hardware relationship between each module and the single chip microcomputer is shown in Figure 1.
The video processing module in this system is composed of a CMOS camera, a binary circuit and a synchronous separation circuit; the steering control module is mainly completed by a steering gear. The rotation of the steering gear will be converted into the lateral movement of the steering rod of the car model, thereby driving the rotation of the front wheels of the car model to control the driving direction of the smart car. The steering control of the steering gear adopts PD control. The single-chip microcomputer can output a PWM signal with a corresponding duty cycle to the steering gear according to the position of the central black line of the track. [page]
The vehicle speed control module is mainly composed of a DC motor, a drive circuit and a rotary encoder. The module can determine the current track status of the smart car based on the path information detected by the CMOS camera, and adjust the three parameters Kp, Ki and Kd of the digital PID control algorithm to achieve the purpose of quickly responding to the vehicle speed and eliminating static errors.
2 Circuit Design
2.1 Power Module Design
The power module needs to supply power to the microcontroller, sensor, servo and drive motor. Therefore, multiple power supplies need to be provided to meet the requirements of each module. After the battery is fully charged, its no-load voltage is only about 8 V, and as the battery is consumed, the voltage gradually decreases. The DC-DC conversion chip MC34063 and the low-dropout voltage regulator LM2940 are used. The MC34063 can output a stable 8V voltage to the CMOS camera, and the LM2940 can provide a stable 5V power supply for the 16-bit MC9S12DG128 microcontroller, video amplification and binarization circuit, thereby ensuring the stable operation of the system under various conditions. The schematic diagram of the power module circuit is shown in Figure 2.
2.2 DC motor drive module design
The DC motor drive uses the 5 A integrated H-bridge chip MC33886. The MC33886 chip has built-in control logic, charge pump, gate drive circuit and low on-resistance MOSFET output circuit. It is suitable for controlling inductive DC loads (such as DC motors). By controlling the four input lines of MC33886, the motor forward rotation, energy consumption braking and reverse braking can be easily realized. Figure 3 is a simplified H-bridge circuit. In the figure, when S1 and S4 are turned on and S2 and S3 are turned off, the current flows through the DC motor in the forward direction, and the smart car moves forward; when S2 and S3 are turned on and S1 and S4 are turned off, the current flows through the DC motor in the reverse direction. This process can be used to put the car model in a reverse braking state, thereby quickly reducing the speed of the car; when S3 and S4 are turned on and S1 and S2 are turned off, there is no power added to the DC motor, and the two ends of the DC motor armature are equivalent to being short-circuited together. [page]
This solution uses two MC33886s in parallel, and the circuit schematic of the DC motor drive module is shown in Figure 4.
[page]
2.3 Sensor circuit design
This smart car uses a CMOS camera as an image sensor to ensure accurate and effective track information collection. The output signal of the CMOS camera is a composite full-TV signal in the PAL format, outputting 50 frames per second (divided into even fields and odd fields).
2.4 Design of wireless data transmission module
The smart car is equipped with a wireless data transmission module based on the RF transceiver chip nRF403, and can implement the MOD-BUS communication protocol on this basis, which is very helpful for testing smart car parameters and program debugging. During the operation, the parameters of the smart car can be sent in real time, and the analysis of the operation status of the smart car can improve the control program more targetedly.
3 Software Design
The program structure of the intelligent vehicle control system is shown in Figure 5. This is a two-layer hierarchical control system. The bottom layer control includes the "steering control system" and the "vehicle speed control system", and the upper layer master control program can schedule the entire control system by changing the set values, control parameters and constraints of the bottom layer control system. The design of this hierarchical control system refers to the structural characteristics of the distributed control system DCS. The functions of each part of the program are clear, the structure is clear, and it is easy to debug and maintain.
The functions implemented by this system software are mainly initialization, data acquisition and filtering, road recognition, motor control and steering gear control. The initialization is mainly to set the system default parameters. The second is data acquisition and filtering. In order to minimize the pure lag time introduced, this paper proposes a unique and innovative video signal acquisition method. That is, the SPI port provided by the MC9S12DG128 microcontroller is used to directly read the binarized video signal.
As for motor control. This system uses a single-chip microcomputer to detect the number of pulses generated by the rotation of the rear wheels of the smart car by receiving a rotary encoder, and then uses the recursive form of the position PID control algorithm to quickly and accurately control the speed of the DC motor. The recursive form of the position PID control algorithm is as follows:
△u(k)=Kp[e(k)-e(k-1)]+Kixe(k)+Kd[e(k)-2e(k-1)+e(k-2)], u( k)=u(k-1)+△u(k)
Where: u(k) is the output of the controller at time k; e(k) is the deviation at time k; Kp, Ki, and Kd are the proportional coefficient, integral constant, and differential constant of the position PID control algorithm. The servo control also uses a single-chip microcomputer to detect path information through a CMOS camera, and then uses an incomplete differential PD control algorithm to control the steering angle of the servo to achieve path tracking.
This paper introduces the design and implementation of a smart car control system. A large number of experimental tests have shown that the smart car can quickly and smoothly track the black guide line on the manufactured track and drive, and has good tracking effect, fast control response speed, good dynamic performance, small steady-state error, and strong system stability and anti-interference ability.
Previous article:Design and implementation of Ethernet switch based on single chip microcomputer control
Next article:Design of CC1100 Driver Based on TinyOS
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Square wave generator for msp430 microcontroller
- [RISC-V] Domestic IDE MRS V1.50+JLink! GD32VF103 development practice
- 28335 Clock, peripheral and register configuration
- ARM+DSP+IPU heterogeneous multi-core processors communicate between cores through IPC components
- "Operational Amplifier Parameter Analysis and LTspice Application Simulation" 3. Chapter 2 Phase Margin
- CH582 test, the serial port is connected by accident
- EEWORLD University----Azure RTOS step by step workshop
- MS GW-BASIC is now open source
- Evaluation report: 0-10V/potentiometer LED color temperature adjustment solution GML003
- The compiled bin file ends with a lot of 0s