The human ear can only sense sound waves of about 20,000 Hz at most. Sound waves with higher frequencies are called ultrasound. Ultrasound is widely used in many technologies. Ultrasound has two characteristics: high energy and straight line propagation. Its application is based on these two characteristics. Theoretical studies have shown that under the same amplitude, the energy of an object's vibration is proportional to the square of the vibration frequency. When ultrasound propagates in a medium, the frequency of the vibration of the medium particles is very high, so the energy is very high. In the dry winter in northern my country, if ultrasound is passed into a water tank, the violent vibration will break the water in the tank into many small droplets. Then a small fan is used to blow the droplets into the room, which can increase the indoor air humidity. This is the principle of an ultrasonic humidifier. For diseases such as pharyngitis and tracheitis, it is difficult for the drug to reach the affected area. Using the principle of a humidifier, the drug solution is atomized and inhaled by the patient, which can enhance the efficacy. The huge energy of ultrasound can also be used to break up stones in the human body. It is troublesome to remove the scale of metal parts, glass and ceramic products. If ultrasonic waves are introduced into the cleaning liquid containing these items, the violent vibration of the cleaning liquid will impact the dirt on the items and clean them quickly. When we talk on one side of the wall, people on the other side can also hear us, which shows that sound waves can bypass obstacles, as shown in Figure 6. However, the shorter the wavelength, the less obvious this diffraction phenomenon is. Therefore, ultrasonic waves basically propagate in a straight line and can be emitted in a directional manner. If a fishing boat carries an underwater ultrasonic generator, it rotates and emits ultrasonic waves in all directions. When the ultrasonic waves encounter a school of fish, they will be reflected back. The fishing boat will know the location of the school of fish by detecting the reflected waves. This instrument is called sonar, which can also be used to detect reefs in the water, enemy submarines, and measure the depth of the sea.
The basic principle of ultrasonic ranging
The ultrasonic transmitter emits ultrasonic waves in a certain direction, and starts timing at the same time as the emission. The ultrasonic waves propagate in the air, and immediately return when they encounter obstacles on the way. The ultrasonic receiver stops timing immediately when it receives the reflected wave. The propagation speed of ultrasonic waves in the air is 340m/s. According to the time t recorded by the timer, the distance (s) from the emission point to the obstacle can be calculated, that is: s=340t/2. This is the so-called time difference ranging method.
The principle of ultrasonic ranging is to use the known propagation speed of ultrasonic waves in the air to measure the time it takes for the sound wave to be reflected by an obstacle after being transmitted, and calculate the actual distance from the transmitting point to the obstacle based on the time difference between transmission and reception. It can be seen that the principle of ultrasonic ranging is the same as that of radar.
The formula for ranging is: L=C×T
Where L is the measured distance length; C is the propagation speed of ultrasonic waves in the air; T is the time difference of the measured distance propagation (T is half of the time from transmission to reception). Ultrasonic ranging is mainly used for distance measurement of reversing reminders, construction sites, industrial sites, etc. Although the current ranging range can reach hundreds of meters, the measurement accuracy can often only reach the order of centimeters. Due to the advantages of ultrasonic waves being easy to transmit in a directional manner, good directionality, easy to control intensity, and no need for direct contact with the measured object, it is an ideal means of measuring liquid height. In precise liquid level measurement, millimeter-level measurement accuracy is required, but the current domestic ultrasonic ranging dedicated integrated circuits only have centimeter-level measurement accuracy. By analyzing the causes of ultrasonic ranging errors, increasing the measurement time difference to microseconds, and using the LM92 temperature sensor to compensate for the sound wave propagation speed, the high-precision ultrasonic rangefinder we designed can achieve millimeter-level measurement accuracy.
Principle of Piezoelectric Ultrasonic Sensor
At present, ultrasonic sensors can be roughly divided into two categories: one is ultrasonic waves generated by electrical means, and the other is ultrasonic waves generated by mechanical means. Electrical means include piezoelectric, magnetostrictive and electric types; mechanical means include Galton flute, liquid whistle and air flow whistle. The frequency, power and sound wave characteristics of the ultrasonic waves they generate are different, so their uses are also different. In engineering, piezoelectric ultrasonic sensors are currently more commonly used.
Piezoelectric ultrasonic generators actually work by using the resonance of piezoelectric crystals. The internal structure of the ultrasonic generator is shown in Figure 1. It has two piezoelectric chips and a resonance plate. When a pulse signal is applied to its two poles, and its frequency is equal to the natural oscillation frequency of the piezoelectric chip, the piezoelectric chip will resonate and drive the resonance plate to vibrate, thus generating ultrasonic waves. On the contrary, if no voltage is applied between the two electrodes, when the resonance plate receives ultrasonic waves, it will press the piezoelectric chip to vibrate, converting mechanical energy into electrical signals, and then it becomes an ultrasonic receiver.
Hardware Circuit Design of Reflective Ultrasonic Distance Meter
The hardware circuit of this system consists of a single-chip minimum system, a temperature compensation circuit, an ultrasonic transmitting circuit, an ultrasonic receiving circuit, and a display circuit, as shown in Figure 1.
The specific working process of this ultrasonic rangefinder is as follows: after the single-chip microcomputer generates a reset signal, MC9S12DG128B generates a control signal to control the peripheral circuit to generate 40kHz ultrasonic waves, which are added to the ultrasonic transducer after shaping and amplification to emit ultrasonic waves with a frequency of 40kHz. At the same time, the internal timer of MC9S12DG128B is counted to measure the time taken from the ultrasonic signal from sending to receiving, and the ultrasonic signal received by the ultrasonic transducer R is amplified, filtered, and shaped, and used as a receiving signal to start the input capture function of the timer to complete a time operation of ultrasonic ranging. At the same time, the current ambient temperature is measured by the temperature sensor DS18B20, read into the single-chip microcomputer, and then processed by it to display the corresponding measurement value and current temperature on the LCD screen.
Microcontroller MC9S12DG128B
MC9S12DG128B is a 16-bit microcontroller in the S12 controller launched by Freescale. It has high integration, rich on-chip resources, and interface modules including SPI, SCI, I2C, A/D, PWM, etc. It has strong functions in FLASH storage control and encryption.
The MC9S12DG128B microcontroller uses an enhanced 16-bit S12 CPU, with an on-chip bus clock frequency of up to 25MHz; on-chip resources include 8kB RAM, 128kB FLASH, 2kB EEPROM, SCI, SPI and PWM serial interface modules; the PWM module can be set to 4 8-bit or 2 16-bit channels, with a wide range of selectable clock frequencies; it also provides 2 8-channel 10-bit precision A/D converters, controller area network CAN and enhanced capture timer, and supports background debug mode (BDM). [page]
Ultrasonic transmission circuit
The ultrasonic transmitting circuit is generally composed of an ultrasonic reflector T, a 40kHz supersonic frequency oscillator, a driving (or excitation) circuit, etc. This design uses a gate circuit to generate 40kHz ultrasonic waves. The ultrasonic transmitting circuit is shown in Figure 2.
In the figure, the NAND gate 74LS00 and LM386 form an ultrasonic transmission circuit. The 74LS00 is used to form a multivibrator. By adjusting the 20k potentiometer, a 40kHz signal for ultrasonic transmission can be generated. U3A is the driver, the circuit oscillation frequency f≈1/2.2RC, and the control signal of the microcontroller is input by U2A. In order to increase the transmission frequency of the ultrasonic wave, this design uses a single op amp LM386, and the transmission distance can reach 4m.
Ultrasonic receiving circuit
The ultrasonic receiving circuit is shown in Figure 3. The receiving head uses an ultrasonic receiver R paired with the transmitting head to convert the ultrasonic modulated pulse into an alternating voltage signal. In order to shape the signal, the CMOS-level 6-not-gate chip CD4069 in the design can reduce the complexity of the circuit and improve the circuit's load capacity. The shaped signal is coupled by C1 to the input terminal 3 pin of the audio decoding integrated block LM567 with a locking loop. When the amplitude of the input signal falls on its center frequency, the logic output terminal 8 pin of the LM567 jumps from a high level to a low level.
DS18B20 temperature compensation circuit
According to the above formula (2), temperature has a great influence on the speed of sound. If it is not compensated, it will cause measurement errors. In order to improve the measurement accuracy of the system, a temperature compensation circuit is designed. The system uses a digital temperature sensor DS18B20 to collect temperature. DS18B20 is a 1-wire bus serial digital temperature sensor produced by DALLAS, USA. It has the advantages of miniaturization, low power consumption, strong anti-interference ability, and easy interface with microprocessors. It is suitable for various temperature measurement and control systems. Its measurement temperature range is -55℃~+125℃, the accuracy can reach 0.0675℃, and the maximum conversion time is 200ms.
The biggest difference between digital temperature sensors and analog temperature sensors is that the temperature signal is directly converted into a digital signal and then output through serial communication. Therefore, mastering the communication protocol of DS18B20 is the key to using this device. The protocol defines several signal types: reset pulse, response pulse time slot; write "0", read "1" time slot, read "0", read "1" time slot. After initialization, the sensor outputs two bytes of temperature. After data processing, the actual temperature value is obtained. The compensated sound velocity can be calculated using formula (2).
LCD display circuit
The character dot matrix series module is a type of dot matrix display module specially used to display letters, numbers, symbols, etc. It is divided into 4-bit and 8-bit data transmission modes. It provides 5×7 dot matrix + cursor and 5×10 dot matrix + cursor display modes. It provides display data buffer DDRAM, character generator CGROM and character generator CGRAM. You can use CGRAM to store the font data of up to 8 5×8 dot matrix graphic characters defined by yourself. It provides a wealth of command settings: clear display, cursor return to origin, display on/off, cursor on/off, display character flashing, cursor shift, display shift, etc. It provides an internal power-on automatic reset circuit, and automatically initializes the module when the external power supply voltage exceeds +4.5V.
References:
[1]. LM92 datasheet http://www.dzsc.com/datasheet/LM92_452213.html.
[2]. MC9S12DG128B datasheet http://www.dzsc.com/datasheet/8B_1082342.html.
[3]. DS18B20 datasheet http://www.dzsc.com/datasheet/DS18B20_819975.html.
[4]. S12 datasheet http://www.dzsc.com/datasheet/S12_1619040.html.
[5]. 25MHz datasheet http://www. dzsc.com/datasheet/25MHz_1136611.html.
[6]. 74LS00 datasheet http://www.dzsc.com/datasheet/74LS00_798572.html.
[7]. LM386 datasheet http://www.dzsc.com/datasheet/LM386_1054627.html.
[8]. CD4069 datasheet http://www.dzsc.com/datasheet/CD4069_1054686.html.
[9]. LM567 datasheet http://www. dzsc.com/datasheet/LM567_451669.html.
Previous article:Design of HPI port communication between TMS320VC5402 and single-chip microcomputer
Next article:Design and application of engine electronic fuel injection control system based on MC68HC9S12 single chip microcomputer
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
- SinlinxA33 Development Board Linux Interrupt Programming 4-Final Code (1)
- 【GD32E503 Review】05: Review of SPI Flash Driver
- Production of msp430g2553 emulator download line
- Solving High-Temperature Isolation Design Challenges Using Grade 0 Digital Isolators
- The top 10 list of big companies with the highest salaries and 996 working hours is out! Netizen: Although it’s 996, the salary is quite high~
- EEWORLD University Hall ---- Computer Vision Course Tsinghua University Wang Mingzhe
- Download to get a gift! Lots of exquisite gifts are waiting for you!
-
EEWORLD University Hall----Live Replay:
takes you to learn about ADI's digital health biosensor series - Switching power supply using microcontroller for loop control
- Popular Science Sharing - Detailed Explanation of the Working Principles of Starlink Satellites (Episode 3)