Design of intelligent vehicle control system based on MC9S12DG128 single chip microcomputer

Publisher:Serendipity99Latest update time:2012-04-13 Source: 电子元器件应用Keywords:MC9S12DG128 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Keywords:MC9S12DG128 Reference address:Design of intelligent vehicle control system based on MC9S12DG128 single chip microcomputer

Previous article:Design and implementation of Ethernet switch based on single chip microcomputer control
Next article:Design of CC1100 Driver Based on TinyOS

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号