In the autonomous walking robot system, in order to walk in the unknown and uncertain environment, the robot must collect the environment information in real time to achieve obstacle avoidance and navigation, which must rely on the sensor system which can sense the environment information. Vision, infrared, laser, ultrasonic sensors are widely used in walking robots. Ultrasonic ranging method is widely used because of its simple equipment, low price, small volume, simple design, easy to achieve real-time control, and can meet the requirements of industrial practice in measuring distance and measuring accuracy. The robot introduced in this paper adopts the three-way ultrasonic distance measurement system, which can provide information about the moving distance for the robot to identify the front, left and right environment of its movement.

 Principle of ultrasonic ranging

The ultrasonic generator consists of two piezoelectric plates 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 wafer, the piezoelectric wafer will resonate and drive the resonance plate to vibrate, thus producing ultrasonic wave. On the contrary, if there is no external voltage between the two poles, when the resonance plate receives the ultrasonic wave, it becomes the ultrasonic receiver. There are generally two methods for Ultrasonic Ranging: ① take the average voltage value of the output pulse, which is proportional to the distance, and measure the distance by measuring the voltage; ② measure the width of the output pulse, that is, the time interval t between transmitting and receiving ultrasonic wave, according to the measured distance s = VT? Because the ultrasonic velocity V is related to temperature, if the temperature changes greatly, it should be corrected by temperature compensation.

The measurement system adopts the second method, because the measurement accuracy is not particularly high, so it can be considered that the temperature is basically unchanged. This system takes PIC16F877 single chip microcomputer as the core, realizes the real-time control of the peripheral circuit through software programming, and provides the signals required by the peripheral circuit, including frequency vibration signal, data processing signal, etc., so as to simplify the peripheral circuit, and has good portability. The block diagram of system hardware circuit is shown in Figure 1.

  Detailed explanation of electronic circuit design for ultrasonic distance measurement

Figure 1 block diagram of system hardware circuit

Because this system only needs to know whether there are obstacles in front, left and right of the robot, and it does not need to know the specific distance between the obstacles and the robot, so it does not need to display the circuit. It only needs to set a distance threshold value, so that when the distance between the obstacles and the robot reaches a certain value, the MCU controls the robot motor to stop, which can be realized by software programming.

  Ultrasonic transmitting circuit

The ultrasonic transmitting circuit takes PIC16F877 as the core. When the MCU is powered on, the MCU generates 40KHz ultrasonic signal from Ra0 port. But at this time, the signal cannot enter the amplifying circuit through NAND gate to make the ultrasonic transmitting head emit ultrasonic. Only when the switch S1 is closed, a gating signal is emitted from ra1 port. The frequency of the signal is 4kHz, and the timer TM inside the MCU is started R1, start counting. Every time the gating signal emits a periodic waveform, the ultrasonic wave emits 10 complete waveforms, which can be obtained from their frequencies. The period of ultrasonic wave is 1 (40 kHz) = 0 125 ms, while the period of gating signal is 1 (4 kHz) = 0 125 Ms. Finally, the distance between the obstacle and the mobile robot is calculated according to s = vt2. When the ultrasonic receiver receives the reflected ultrasonic, the counter stops counting, and the time t can be calculated according to the counting of the counter and the period of the gating signal. The ra2 port is connected with RS trigger, which can automatically control the emission and stop of ultrasonic wave. The circuit of this system also includes manual reset circuit, which is controlled by MCLR pin of MCU connected with S2. The circuit diagram of ultrasonic emission is shown in Figure 2.

  Detailed explanation of electronic circuit design for ultrasonic distance measurement

Figure 2 ultrasonic emission circuit diagram

Gating circuit (RS trigger)

In order to realize the automatic control of ultrasonic transmitting and receiving, a gating circuit must be added in the circuit. The gating signal frequency is 4kHz. If the output pulse is taken as the gate signal and the pulse with known frequency fc just passes through the gate, then t = NTC, where TC is the cycle of known pulse and N is the number of pulses. The gating circuit is composed of RS flip-flop. When the input r = 1 (s = 0), it is reset, that is, the output Q = 0; when r = 0 (s = 1), it is set, that is, q = 1. RS trigger is connected with ra2 port of MCU.

  Ultrasonic amplifying circuit

The ultrasonic amplifying circuit is composed of triode and so on. Because the RA port of single-chip microcomputer has only 20mA ~ 25mA pull-up current at most, and the ultrasonic transmitter needs 60mA current at least, a stage amplifying circuit is added after the NAND gate to amplify the current to complete the ultrasonic emission. The ultrasonic amplifying and transmitting circuit is shown in Figure 3.

  Detailed explanation of electronic circuit design for ultrasonic distance measurement

Figure 3 circuit diagram of ultrasonic amplification and emission

Leave a Reply

Your email address will not be published. Required fields are marked *