Design of Intelligent Car Based on HC9SDG128 Single Chip Microcomputer

Publisher:火星叔叔Latest update time:2013-02-17 Source: dzscKeywords:HC9SDGl28 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  0 Introduction

  The wheeled car is the main part of the mechanical structure of the intelligent car, which consists of structural components such as the body, wheels, speed sensors, and rotating shafts. It also includes modules such as a driver that provides power and a camera that collects environmental information, which comprehensively collects the car's own state information or external environment information, analyzes and integrates the sensor data, dynamically adjusts the car's motion state, and realizes autonomous tracking under certain conditions.

  This intelligent car adopts PID control algorithm and uses CCD linear camera as the detection device of black guide line. After comparison by LM393, it is used for data acquisition and image recognition by single chip microcomputer, so as to identify the path. The motor drive adopts PC33886, and uses direct photoelectric sensor to measure speed, and displays the relevant information on LCD screen. It also uses 4 buttons to set parameters, providing a friendly human-computer interaction interface for on-site debugging.

  1 System framework design

  The whole car model system can be divided into three parts: environmental image acquisition part, motor and servo drive part, central data processing part, and uses 16-bit microcontroller MC9S12DGl28B as the core control unit. The system block diagram is shown in Figure 1.

System Block Diagram

Figure 1 System Block Diagram

  The power part of the smart car uses a common small permanent magnet DC motor. The drive circuit of this motor is very mature, with both drivers composed of separate components and integrated power integrated driver chips available for selection.

  The most important component of a smart car is the central processing system, which is also the brain of the smart car. It is not only responsible for processing the image data sent by the environmental image acquisition part, but also for converting this information into the driving control signal of the motor so that the whole car can move forward according to the predetermined rules. This requires the system to have a huge data processing capacity.

  2 Road Detection Module

  2.1 Comparison and feasibility analysis of road surface inspection schemes

  The environmental image acquisition part can be realized by array infrared probes and CCD or CMOS image sensors. The former is characterized by low price, simple circuit and convenient application, but has the disadvantages of limited performance, weak adaptability to complex environments and poor effect. CCD or COMS image sensors (cameras) can make up for the various shortcomings of array infrared probes.

  In order to quickly collect image data and take into account the difficulty of development, a black and white surveillance camera that outputs standard TV video signals will be used in this design. This camera can cooperate with the line and field synchronization signal separation circuit and the A/D conversion circuit of the microcontroller itself to easily collect images, thereby avoiding the complex bus protocol and data processing process of digital cameras.

  2.2 Hardware Design

  The LM1881 video synchronization signal separation chip can extract the timing information of the signal from the camera signal. The synchronization separation circuit of LM1881 is shown in Figure 2.

LM1881 Synchronous Separation Circuit Diagram

Figure 2 LM1881 synchronous separation circuit diagram

  Pin 2 is the video signal input terminal, where the camera signal is input into LM1881. Pin 3 is the field synchronization signal output terminal. When the field synchronization pulse of the camera signal arrives, this terminal will become low level, generally maintained for 230μs, and then return to high level. Pin 7 is the odd-even field synchronization signal output terminal. When the camera signal is in the odd field, this terminal is high level, and when it is in the even field, it is low level. The alternation of odd-even field is synchronized with the falling edge of the field synchronization signal, that is, synchronized with the rising edge after the field synchronization pulse.

  3 Speed ​​sensor

  3.1 Solution selection

  (1) Hall sensor with rare earth magnet

  Advantages: accurate information acquisition, small size, and no increase in rear wheel load.

  Disadvantages: The gear is close to the main drive motor and is easily disturbed by the magnetic field. Drilling holes in the gear can easily damage the gear.

  (2) Photoelectric sensor

  Advantages: small size, no increase in rear wheel load, and the reflective solution does not require reprocessing of existing devices.

  Disadvantages: Accuracy is limited by the size of the phototube. [page]

  (3) Photoelectric encoder

  Advantages: Accurate information acquisition with high precision.

  Disadvantages: Increased load on rear wheels and large size.

  Comparing the above three solutions, considering the reliability of the system, the main rear wheel rotating gear is made of plastic, drilling is dangerous, and any increase in vehicle weight may affect the vehicle speed, we finally decided to use a direct-type photoelectric sensor.

  3.2 Hardware Circuit Design

  The sensor circuit structure diagram is shown in Figure 3.

Sensor circuit diagram
Figure 3 Sensor circuit structure diagram

  4. Drive part

  4.1 Motor Driver Selection

  According to the theory of electromechanics and electric drive, the motor driver must have sufficient current output capacity to ensure sufficient driving force. Taking all factors into consideration, the motor driver is designed with an integrated dedicated power drive integrated circuit and a driver composed of discrete components (field effect transistors).

  According to electromechanics, the expression for the DC motor speed, n, is:


  In the formula: U is the armature terminal voltage; I is the armature current; R is the resistance in the armature circuit; φ is the magnetic flux per level; K is the motor structural parameter.

  From formula (1), we can see that the speed control methods of DC motors can be divided into two categories: the excitation control method that controls the excitation flux and the armature control method that controls the armature voltage. At present, most applications use the armature voltage control method. This design uses PWM to achieve the speed regulation method of the DC motor while ensuring that the excitation is constant.

  The average voltage U across the motor's armature winding is:


  Where: Duty cycle D represents the ratio of the switch conduction time to the period in a period T, and the range of D is 0≤D≤1. From formula (2), it can be seen that when the power supply voltage Us remains unchanged, the average value of the voltage across the armature Uo depends on the size of the duty cycle D. Changing the D value also changes the average value of the voltage across the armature, thereby achieving the purpose of controlling the motor speed, that is, realizing PWM modulation.

  In order to facilitate the acquisition of materials and design, the PC33886 from Freescale Semiconductor was selected for this design. The PC33886 can accept a 20 kHz operating frequency when driven in PWM speed regulation mode; it has overheating, overcurrent, and short circuit protection, and feeds back the device's operating status to the microcontroller through a feedback line.

  4.2 Servo control

  The flow chart of the steering gear control program is shown in Figure 4.

Servo control program flow chart

Figure 4 Flowchart of the steering gear control program

  The car model continuously samples road condition information during driving, and determines the road condition of the car model by analyzing the relative position of the car model and the track, and calculates the turning radius. The standard PWM cycle of all servos is 20 ms, and the maximum rotation angle is 90°. When the pulse width input to the servo is 0.5 ms, that is, the duty cycle is 0.5/20=2.5% of the modulation wave, the servo turns right 90°. The relationship between the rotation angle and the pulse width can be derived as follows:

  t=1.5±θ/90

  Where: t is the positive pulse width, unit: ms; θ is the rotation angle; when turning left, addition is used, and when turning right, subtraction is used.

  In specific operations, the period of the PWM modulation wave can be set within a certain range of about 20 ms to enable the servo to rotate normally. After repeated tests, the output PWM modulation wave period is finally set to 13 ms.

  The speed of the running motor and the angle of the servo are controlled accordingly in the software by setting the PWM wave duty cycle.

  5 Power Module

  The motor drive system requires a high-power power supply: low internal resistance, high current, and insensitive to power ripple; the microcontroller and image acquisition system have higher requirements for power quality: low internal resistance, small ripple, and low power consumption, but it is necessary to prevent interference generated by the motor during operation. The power supply system block diagram is shown in Figure 5. [page]

Power supply system block diagram

Figure 5 Power supply system block diagram

  Since the camera needs a voltage of 9 to 12 V to work properly, and the voltage of the rechargeable battery is only 6 to 7.2 V, a DC-DC boost circuit becomes necessary.

  The DC-DC voltage conversion uses the MC34063A integrated circuit, which integrates a temperature compensator, a comparator, a dynamic current band-limited duty cycle controllable oscillator and a high current output driver. The output voltage is directly controlled by two external resistors with an error of 2%. The circuit can be easily applied to both boost and buck applications. The circuit schematic is shown in Figure 6.

Power supply circuit diagram

Figure 6 Power supply circuit diagram

  6 Software Design

  The software structure diagram is shown in Figure 7.

Software program structure diagram

Figure 7 Software program structure diagram

  The entire process of automatic identification and control of the car is completed through the program control on the main control microcontroller chip. After the car is turned on, it will automatically run along a black line track with a certain width. During the driving, the continuously detected black line position information will be fed back to the main control chip. After being processed by the main control chip, the execution result will be fed back to the controller, thereby controlling the direction of the car. The software detects the car speed and the change information of the button, and finally displays the result on the LCD display.

  7 Conclusion

  Smart car design involves control, pattern recognition, sensor technology, automotive electronics, electrical, computer, mechanics and other professional fields. The entire design does not use overly complex detection methods or control algorithms, but uses camera image processing technology and classic PID control algorithms, which not only ensures the reliability, stability and speed of the system, but also saves costs and workload. In terms of control algorithms, PID control ensures the speed and stability of the system; in terms of detection methods, the design of continuous camera detection ensures no jitter during high-speed straight-line driving, and the application of photoelectric tube speed measurement method ensures the simplicity and reliability of the speed measurement system.

References:

[1]. LM393 datasheet http://www.dzsc.com/datasheet/LM393_1059532.html.
[2]. PC33886 datasheet http://www.dzsc.com/datasheet/PC33886_1077293.html.
[3]. LM1881 datasheet http://www.dzsc.com/datasheet/LM1881_1060868.html.
[4]. MC34063A datasheet http://www.dzsc.com/datasheet/MC34063A_5067.html.

Keywords:HC9SDGl28 Reference address:Design of Intelligent Car Based on HC9SDG128 Single Chip Microcomputer

Previous article:Design of automobile taillight controller based on AT89S52 single chip microcomputer
Next article:A Design Scheme for Embedded Automotive Digital Instruments

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号