1 Overall design plan of the system
This smart car uses the photoelectric sensor in front of the car body to collect track information and the photoelectric encoder on the rear axle to collect the pulse signal of the wheel speed. These signals are conditioned by the single-chip microcomputer and used to control the movement of the car. At the same time, the PWM wave generated by the internal module drives the DC motor to control the speed and angle of the smart car, so that the car can drive automatically and smoothly on the track and complete the course in the shortest time and at the fastest speed. In addition, this system also adds buttons and display devices for easy debugging. The overall module diagram of the intelligent vehicle system is shown in Figure 1.
2 Hardware Design
Hardware design is the basis of design, including the design of the power management circuit of the whole vehicle power supply, the design of the motor drive circuit, and the connection design of each interface circuit of the single-chip microcomputer.
2.1 Controller Module
The H8/3048F single-chip microcomputer is a 16-bit high-performance microcontroller produced by Hitachi. The H8/3048F has 16 16-bit general registers. Its maximum clock frequency can reach 18 MHz, and the addressing space is 16 MByte. The chip includes: 9 I/O ports, 32 kByte Flash, 2 kByte RAM, 16-bit integrated timing unit (ITU), programmable timing pattern controller (TPC), watchdog timer (WDT), serial communication interface (SCI) and A/D, D/A converters, etc. The controller I/O port is allocated as follows: P70~P77 is used for the input of photoelectric sensor signals; PB is used for the input of vehicle speed detection signals; PA is used for the input of the start sensor board signal. The controller controls the steering servo and DC drive motor according to the detected road conditions and vehicle speed information, and adjusts the driving direction and speed of the car accordingly, so that the smart car can travel stably and quickly along the given route.
2.2 Power module
8 1.2 V nickel-hydrogen batteries are selected to power the DC motor, and after voltage reduction and voltage stabilization, they are used to power the single-chip microcomputer system and other chips. The battery has strong current driving capability and stable voltage output performance, and is cost-effective. The power supply part uses the LM2940CT chip. The chip can provide a maximum current output of 3 A, which fully meets the system requirements. The module uses two 2940 chips, one for powering the MCU alone and one for powering other components.
2.3 Tracking sensor module
The module uses an integrated reflective photoelectric tube RPR22D. Its transmitter is a gallium arsenide infrared light-emitting diode, and the receiver is a highly sensitive silicon planar photoelectric transistor. RPR220 has the following characteristics: compact structure, strong anti-interference ability, and fast response speed. The built-in visible light filter can reduce the influence of discrete light. When the light emitted by the LED is reflected back, the transistor is turned on and outputs a low level. The photoelectric transistor conditioning circuit is simple and has stable working performance. The sensor detection and conditioning circuit is shown in Figure 2. After observation by the oscilloscope, the output waveform is regular and can be directly used for single-chip microcomputer query.
The car detects the white line using 9 equally spaced infrared tubes to collect the path and identify the road information. It starts with the left photoelectric tube to collect data in a loop to detect whether it is on the white line. If it is on the white line, it then detects whether the photoelectric tube on its right is also on the white line, and moves to the right in sequence. When more than 3 photoelectric tubes are above the white line at the same time, the current sampling data is filtered out and the historical value is used. [page]
2.4 Motor drive module The
motor drive board is a reversible bipolar bridge driver made of discrete components. Its power components are composed of 4 n-channel power MOSFET tubes, which greatly improves the working torque and speed of the motor. The driver mainly consists of the following parts: PWM signal input interface, logic commutation circuit, dead zone control circuit, power supply circuit, upper bridge arm power MOSFET tube gate drive voltage pump circuit, power MOSFET tube gate drive circuit, bridge power drive circuit, buffer protection circuit, etc. By setting the duty cycle of the PWM wave output by HS/3048F, the forward and reverse rotation of the motor can be controlled. When the output duty cycle is 50%, the motor does not rotate. When the duty cycle is >50%, the motor rotates forward; <50%, it reverses.
2.5 Speed measurement module
In order to improve the detection accuracy, this module was finally determined to use a photoelectric encoder with higher accuracy. The photoelectric encoder uses a 5 V power supply and outputs a square wave signal. It has the advantages of light weight, high reliability, and simple installation.
3 Algorithms and software design
3.1 Direction control algorithm The
direction control of the intelligent vehicle adopts closed-loop control of the predetermined track, that is, the output direction and the measured white line position are in a segmented proportional relationship. The formula for the steering angle of the servo is
θ=arctan(e/b) (1)
In formula (1), θ is the steering angle of the servo; e is the offset; b is the distance from the front axle to the sensor.
Through experiments, it can be obtained that the steering angle of the servo is linearly related to the PWM pulse width, and the steering formula is
PWM=θ×K+M (2)
In the formula, K is the proportional coefficient; M corresponds to the PWM control pulse width when the servo position is not deflected. Experiments have shown that adjusting K within a certain range can achieve a good control effect.
There are 16 states of road conditions detected by the intelligent vehicle, and each state has a corresponding servo angle. In this way, the relationship between the white line deviation e and the servo angle θ corresponding to each sensor state can be created in the program, as shown in Table 1.
[page]
3.2 Speed Control Algorithm
The control algorithm of the intelligent vehicle adopts the PID algorithm, which includes three parts: measurement, comparison and execution, that is, comparing the measured quantity with the expected value, and then using the qualified error to correct the response of the control system. The PID control algorithm is a control strategy based on classical control theory. The PID control algorithm can improve the stability of the system and improve the dynamic performance of the system without affecting the stability accuracy of the system. According to the experimental situation and on-site debugging experience, the car does not perform PID control when it moves in a straight line, but moves at the maximum speed. When it is in a general curve state, the PID algorithm is introduced, so that the speed can be adjusted according to the actual situation, so that the car has good controllability. The principle block diagram of the PID controller is shown in Figure 3.
The system mainly consists of a PID controller and a controlled object. It forms a control deviation based on the given value r(t) and the actual output value m(t), and forms a control quantity through linear combination of the deviation according to proportion, integration and differentiation to control the controlled object. In
the graphical expression of PID
(4), T is the sampling period, which must be small enough to ensure that the system has a certain accuracy; Ti is the integral time of the regulator; Td is the differential time of the regulator; Kp is the proportional coefficient of the regulator; e(k) is the deviation at the kth sampling; u(k) is the control quantity.
Incremental PID control is adopted. From △u(kT)=u(kT)-u(kT-T), we can get
△u(kT)=Kp[e(kT)-e(kT-T)]+Kie(kT)+Kd[e(kT)-2e(kT-T)+e(kT-2T)] (5)
In the formula, e(kT) is the degree of deviation from the center position for the kth time; e(kT-T) and e(KT-2T) are the k-1 and k-2 error terms respectively. Based on this algorithm, the control algorithm program is written in C language.
3.3 Program design
The main program adopts the idea of periodic detection control. The guide line, vehicle speed and acceleration data are detected once every 20ms. According to the program processing results, the steering gear control program and the drive motor control program are called to control the running state of the intelligent vehicle in real time to meet the requirements of line-following operation. The main flow chart is shown in Figure 4.
4 Conclusion
The design of intelligent vehicles covers multiple disciplines such as automatic control and electronics. Its technology can be applied to the fields of intelligent robots and automated operation platforms, and has strong practicality. Combining practical design experience, this paper discusses the design of intelligent vehicles from the aspects of hardware design and software design. Experiments have shown that the PID algorithm can better ensure that the intelligent vehicle moves in the right direction and runs smoothly even when the road guide line is complex.
Previous article:Application technology of STC series single chip computer without power failure program download
Next article:Design of Universal Programmer for Freescale HCS12 Series MCU
Recommended ReadingLatest update time:2024-11-16 17:44
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
- A collection of autonomous driving technical materials, download now without any points!
- Switch OUT?! Nintendo's latest recruitment may be aimed at the next generation console
- 【ST NUCLEO-H743ZI Review】+ 3. Key input
- Today's Live Broadcast | Outlook for DLP Technology in AR HUD and In-Vehicle Display Applications
- Award-winning live broadcast: Focus on "TI FPD-Link III automotive chipset" Ideal solution for automotive video transmission
- Playing with Zynq Serial 1——Zynq Linux boot process
- 【AT-START-F425 Review】Overclocking Performance of AT32F425
- I can't access GitHub anymore, what should I do? I can't access it at all
- [Mill MYB-YT507 development board trial experience] opencv face detection
- TouchGFX application development based on STM32CubeMX on STM32H7A3 processor - HelloWorld!