New embedded ultrasonic distance measurement system

Publisher:神光骑士Latest update time:2012-04-16 Source: eefocusKeywords:Embedded Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

0 Introduction

In industrial distance measurement, non-contact distance measurement is often used due to work requirements and complex environments. Laser, infrared and ultrasonic waves are the most commonly used measurement media in non-contact distance measurement. Although laser distance measurement has high distance measurement accuracy and simple operation, it is greatly affected by the environment, and the system detection is not easy to maintain and the price is relatively expensive.

Infrared ranging is easily affected by ambient light intensity and light color, and the measurement accuracy is not high. Compared with the first two, ultrasonic waves are mechanical waves, which are not affected by light, electromagnetic interference, and low cost. They can measure the level of objects at fixed points and continuously. They have good adaptability in harsh environments such as dust, smoke, and corrosion. They are widely used in level measurement, manipulator control, reversing radar, robot obstacle avoidance, and other industrial sites. Therefore, in recent years, people have conducted a lot of discussions and research on ultrasonic ranging. The ultrasonic ranging sensors currently studied generally have a small ranging range, poor linearity and repeatability. The research method proposed in this paper can solve these two problems well. On the premise of ensuring that the linearity and repeatability are not less than 1. 5‰, the measurement range reaches more than 5 m.

1 Principle of Ultrasonic Ranging System

Among the current ultrasonic distance measurement methods, the echo time method is widely used. The main principle of this method is to detect the time t from the transducer transmitting the ultrasonic wave to receiving the echo signal through threshold comparison or phase correlation, and then calculate the distance s according to the ultrasonic velocity v during measurement. The calculation formula is:

Where speed v is a function of ambient temperature T:

The main errors of echo time distance measurement come from the change of sound speed, the attenuation of echo signal and the setting of receiving threshold. In measuring echo time, the threshold comparison method is simple and practical, but it is easily affected by environmental noise; the phase correlation method has a smaller error than the threshold comparison method and is not easily affected by external noise, but it has high requirements on the speed and storage of the microprocessor, which will increase the cost of hardware and software.

Different from the echo time method, another widely used distance measurement method is the phase difference method, which is mainly based on the vibration principle of mechanical waves. The phase change of 2π corresponds to 1 wavelength of the mechanical wave. The wavelength difference is calculated based on the phase difference between the transmitted wave and the returned wave, and then the distance value is obtained. This method has high measurement accuracy, but it is limited to the measurement of distance within 1 wavelength, and the identification of phase difference will also greatly increase the design cost.

After carefully analyzing and studying the advantages and disadvantages of the above methods, this paper uses the threshold comparison principle based on the pulse time method. The ultrasonic transmitting module uses a flyback converter to increase the ultrasonic transmission power, and the receiving module uses a time-controlled gain amplifier to accurately obtain the echo signal, and finally calculates the distance value. The use of these two core components not only makes the distance measurement system circuit structure simple and low in design cost, but also has a large measurement range and good static characteristics.

2 Ultrasonic ranging system

The overall principle block diagram of the ultrasonic ranging system is shown in Figure 1. The main control part of the ultrasonic ranging system is the C8051f320 single-chip microcomputer, which is a fully integrated mixed-signal system-on-chip microprocessor with a microcontroller core with a high-speed pipeline structure of up to 25MIPS and a full-speed non-intrusive in-system debugging interface. The main reason for using this microprocessor in the ultrasonic ranging system is that it has 5 capture/comparison modules and a programmable counter/timer array (PCA) with a watchdog timer function, which not only makes it very convenient and accurate to measure the echo time, but also can control the operation of 5 ultrasonic ranging modules at the same time.

Figure 1 Overall principle block diagram of ultrasonic ranging system

The transmitting and receiving parts of the ranging system are mainly composed of a flyback converter and a dedicated integrated circuit PM0268. The main advantage of the flyback converter over the forward converter is that it does not require an output filter inductor, which is very important for reducing the size of the converter and reducing costs. PW0268 is a dedicated integrated circuit for ultrasonic ranging. There are two sets of adjustable RC oscillators on the chip, one is the system reference time base, and the other is the ultrasonic oscillation frequency. The ultrasonic RC oscillator has the function of automatic frequency conversion, which can correct the drift of the transducer resonant frequency caused by temperature. A 32-order gain time-controlled amplifier is also integrated on the chip, which can easily compensate for the attenuation of the ultrasonic amplitude in the wave path. PW0268 also has a built-in bandpass filter that only requires a small amount of external resistors and capacitors, as well as a high-speed comparator, which can convert the amplified echo signal into a TTL digital signal that can be processed by the microprocessor.

In addition, due to the integration of ambient temperature compensation and LCD display circuit, the ranging system also has functions such as real-time compensation of sound velocity and real-time display of measurement results.

3 Ultrasonic ranging hardware circuit design

The ultrasonic transmitting and receiving circuit is the core circuit of ultrasonic ranging, which mainly includes the calculation and design of the flyback converter driving transducer circuit and the PW0268 peripheral circuit.

3.1 Flyback Converter Driving Circuit

The ultrasonic transmitting circuit uses the flyback converter commonly used in switching power supplies to significantly increase the voltage signal of the ultrasonic drive, so that the emitted ultrasonic signal is strong enough to facilitate the accurate judgment of the echo signal. The driving circuit is shown in Figure 2. The 40 kHz pulse train controls the field effect tube to continuously switch on and off, so that the primary voltage of the converter is coupled to the secondary to complete the voltage increase, and the transducer is driven to emit ultrasonic waves. Among them, the design of the converter must not only consider the maximum voltage stress of the switching field effect tube, but also focus on the effective value of the primary and secondary currents of the converter, the saturation of the magnetic core, and the impedance matching with the transducer.

Figure 2 Flyback converter drive circuit

3.2 PW0268 peripheral circuit

The I_O pin of PW0268 is a bidirectional pin. When a short low-level pulse is applied to this pin, the Driver_O pin starts to output an ultrasonic oscillation drive signal. After that, a timing signal (Tout) will be started inside PW0268. After that, the I_O pin changes from input to output mode and remains in a high-level state. During the Tout timing period, any external pull-down action on the I_O pin will not make the Driver_O output an oscillation waveform again. When the Tout timing is completed, the I_O pin will be restored to the input state and will start again. When the Driver_O sends out the ultrasonic drive signal, the transducer changes from the transmitting state to the receiving state. The received signal is first sent to the preamplifier of PW0268, then passes through the time-controlled gain amplifier and the bandpass filter, and finally performs echo amplitude detection and comparison before output. The echo signal is sent to the built-in comparator after being processed by the amplifier gain. When the input amplitude exceeds the set threshold, the output is switched to a high level, and the I_O pin is pulled to a low potential.

When C8051f320 detects this falling edge, it considers that the echo signal is received, and thus calculates the distance value. The internal principle and peripheral circuit of PW0268 are shown in Figure 3.

Figure 3 PW0268 peripheral circuit [page]

The biggest advantage of PW0268 for ultrasonic ranging is that it integrates a time-controlled amplifier, and its gain increases in steps of 220/F, where F refers to the system clock frequency of PW0268, which is calculated based on the maximum distance to be measured.

Therefore, for a distance measurement system with a maximum measurement distance of 5 m, after PW0268 sends a pulse train, the gain of the time-controlled amplifier will step by one step every 0.92 ms, thereby compensating for the attenuation of the ultrasonic wave amplitude in the wave path. The time-controlled gain step is shown in Figure 4.

Figure 4 PW0268 time-controlled gain

4 Ultrasonic ranging system software design
The system software consists of the main program, timer timing program, PCA capture interrupt program, ambient temperature acquisition, serial output and LCD display.

The system works in the continuous real-time ranging state. After initialization, the low level triggers PW0268 to send out an ultrasonic drive signal, and the PCA capture timing is turned on at the same time. The system starts waiting to receive the echo signal. When the echo signal is received within the maximum waiting time, the timing is stopped. After correcting the speed of sound according to the ambient temperature, the distance value is calculated and output for display. A complete ranging process is completed; when no echo signal is received within the maximum waiting time, the timing is reset and re-triggered. The flow chart of the system operation is shown in Figure 5.

Figure 5 System flow chart

5 Experimental results and analysis

In order to calibrate the measurement accuracy of the ultrasonic ranging system, a 100 cm × 100 cm × 2 cm hard flat wooden board was used as an obstacle for measurement, and the actual distance was measured with a steel tape measure as the standard value. After experimental verification, the designed ultrasonic ranging system has a measurement blind area of ​​about 300 mm. The system was calibrated three times in the range of (500 ~ 5500) mm for forward and reverse strokes, and the experimental data were analyzed and calculated. The test data are shown in Table 1, and the fitting straight line is shown in Figure 6. The static characteristic indicators of the ultrasonic ranging system are calculated, that is, the linearity is: 0.11%, the repeatability is: 0.15%, and the hysteresis is 0.10%.

Table 1 Data table of 3 forward and reverse stroke experiments

Figure 6 Data of three forward and reverse stroke experiments

6 Conclusion

The ultrasonic ranging system designed in this paper adopts a flyback converter, which not only greatly increases the power of the transmitted ultrasonic wave, but also facilitates the judgment and reception of the echo signal, thereby improving the sensitivity and accuracy of the ranging system. When receiving ultrasonic waves, a time-controlled gain amplifier is used to compensate for the amplitude attenuation of the signal in the wave path, accurately obtain the echo signal, and then calculate the distance value. After experimental testing, the ranging system designed in this paper not only has a simple measurement method, a clear circuit structure, and a low cost, but also has excellent ranging performance, and can be applied to industrial non-contact ranging and other places.

Keywords:Embedded Reference address:New embedded ultrasonic distance measurement system

Previous article:Research on Multi-sensor Measurement and Control System Based on μc/OS-II
Next article:Design test system using MSP430 series microcontroller

Latest Test Measurement Articles
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号