Implementation of automatic deviation correction and collision avoidance for smart car based on MSP430

Publisher:ikfnpoLatest update time:2012-07-06 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

An intelligent vehicle is a robot that can automatically drive in an environment according to a pre-set mode, or it can autonomously perform specific operations according to the on-site situation. Its design content involves multiple disciplines such as automatic control, computer technology, sensing and detection technology. Intelligent vehicles have broad application prospects in the field of automatic control. Among them, how to ensure that the vehicle drives in a straight line instead of zigzag, how to ensure parallel driving during the turning process, and overtaking are three basic problems that need to be solved. This paper proposes solutions to the three problems respectively, and the actual experimental results are good.

1 Principle of simulation of real-world applications

This paper simulates real-world applications and uses the runway shown in Figure 1 (made of two pieces of blockboard, 8 cm above the ground, the boundary line on the board is composed of black tape about 2 cm wide: the dotted line is composed of black tape 2 cm wide, 10 cm long, and 10 cm apart) to achieve the following functions: the front of car A is close to the starting mark line, the rear of car B is close to the boundary, and cars A and B start at the same time, pass the starting mark line one after another, go in the same direction in the lane, overtake in the overtaking area, and realize the function of alternating overtaking and leading the two cars.


2 System structure

The system composition structure is shown in Figure 2. The car is mainly composed of a control center (MSP430F149 single-chip microcomputer), a collision avoidance detection module, a turning line detection module (also used as a curve correction module), a straight correction detection module, a motor drive module, a simple button, an nRF905 communication interface, and a power supply.



2.1 Collision avoidance detection module

To ensure that the two vehicles do not collide, the distance between the two vehicles needs to be kept within a suitable range, that is, collision avoidance. The system uses the HY-SRF05 ultrasonic distance sensor, which is installed on the front of the car. It can measure the longitudinal distance between the two vehicles in real time, so as to control the acceleration and deceleration of the two vehicles to keep the distance moderate. HY-SRF05 has excellent performance, sensing angle: no more than 15 degrees; detection distance: 2~450 cm; accuracy can reach 0.2 cm. Let l be the measurement distance, t be the round-trip time difference, and the propagation speed of ultrasonic wave be c, then t=2l/c, and the transmission rate of sound wave in air is (m/s). In the formula, T is the ambient temperature; Co is the speed at absolute temperature, which is a constant. It can be deduced from the above two formulas .



2.2 Turning line detection module

The infrared reflective transceiver pair is used to detect the black marking line. It is placed at the front of the car and is used to detect the turning marking line and overtaking marking line in Figure 1. The infrared light emitted by the infrared transmitting tube is irradiated on the flat plate. If the infrared receiving tube cannot receive the reflected light, it means that the light is completely absorbed, and the black marking line is detected, thereby outputting a high voltage. If the reflected light can be received, it means that a non-black marking line is detected, and a low voltage is output.

2.3 Straight road deviation correction detection module

The driving lane is 40 cm, and the boundary is surrounded by 2 cm black tape. If no protective measures are taken, the car is easy to slide off. Normally, if no protective measures are taken, the car is easy to leave the runway. Two E18-D80NK infrared sensors on the side of the car are used to correct the deviation in the straight road. The two infrared obstacle avoidance sensors are tilted outward at a certain angle and installed on both sides of the car, as shown in Figure 4. The sensing distance of the infrared obstacle avoidance sensor is adjusted so that the obstacle avoidance distance is between the sensor and the runway and the sensor and the ground. When the sensor detects the runway, it outputs a low level, indicating that the car is on the runway. When it detects the ground, it outputs a high level, indicating that the car is about to leave the runway. At this time, timely correction is performed to ensure that the car is running normally.



2.4 Communication interface

When overtaking, in order to determine the position of the two cars, adjust the speed of the two cars in time, and reduce the overtaking time, nRF905 is needed to communicate wirelessly between the two cars. nRF905 is a single-chip RF transceiver launched by Nordic VLSI of Norway, which uses the SPI interface to communicate with the microcontroller.

2.5 Motor drive module

L298N is used to drive the DC motor, and its internal bridge circuit is used to drive the motor. The advantage of this method is that PWM waves are used to control the motor speed, and the remaining ports can control the forward and reverse rotation of the motor.

3 Software Design

The driving modes of the car are divided into autonomous mode and following mode. Autonomous mode means that the front car drives at a pre-set speed and automatically corrects the deviation. Following mode means that the rear car follows the front car closely, keeps a certain distance, and automatically corrects the deviation. Autonomous mode and following mode can be switched automatically.

3.1 Straight-track deviation correction algorithm

During the driving process of the car, the straight-track deviation correction adopts two correction methods. If only one correction is used, as shown in the left of Figure 5, although the forward direction of the car can be corrected, the car is at the edge of the runway as a whole and deviates from the center of the runway. When the deviation occurs next time, it is easy to fall off the runway before it is corrected in time. According to the law of negation of negation, two corrections are used. While correcting the driving direction, the position of the car is adjusted to the center of the runway. The algorithm is as follows:

TimerA is turned on while correcting the straight-track deviation; TimerA is turned off when the car leaves the edge of the runway, and the timing value is saved: nTurnHold.

Continue turning for 2*nTurnHold (keep turning for 2*nTurnHold to adjust the car to the middle of the runway); turn in the opposite direction for nTurnHold (turn in the opposite direction to correct the direction of the car); restore the original driving mode. The specific flow chart is shown in Figure 6. First, determine whether the approach is the left or right line, make left and right turn marks, then calculate with the straight road two correction algorithms, and finally correct the opposite direction according to the left and right turn marks.


3.2 Curve Correction Algorithm

The method of using different speeds on both sides of the car and delay to achieve turning, so the delay time is the key. However, usually when passing the turning mark line, the car body is not perpendicular to the line and the angle is not fixed, as shown in Figure 7. This will make it impossible to determine a fixed delay value. For this reason, the curve correction method is used to ensure that the posture of the car can be controlled after turning. The flow chart of this method is shown in Figure 8. Each vehicle is equipped with two turning line detection modules symmetrically distributed on both sides of the front of the vehicle. When one of them detects a turning line, it first determines whether it is left or right. If the left side detects the line first, the symbol is "+", otherwise it is "-". Then the MSP430 timer TimerA is immediately turned on to calculate the time difference between the two sensors detecting the turning line. According to whether the symbol is "+" or "-", the time difference obtained above is added/subtracted to the fixed delay time in a certain proportion. There is no accurate calculation method for this proportion. The actual value is mainly determined by objective conditions such as the friction of the runway and the speed of the car, and then the final time parameter (i.e., the turning time nVeerTime) is obtained. The turning function calls this parameter. This "negative feedback correction" method can make the car basically parallel to the runway after turning and go to the middle of the runway.
[page]

Turning time: nVeerTime; left and right sensors detect the time difference of turning: nDiffValue; fixed delay value of turning: nStaticTime; proportional coefficient: fRatio.
nVeerTime=nStaticTime+nDiffValue*fRatio .
Multiple turns are required when overtaking, so multiple black lines are set in the overtaking sign area, which can be adjusted multiple times to ensure that the posture of the car after entering the overtaking area is the most ideal.

3.3 Overtaking correction algorithm

After arriving at the overtaking area in Figure 1, the posture of the car is adjusted by multiple lines in the overtaking sign area using a similar curve correction method. Then, according to the results of ultrasonic ranging, it is determined whether the car is the front car or the rear car. If it is the rear car, turn into the overtaking lane, accelerate to overtake, and then return to the driving lane, send a wireless signal to inform the other car that the overtaking is completed, and finally resume autonomous mode driving. If it is the front car, slow down and wait for the overtaking end signal of the rear car, and finally resume following mode driving. When overtaking, the rear car enters the overtaking zone and the front car drives on the original track. As long as the speed difference between the two cars is large enough, the rear car can smoothly overtake the front car.

The specific flow chart is shown in Figure 9. The key is the time problem of the two cars' cooperation. The two cars can be synchronized through the wireless module. The car will automatically correct the deviation during the straight road, turning, and overtaking process, and realize the automatic switching between autonomous mode and following mode.

3.4 Collision avoidance algorithm

In straight driving, in order to prevent the rear car from hitting the front car, a collision avoidance detection module is needed to maintain the distance between the vehicles. This paper uses the HY-SRF05 ultrasonic ranging sensor to measure the distance between the two vehicles, and presets a safety value of 25 cm. When the distance between the two vehicles is greater than the safety value, the rear car can accelerate; when the distance between the two vehicles is less than the safety value, it slows down. In this way, the rear car can follow the front car and realize following driving, but when turning and overtaking, all autonomous driving is performed and no longer follows the front car. After turning, overtaking and other special operations are completed, autonomous driving/following driving is restored. The flow chart of the collision avoidance algorithm is shown in Figure 10.


4 Conclusion

Aiming at the hot issue of path tracking in a guide line environment, this paper adopts multi-sensors and realizes the path tracking and automatic deviation correction functions of the intelligent car through single-chip control. On this basis, the overtaking function of the vehicle is also realized. In the actual test, it takes about 14.85±1.52 s to run one circle. The car runs stably and does not fall in the 25 circles of the test. It shows that the effect is good and easy to implement.

Reference address:Implementation of automatic deviation correction and collision avoidance for smart car based on MSP430

Previous article:Development of Intelligent Reactive Power Compensation Controller Based on ADuC812
Next article:Discussion on the stability of single chip microcomputer system in the field of measurement and control

Recommended ReadingLatest update time:2024-11-16 21:30

Application of color TFT liquid crystal display module based on MSP430 single chip microcomputer
  The basic feature of modern display technology is to sense and process various non-electrical information, such as sound, light, heat, force, number, atmosphere, etc. through certain sensors and processors, transmit them to the display device, and then process and convert them by the display device, and finally conv
[Microcontroller]
Application of color TFT liquid crystal display module based on MSP430 single chip microcomputer
【TI MSP430】How to implement analog serial communication
1. Background: In many cases, due to limited hardware resources, but serial communication is needed, you can consider using an analog serial port; 2. Prerequisites: To achieve a specific bps serial port rate, a timer with a corresponding frequency is required to ensure that the bit error rate is within an acceptable r
[Microcontroller]
1602 LCD display program written by MSP430
//Hardware connection P4 data port P3.7---E P3.6---RW P3.5----RS #include"msp430x14x.h"  #define   uint      unsigned int  #define rw(x) P3OUT=(P3OUT&(~BIT6))|(x?BIT6:0); unsigned char table0 ="diansai 2010-7";                                      unsigned char table1 ="0123456789";      //**************延时*****
[Microcontroller]
The Development and Characteristics of MSP430 MCU
  The development of MSP430 microcontroller   From 1996 to early 2000, Texas Instruments launched several series, including 31x, 32x, and 33x. These series have LCD driver modules, which are more conducive to improving the integration of the system. Each series has ROM type (C), OTP type (P), and EPROM type (E) chips.
[Microcontroller]
The Development and Characteristics of MSP430 MCU
Development and application of micro-power consumption data acquisition system based on MSp430
0 Preface If the underwater data acquisition system with battery as power source is to work for a long time, it must be equipped with a large number of batteries as power source. If the power consumption of the system can be reduced, the number of batteries will be reduced, which can not only reduce the cost of the sy
[Microcontroller]
Development and application of micro-power consumption data acquisition system based on MSp430
msp430g2553: dual line 12864 library program
(Display) msp430g2553: dual-line 12864 library program   ************************************************************************************************** LCD12864.H   **************************************************************** LCD12864 2-wire program    rs (CS) has been externally connected to a high level    r
[Microcontroller]
Simulation setup using IAR for MSP430 and Proteus
The first experiment is to use timer A to realize the running light. If you don't have money to buy a board, just simulate it. Create a new project. Many softwares are like this, as shown below: Then, click project- options or ALT + F7 to enter the options bar. Click General Options, select the device model in Targe
[Microcontroller]
Design of high power factor power supply based on MSP430
In the operation of the power grid, the power factor reflects the degree to which the apparent power output of the power supply is effectively utilized. We hope that the power factor is as large as possible. In this way, the reactive power in the circuit can be reduced to a minimum, and most of the apparent power wi
[Power Management]
Design of high power factor power supply based on MSP430
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号