Design of High-precision Ultrasonic Ranging System Based on STM32 Single-chip Microcomputer

The design of the high-precision ultrasonic ranging system of STM32 single-chip microcomputer is mainly composed of STM32 single-chip microcomputer, ultrasonic transmitting circuit, receiving circuit, compensation circuit and software. This system takes STM32 single-chip microcomputer as the core of the whole system, and realizes high-precision ultrasonic ranging port by coordinating the work of various parts of the circuit.

1. System composition

The design of the high-precision ultrasonic ranging system of STM32 single-chip microcomputer is mainly composed of STM32 single-chip microcomputer, ultrasonic transmitting circuit, receiving circuit, compensation circuit and software. This system takes STM32 single-chip microcomputer as the core of the whole system, and realizes high-precision ultrasonic ranging port by coordinating the work of various parts of the circuit.

Design of High-precision Ultrasonic Ranging System Based on STM32 Single-chip Microcomputer

2. System hardware design

1. Ultrasonic transmitter circuit

The two most important components of the ultrasonic transmitter circuit are the ultrasonic probe and the ultrasonic excitation circuit. Ultrasonic probe is not only an important part of the ultrasonic transmitter circuit, but also an important part of the entire ultrasonic ranging system. It is the main device used to transmit or receive ultrasonic signals in an ultrasonic ranging system. The basic working principle of the ultrasonic excitation circuit is to first use the corresponding mechanism signal to process a specific form of voltage, load it on the ultrasonic probe, and then convert its own electrical energy into ultrasonic waves through the piezoelectric wafer of the ultrasonic probe. Signal diagram.

2. Ultrasonic | receiving circuit

The ultrasonic receiving circuit is composed of ultrasonic signal acquisition and ultrasonic signal processing. The circuit is mainly responsible for capturing the ultrasonic echo signal. Since the electrical pulse signal is formed by the transformation of the ultrasonic sensor after receiving the ultrasonic echo signal, under normal circumstances, it cannot directly enter the STM32 microcontroller. In addition, during the propagation of ultrasonic waves, part of the ultrasonic waves are often lost due to propagation in the auxiliary medium, and the amplitude of the ultrasonic echo signal reduction will also increase as the distance of the measured object increases.

Affected by the reflection and scattering of sound waves and the diffusion of the sound beam itself (2.2.3 ultrasonic compensation circuit), the size of the ultrasonic wave will change with the change of the propagation distance during the propagation process. The greater the propagation distance, the ultrasonic signal The smaller. In the design process of the high-precision ultrasonic ranging system of the STM32 single-chip microcomputer, in order to improve the accuracy of the measurement results, the designer usually compensates for the time gain of the attenuated ultrasonic echo, which requires the addition of an ultrasonic compensation circuit to the system design. , The design of ultrasonic compensation circuit basically adopts receiving amplifier with time gain control function.

3. Ultrasonic compensation circuit

Affected by the reflection and scattering of sound waves and the diffusion of the sound beam itself (2.2.3 ultrasonic compensation circuit), the size of the ultrasonic wave will change with the change of the propagation distance during the propagation process. The greater the propagation distance, the ultrasonic signal The smaller. In the design process of the high-precision ultrasonic ranging system of the STM32 single-chip microcomputer, in order to improve the accuracy of the measurement results, the designer usually compensates for the time gain of the attenuated ultrasonic echo, which requires the addition of an ultrasonic compensation circuit to the system design. , The design of ultrasonic compensation circuit basically adopts receiving amplifier with time gain control function.

4. Main controller

The core component of the system adopts STM32 single-chip microcomputer, which controls the main frequency and timer of the main controller by PLL, so that the frequency of the main controller can reach 72MHz. The main controller has such a high-resolution timer, which can realize the high-precision measurement of ultrasonic distance measurement. 2.3 System software design

STM32 single-chip high-precision ultrasonic ranging system, the main process of its software design is as follows: First, initialize each block of the system, and generate a pulse square wave with a frequency of 40KHz and 8 cycles through the STM32 single-chip PWM. The ultrasonic echo captured in the desert block is input into the capture command; secondly, after the ultrasonic echo enters the receiving circuit smoothly, it is processed by hardware such as shaping circuit and amplifying circuit and transmitted to the STM32 single-chip microcomputer. Inside, when the STM32 single-chip microcomputer captures the echo trigger signal, it uses software filtering and peak time detection to calculate the arrival time of the echo at the peak time; finally, the measured distance value is obtained with the help of related calculation formulas.

The Links:   CM100DY-34A LQ084V1DG42 LCD-DISPLAY