Design of reversing radar based on single chip microcomputer

Publisher:caijtLatest update time:2012-06-05 Source: 电子设计工程 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
With the continuous development of my country's economy and the continuous improvement of people's living standards, the number of cars owned by citizens has increased significantly, but many problems have also emerged. When cars are driving in cities with narrow roads, simple things such as parking and turning around have become a huge test for drivers, resulting in a lot of economic losses and unnecessary disputes. Faced with such a dilemma, reversing radar based on ultrasonic ranging has stepped onto the stage of history and begun to benefit mankind. Reversing radar is a car parking safety auxiliary device that can inform the driver of the surrounding obstacles by sound or more intuitive display, eliminating the trouble caused by the driver's front and back left and right visits when parking and starting the vehicle, and helping the driver to eliminate the defects of blind spots and blurred vision, thereby improving safety. The system adopts a reversing radar system based on single-chip microcomputer control. The single-chip microcomputer controls the time counting, calculates the round-trip time from the emission to the reception of ultrasonic waves, and uses the transmission speed of ultrasonic waves in the air to obtain the measured distance.

1 System overall design
1.1 System design concept
The reversing radar system adopts modular design. According to functional requirements, it mainly includes ultrasonic transmitting circuit, ultrasonic receiving circuit, alarm circuit and display circuit, etc. All signal lines and control lines are connected to the single-chip microcomputer and work in a unified and coordinated manner under its command, as shown in Figure 1. After the driver turns the handle to the reverse gear, the system starts automatically. The single-chip microcomputer AT89S52 generates a short 40 kHz signal, which is amplified and output through the ultrasonic sensor. The ultrasonic wave is reflected by the obstacle and collected by the ultrasonic receiving module for amplification and comparison. After the single-chip microcomputer processes this signal, it calculates the distance value and sends it to the display module. When a certain distance is exceeded, the alarm circuit is triggered to prompt the driver.

a.jpg


1.2 Introduction to AT89S52 MCU
The AT89S52 is a low-power, high-performance 8-bit microcontroller with 8 k bytes of in-system programmable Flash memory. The AT89S52 is manufactured using Atmel's high-density non-volatile memory technology and is fully compatible with the instructions and pins of industrial 80C51 products. The on-chip Flash allows the program memory to be programmed in the system and is also suitable for conventional programmers. On a single chip, the AT89S52 has a smart 8-bit CPU and in-system programmable Flash, making the AT89S52 a highly flexible and effective solution for many embedded control application systems.
The AT89S52 has the following standard features: 8 k bytes of Flash, 256 bytes of RAM, 32-bit I/O lines, watchdog timer, 2 data pointers, 3 16-bit timers/counters, a 6-vector 2-level interrupt structure, a full-duplex serial port, and an on-chip crystal oscillator and clock circuit. In addition, the AT89S52 can be reduced to 0 Hz static logic operation and supports 2 software-selectable power saving modes. In idle mode, the CPU stops working, allowing RAM, timer/counter, and serial port interrupts to continue working. In power-off protection mode, RAM content is saved, the oscillator is frozen, and all microcontroller operations stop until the next interrupt or hardware reset.
1.3 Principle and application of ultrasonic sensors
Ultrasonic sensors are sensors developed using the characteristics of ultrasonic waves. Ultrasonic waves are mechanical waves with a higher vibration frequency than sound waves. They are generated by the vibration of transducer chips under the excitation of voltage. They have the characteristics of high frequency, short wavelength, small diffraction phenomenon, especially good directionality, and can be directional propagation as rays. When ultrasonic waves encounter impurities or interfaces, they will produce significant reflections to form echoes, and when they encounter moving objects, they can produce Doppler effects. Therefore, ultrasonic detection is widely used in industry, national defense, biomedicine, etc., using ultrasonic waves as a detection method, and ultrasonic waves must be generated and received. The device that completes this function is an ultrasonic sensor, which is usually called an ultrasonic transducer or an ultrasonic probe.
Ultrasonic probes are mainly composed of piezoelectric chips, which can both transmit and receive ultrasonic waves. Low-power ultrasonic probes are mostly used for detection. It has many different structures, which can be divided into straight probe (longitudinal wave), oblique probe (transverse wave), surface wave probe (surface wave), Lamb wave probe (Lamb wave), dual probe (one probe reflects, one probe receives), etc.
The core of the ultrasonic probe is a piezoelectric chip in its plastic or metal jacket. There are many kinds of materials that make up the chip. The size of the chip, such as diameter and thickness, is also different, so the performance of each probe is different. We must know its performance in advance before using it. The main performance indicators of ultrasonic sensors include:
1) Operating frequency The operating frequency is the resonant frequency of the piezoelectric chip. When the frequency of the AC voltage applied to its two ends is equal to the resonant frequency of the chip, the output energy is the largest and the sensitivity is also the highest.
2) Operating temperature Since the Curie point of piezoelectric materials is generally high, especially when the diagnostic ultrasonic probe uses less power, the operating temperature is relatively low and can work for a long time without failure. The temperature of medical ultrasonic probes is relatively high and requires separate refrigeration equipment.
3) Sensitivity Mainly depends on the manufacturing chip itself. The electromechanical coupling coefficient is large. The sensitivity is high; conversely, the sensitivity is low. [page]

2 Hardware Circuit Design
2.1 Ultrasonic Transmitter Circuit
The AT89S52 microcontroller is programmed to generate a 40 kHz square wave, which is output from port P1.1. Since the signal is weak, it cannot directly drive the ultrasonic transmitter probe, so it must pass through an amplifier circuit to drive the ultrasonic transmitter probe to transmit ultrasonic waves. The transmitter drive circuit is actually a signal amplifier circuit. This design uses the audio power amplifier LM386 produced by National Semiconductor Corporation of the United States. The ultrasonic transmitter circuit is shown in Figure 2.

b.jpg


2.2 Ultrasonic receiving circuit
The ultrasonic receiver consists of three parts: ultrasonic receiving probe, signal amplification circuit and waveform conversion circuit. The design of the ultrasonic receiving circuit is shown in Figure 3. The ultrasonic probe must be of the same model as the transmitting probe. The key is that the frequency must be consistent, otherwise the reception effect will be affected due to the failure to resonate, or even the reception will be impossible. Since the sinusoidal electrical signal after the probe conversion is very weak, it must be amplified by the amplifier circuit. The sinusoidal signal cannot be directly received by the microcontroller and must be converted into a waveform. According to the principle discussed above, the microcontroller only needs the moment of the first echo.

c.jpg


In order to reduce the use of negative power supply, the amplifier circuit adopts a single power supply. A LM324 general-purpose operational amplifier is used for signal amplification and conversion. The first three stages are designed as amplifiers, and the last stage is designed as a comparator. Reasonable adjustment of potentiometer R12 and selection of comparison reference voltage can make the measurement more accurate and stable.

[page]

2.3 Display and alarm circuit
The system alarm circuit consists of a transistor, a buzzer and a resistor, where the resistance of R16 is 4.7 kΩ. When the distance detected by the reversing radar is less than a certain value, the buzzer alarm is triggered. The transistor that controls the buzzer is connected to the P2.3 pin of the microcontroller, and the alarm is triggered when the pin level is high. The circuit diagram is shown in Figure 4.

d.jpg



3 System Software Design
After the system hardware has constructed the basic functions of ultrasonic ranging, the functions implemented by the system software are mainly aimed at the realization of system functions and the processing and application of data. The program first initializes the system environment, sets the working mode of timer T0 to 16-bit timer counter mode, sets the general interrupt enable bit EA and clears the display terminals P0 and P2 to 0. Then the ultrasonic generator subroutine is called to send out an ultrasonic pulse. In order to avoid direct wave triggering caused by the ultrasonic wave being directly transmitted from the transmitter to the receiver, it is necessary to delay 0.1 ms (this is why the rangefinder has a minimum measurable distance) before opening the external interrupt 0 to receive the returned ultrasonic signal. Since a 12 MHz crystal oscillator is used, the machine cycle is 1μs. When the main program detects the flag bit of successful reception, the number in counter T0 (that is, the time taken by the ultrasonic wave to go back and forth) is calculated according to the following formula to measure the distance between the measured object and the rangefinder. The speed of sound at 20°C is taken as 344 during the design. m/s, then: d = 9
(CxTo) ÷ 2 = 72xT0 ÷ 10000cm (where T0 is the count value of counter T0). After measuring the distance, the result will be displayed in decimal BCD code, and then the ultrasonic pulse will be emitted to repeat the measurement.

e.jpg



4 Anti-interference design
Since the working environment of the reversing radar is more susceptible to external vibration, impact, electromagnetic and other interference, the anti-interference ability must be considered in the hardware and software design. This design connects an LC filter and a choke in series at the input end of the power supply to prevent the interference signal from entering; signal isolation and grounding shielding are added in the hardware circuit design; the pulse signal is filtered in the software design.

5 Conclusion
The ultrasonic reversing radar based on the AT89S52 microcontroller designed in this paper has a simple structure, small size, and good anti-interference performance. It can be used in occasions such as car reversing to remind the driver to effectively avoid obstacles and pedestrians that may cause harm to the reversing when reversing, thereby effectively avoiding economic losses and personal safety problems caused by car collisions or scratches caused by reversing, and has strong practicality. Of course, to meet higher accuracy requirements, appropriate improvements must be made, such as adding a temperature compensation unit; in some special applications, factors such as the incident angle and reflection angle of the ultrasonic wave and the density and surface smoothness of the ultrasonic wave propagation medium must also be considered.

Reference address:Design of reversing radar based on single chip microcomputer

Previous article:The working principle of several chips that can be used to drive relays
Next article:Introduction to anti-interference methods of MCU system software

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号