introduction
Some traditional distance measurement methods have insurmountable defects in certain special occasions. For example, liquid level measurement is a kind of distance measurement. The traditional electrode method uses differential distribution electrodes to detect the liquid level by applying electricity or pulses. The electrodes are easily corroded and electrolyzed when immersed in water or other liquids for a long time, and lose sensitivity. Using ultrasonic distance measurement can solve these problems.
The ultrasonic rangefinder designed in this paper uses three range-measuring modes to select jumper J1 (short distance, medium distance, and adjustable distance). The overall solution is that when the measurement key is pressed, the probe sends ultrasonic waves, and when the ultrasonic waves encounter obstacles, an echo signal will be generated; the system amplifies the echo signal received by the probe and sends it to the controller; the temperature measurement circuit measures the temperature, calculates the measured distance, and displays it on the digital display, with the last 4 digits showing the distance and the first 2 digits showing the temperature.
1 Basic Principle of Ultrasonic Rangefinder
The principle of using ultrasound to measure distance is shown in Figure 1. It can be simply described as follows: the regularly transmitted ultrasound waves are reflected when encountering obstacles. The reflected waves are received by the receiver and converted into electrical signals. In this way, the distance can be calculated by measuring the time difference △t between transmission and reception, and then according to formula (1):
Where: C is the propagation speed of ultrasound in air, C is 331 m/s at 0℃, C is 347 m/s at 25℃, and its relationship with ambient temperature T (unit: ℃) is as shown in formula (2):
It can be seen that the speed of sound is closely related to temperature. In applications, if the temperature does not change much and there is no special accuracy requirement, the speed of sound can be considered to be basically unchanged. Otherwise, temperature compensation must be performed. The temperature compensation method is to first calculate the speed of sound C at that time according to formula (2) and then calculate the distance according to formula (1).
In addition, it can be seen from Figure 1 that since ultrasound uses the received reflected waves to calculate the distance, there is inevitably an angle between the emission and the reflection, and its size is 2a. When a is very small, the distance can be directly calculated according to formula (1); when a is large, the distance must be corrected, and the correction formula is as shown in formula (3):
2 System Hardware
The ultrasonic rangefinder mainly includes: temperature detection circuit, ultrasonic emission and control circuit, ultrasonic reception and signal processing circuit, display circuit, microprocessor and its auxiliary circuit and RS 232 communication interface circuit. Its structural block diagram is shown in Figure 2.
2.1 Ultrasonic emission and control circuit
The ultrasonic probe model is CSB40T. The software generates a 40 kHz ultrasonic signal, which is input to the driver through the output pin. After being driven by the driver, the probe is driven to generate ultrasonic waves, as shown in Figure 3. It can be seen from the figure that the 40 kHz ultrasonic signal is generated by oscillating the 555 time base circuit. The oscillation frequency calculation formula is as follows:
The purpose of designing R10 as an adjustable resistor is to adjust the signal frequency to make it consistent with the 40 kHz natural frequency of the transducer. In order to ensure that the 555 time base has sufficient driving ability, it is advisable to use a +12 V power supply. CNT is the ultrasonic emission control signal, which is controlled by a microprocessor. [page]
2.2 Design of Ultrasonic Receiver
The ultrasonic receiver consists of three parts: ultrasonic receiving probe, signal amplification circuit and waveform conversion circuit. The ultrasonic probe must be of the same model as the transmitting probe, and CSB 40R is used here. Since the sine wave electrical signal after the probe conversion is very weak, it must be amplified by the amplifier circuit. The sine wave signal cannot be directly received by the microprocessor, so the waveform must be changed. As shown in Figure 4, the front stage uses NE5532 to form a 10,000-fold amplifier to amplify the received signal; the back stage uses LM311 comparator to adjust the received signal. The input of LM311's 3-pin is the comparison voltage. Different comparison voltages can be selected by the J1 jumper to select different ranging modes, as shown in Figure 5.
The module provides a distance measurement mode selection jumper J1, which can select short-distance measurement mode, medium-distance measurement mode or adjustable distance mode. When the jumper is selected LOW, it is the short-distance measurement mode, when it is selected HIGH, it is the medium-distance measurement mode; when it is selected SET, it is the adjustable distance mode.
2.3 Temperature Measurement Circuit
When the ambient temperature changes, the ultrasonic wave velocity will change accordingly, so it needs to be corrected. Therefore, a temperature detection circuit is set up in the system to collect temperature in real time and correct the wave velocity. The sensor used in the temperature measurement circuit is DS1820, as shown in Figure 6. It has 9, 10, 11, and 12-bit conversion accuracy. The default accuracy is 12 bits when not programmed. The measurement error is generally 0.5°C, which can reach 0.1°C after software processing.
3 System Software
The system flow chart is shown in Figure 7.
The microprocessor P89LPC932 first sets P1.6 to 0, starts the ultrasonic probe to emit ultrasonic waves, and starts the internal timer T0 to start timing. Then the temperature is detected and temperature compensation is performed. When the ultrasonic signal encounters an obstacle, the signal returns immediately. The microprocessor keeps scanning the P2.7 pin. If the signal received by P2.7 changes from a high level to a low level, it indicates that the signal has returned, and the microprocessor enters an interrupt to turn off the timer. The data in the timer is then converted to obtain the measured distance.
4 Conclusion
This system has three mode jumper selections, so it has the characteristics of high measurement accuracy, strong anti-interference ability, fast response speed, etc. Experiments show that the actual measurement accuracy of this rangefinder is the best 1%, and the farthest distance is about 700 cm.
Previous article:Design of ultrasonic guided wave excitation signal source based on DS89C430
Next article:Design of Power Factor Measuring Instrument Based on P89V51RD2
- 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
- SHT31 Review - In-depth Review
- 【McQueen Trial】+ Unboxing and Assembly
- Using nRF24L01 with MicroPython
- [Help Post] High-frequency oscillation of high-frequency switching power supply current
- SHT31 Review - Unboxing and First Impressions
- IoT security himqtt firewall data structure ringbuffer ring buffer
- EEWORLD University Hall----Live Replay: TI's Latest Application of Millimeter-Wave Radar in the Automotive Field
- Changes in car rear lighting design
- EEWORLD University - Tektronix will teach you the oscilloscope usage skills you don't know
- [Download Gift] Demonstrate Multi-channel Signal Spectrum Analysis Using the Spectrum View Function of the New Tektronix MSO6 Oscilloscope