The transmitting and receiving circuit of ultrasonic signal based on single chip microcomputer

Ultrasound is a mechanical wave with a frequency above 20KHz, and the propagation speed in air is about 340 m/s (at 20°C). Ultrasonic waves can be generated by ultrasonic sensors. There are two commonly used ultrasonic sensors: one is to generate ultrasonic waves by electrical means, and the other is to generate ultrasonic waves by mechanical means. At present, piezoelectric ultrasonic sensors are more commonly used. Because ultrasonic wave has the characteristics of easy directional emission, good directionality, good intensity control, insensitivity to color and illuminance, and high reflectivity, it is widely used in non-destructive testing, distance measurement, distance switches, car reversing collision avoidance, intelligent robots and other fields .

Ultrasound is a mechanical wave with a frequency above 20KHz, and the propagation speed in air is about 340 m/s (at 20°C). Ultrasonic waves can be generated by ultrasonic sensors. There are two commonly used ultrasonic sensors: one is to generate ultrasonic waves by electrical means, and the other is to generate ultrasonic waves by mechanical means. At present, piezoelectric ultrasonic sensors are more commonly used. Because ultrasonic wave has the characteristics of easy directional emission, good directionality, good intensity control, insensitivity to color and illuminance, and high reflectivity, it is widely used in non-destructive testing, distance measurement, distance switches, car reversing collision avoidance, intelligent robots and other fields .

The overall block diagram of this design is shown in the figure, which is mainly composed of ultrasonic transmission, ultrasonic reception and signal conversion, key Display circuit and temperature sensor circuit. Ultrasonic ranging is to measure the time difference T between transmitting and receiving echoes by continuously detecting the echoes reflected by obstacles after ultrasonic transmission, and then obtain the distance S=CT/2, where C is the ultrasonic wave speed. At room temperature, the speed of sound in air is about 340m/s. Since ultrasonic wave is also a kind of sound wave, its propagation speed C is related to temperature. During use, if the temperature does not change much, it can be considered that the sound speed is basically unchanged. Because this system requires high ranging accuracy, the propagation speed of ultrasonic waves is corrected by detecting the temperature. After the ultrasonic propagation speed is determined, as long as the time of the ultrasonic round trip is measured, the distance can be obtained. This is the basic principle of the ultrasonic ranging system.

Ultrasonic signal transmitter and receiver circuit

The transmitting and receiving circuit of ultrasonic signal based on single chip microcomputer

The transmitting part of the circuit is shown in Figure 3, which is mainly composed of a pulse modulation signal generating circuit, an isolation circuit and a driving circuit, which is used to provide a transmission signal for the ultrasonic sensor. In the pulse modulation signal generation circuit, the reset (RESET) terminal of the 555 is controlled by the single-chip microcomputer, so that the 555 timer works in a time-sharing manner to generate a pulse modulation signal with a pulse frequency of 40KHz and a period of 30ms. The signal waveform is shown in Figure 2. In this design, 10 pulses are sent in one cycle. The isolation circuit is mainly composed of two NAND gates, which isolate the output stage and the pulse generating circuit. The output stage is composed of two general-purpose integrated operational amplifiers TL084CN. Since the transmission distance of the ultrasonic sensor is proportional to the voltage applied to both ends, the circuit is required to generate a sufficiently large driving voltage. The basic principle is a comparison circuit. When the signal is greater than 2.5V, the output voltage of operational amplifier A is VA=+12V, and the output voltage of operational amplifier B is VB=-12V. When the input signal is 2.5V, the output voltage of operational amplifier A is VA=“-12V”, and the operational amplifier The output voltage of B is VB=+12V, so two symmetrical waveforms with completely opposite polarities are obtained at both ends of the ultrasonic sensor, namely VB=-VA, so the voltage V=VA-VB=2VA applied to both ends of the ultrasonic sensor, the two The voltage of the terminal can reach 24V, so as to ensure that the ultrasonic wave can be sent to a long distance and improve the measurement range.

The circuit of the receiving part is composed of amplifying circuit, band-pass filtering circuit and signal conversion circuit. The amplifier circuit and band-pass filter circuit are shown in Figure 4. Since the ultrasonic signal is attenuated to a large extent when it propagates in the air, the reflected ultrasonic signal is very weak and cannot be directly sent to the post-stage circuit for processing. The signal must be amplified to a sufficient amplitude so that the post-stage circuit can It does the correct processing. The preamplifier circuit is a bootstrap non-inverting AC amplifier circuit composed of integrated operational amplifiers, with high input impedance, C5, C6, C7 are DC blocking capacitors, R5, R6, R7 are bias resistors, used to set the amplifier the static operating point. The band-pass filter adopts a second-order RC active filter, which is used to eliminate the influence of the interference signal in the ultrasonic propagation process.

Amplifier circuit and bandpass filter circuit

As shown in Figure 4 below, the circuit is a second-order voltage-controlled voltage source band-pass filter circuit. In the figure, RW and C10 form a low-pass filter network, C9 and R12 form a high-pass filter network, and the two are connected in series to form a band-pass filter circuit. The integrated op amp and resistors R9 and R10 together form the same-phase proportional amplifier. In order to make the circuit work stably, the gain of the same-phase proportional amplifier must be guaranteed. The center frequency of the band-pass filter ω0=40kHz, and the circuit parameters can be passed AV=1+R9/ R10 and ω0=1/R12C2 (1/RW+1/R13) are determined. The band-pass filtered signal is amplified by the special instrumentation amplifier AD620, and then sent to the signal conversion circuit. The signal conversion circuit mainly converts the received envelope signal into the interrupt trigger signal of the single-chip microcomputer. It consists of envelope detection circuit, voltage comparator and RS flip-flop. The envelope detection circuit is composed of diode D3, resistor R19, and capacitor C13. The signal obtained by envelope detection is shown as V2 in Fig. 6 . The voltage comparator is composed of an integrated operational amplifier and a capacitor resistor. In order to eliminate the interference signal of the transmitting probe, we add the signal output by the microcontroller P1.2 to the non-inverting end of the voltage comparator. Its waveform is a high level of 250μs, and 29750μs. A low-level square wave isolates P1.2 from the forward end of the comparator through diode D3. When P1.2 outputs a high level, the capacitor C14 is charged through the diode. Since the diode is in forward conduction, the charging is very fast. When the output of P1.2 is low, the diode is reversely cut off, and the capacitor is discharged through the resistors RW and R21. , Because the total resistance is relatively large, the discharge is very slow. The waveform is shown in V3 in Figure 6. It can be seen from the figure that when no return signal is received, the comparator outputs a high level. If a return signal is received, the comparison If the transmitter outputs a low level, the output waveform is shown as Vo in Figure 6. By this method, the interference of the transmitting probe to the reflected signal can be eliminated.

When the transmitter sends an ultrasonic signal, P1.2 outputs a high level, and after passing through the inverter, it becomes a low level and is added to the R terminal of the flip-flop, because the voltage comparator output is a high level before the reflected signal is received , so the input of the basic RS flip-flop is, R=O, S=1, which is 0 state, that is, Q=0, Q=1, and the signal of Q is added to the interrupt input of the single-chip microcomputer, because the interrupt of the single-chip microcomputer is the falling edge. Triggered, the input is high, no interrupt is generated. When the transmission is completed, P1.2 outputs a low level, and through the inverter, it becomes a high level and is sent to the R terminal of the flip-flop. When no reflected signal is received, the voltage comparator output is still high. Therefore, the R=“1” and S=1 of the basic RS flip-flop are in the hold state, that is, Q=1, Q=0, and no interruption is generated. When the reflected signal is received, the voltage comparator outputs a low level. Therefore, the input terminal of the basic RS flip-flop is R=“1”, S=0, and the flip-flop works in the 0 state, that is, Q=O, Q= 1. The level of the interrupt input terminal of the single-chip microcomputer changes from high level to low level, so that the single-chip microcomputer generates an interrupt.

The peripheral circuit diagram of the single-chip microcomputer is shown in Figure 7. The display circuit is controlled by the single-chip microcomputer to display the seven-segment digital tube, and the digital temperature sensor DS18820 is used to detect the ambient temperature, so as to perform temperature compensation for the propagation speed of the ultrasonic wave and improve the measurement accuracy. Two buttons are used to control the start and stop of measurement and the switching of distance and temperature display.

Due to the transmitting power and ultrasonic transmitting probe of this system, the measurement distance is between 10cm and 500cm. There is a large error in the short-distance measurement and the long-distance measurement. 1cm. In this design, since the ultrasonic emission period is 10 square waves of 25μs, the emission time is T=250μs, and the speed of sound C at room temperature is known to be 340m/s, and it can be known that S=CT/2=250μs/2=8.5cm, so Confirm that the blind spot for ranging is 9cm. That is, when the measurement distance is less than 9cm, it cannot be measured correctly.

The Links:   SKM 152 GA 123 TX26D60VC1CAB