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.
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.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.
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.
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.
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.
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.
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
- Popular Resources
- Popular amplifiers
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
- [Lazy people take care of fish tank control system] Debug method in ON Semiconductor IDE environment
- W5500 UDP Issues
- Please tell me what does it mean to subscribe to OBJECT resources in the China Mobile IoT ONENET platform?
- Low power design technology overview.doc
- 【AT32WB415 Review】RTC Electronic Clock
- Can anyone recommend a DCDC module with an isolation strength of more than 6000VAC?
- Design a circuit for corridor voice-controlled lights that includes a single-chip microcomputer.
- Getting Started with the ST SensorTile.box Sensor Kit (2) Getting Started Mode Experience
- FAQ_How to implement low power mode and low power wake-up function in 24G private protocol applications
- [Rawpixel RVB2601 development board trial experience] 4. General hardware timer test