This article described the three directions (before, left, right) ultrasonic ranging system is to understand the front of the robot, left and right environment to provide a movement away from the (Similar to GPS Positioning System) A principle of ultrasonic distance measurement 1, the principle of piezoelectric ultrasonic generator Piezoelectric ultrasonic generator is the use of piezoelectric crystal resonators to Ultrasonic generator, the internal structure as shown in Figure 1, it has two piezoelectric chip and a resonance When it's two plus pulse signal, the frequency equal to the intrinsic piezoelectric oscillation frequency chip, the chip will happen piezoelectric resonance, and promote the development of plate vibration resonance, ultrasound is Conversely, if the two are not inter-electrode voltage, when the board received ultrasonic resonance, it will be for vibration suppression of piezoelectric chip, the mechanical energy is converted to electrical signals, then it becomes the ultrasonic 2, the principle of ultrasonic distance measurement Ultrasonic transmitter in a direction to launch ultrasound, in the moment to launch the beginning of time at the same time, the spread of ultrasound in the air, obstacles on his way to return immediately, the ultrasonic reflected wave received by the receiver immediately stop the Ultrasound in the air as the propagation velocity of 340m / s, according to the timer records the time t, we can calculate the distance between the launch distance barrier (s), that is: s = 340t / 2 Ultrasonic Ranging System for the Second Circuit Design System is characterized by single-chip microcomputer to control the use of ultrasonic transmitter and ultrasonic receiver since the launch from time to time, single-chip selection of 8751, economic-to-use, and the chip has 4K of ROM, to facilitate Circuit schematic diagram shown in Figure Draw only the front range of the circuit wiring diagram, left and right in front of Ranging Ranging circuits and the same circuit, it is 1,40 kHz ultrasonic pulse generated with the launch Ranging system using the ultrasonic sensor of piezoelectric ceramic sensors UCM40, its operating voltage of the pulse signal is 40kHz, which by the single-chip implementation of the following procedures to puzel: mov 14h, # 12h; ultrasonic firing continued 200ms here: cpl 0; output 40kHz square wave nop; nop; nop; djnz 14h, here; ret Ranging in front of single-chip termination circuit P0 input port, single chip implementation of the above procedure, the P0 port in a 40kHz pulse output signal, after amplification transistor T, the drive to launch the first ultrasonic UCM40T, issued 40kHz ultrasonic pulse, and the continued launch of Ranging the right and the left side of the circuit, respectively, then input port P1 and P2, the working principle and circuit in front of the same 2, reception and processing of ultrasonic Used to receive the first launch of the first pair UCM40R, the ultrasonic pulse modulation signal into an alternating voltage, the op-amp amplification IC1A and after polarization IC1B to IC IC2 is locked loop with audio decoder chip LM567, internal voltage-controlled oscillator center frequency of f0 = 1/1R8C3, capacitor C4 determine their target R8-conditioning in the launch of the carrier frequency on the LM567 input signal is greater than 25mV, the output from the high jump 8 feet into a low-level, as interrupt request signals to the single-chip Ranging in front of single-chip termination circuit output port INT0 interrupt the highest priority, right or left location of the output circuit with output gate IC3A access INT1 port single-chip, while single-chip P3 and P 4 received input IC3A, interrupted by the process to identify the source of inquiry to deal with, interrupt priority level for the first left right Part of the source code is as follows: receive1: push psw push acc clr ex1; related external interrupt 1 jnb 1, right; P1 pin to 0, ranging from right to interrupt service routine circuit jnb 2, left; P2 pin to 0, to the left ranging circuit interrupt service routine return: SETB EX1; open external interrupt 1 pop? acc pop? psw reti right: ?; right location entrance circuit interrupt service routine ? Ajmp? Return left: ; left Ranging entrance circuit interrupt service routine ? Ajmp? Return 4, the calculation of ultrasonic propagation time When you start firing at the same time start the single-chip circuitry within the timer T0, the use of timer counting function records the time and the launch of ultrasonic reflected wave received When you receive the ultrasonic reflected wave, the receiver circuit outputs a negative jump in the end of INT0 or INT1 interrupt request generates a signal, single-chip microcomputer in response to external interrupt request, the implementation of the external interrupt service subroutine, read the time difference, calculating the distance Some of its source code is as follows: RECEIVE0: PUSH PSW PUSH ACC CLR EX0; related external interrupt 0 ? MOV R7, TH0; read the time value MOV R6, TL0? CLR C MOV A, R6 SUBB A, # 0BBH; calculate the time difference MOV 31H, A; storage results MOV A, R7 SUBB A, # 3CH MOV 30H, A? SETB EX0; open external interrupt 0 POP ACC? POP PSW RETI Fourth, the ultrasonic ranging system software design Software is divided into two parts, the main program and interrupt service routine, shown in Figure 3 (a) (b) (c) Completion of the work of the main program is initialized, each sequence of ultrasonic transmitting and receiving Interrupt service routines from time to time to complete three of the rotation direction of ultrasonic launch, the main external interrupt service subroutine to read the value of completion time, distance calculation, the results of the output and so V CONCLUSIONS Required measuring range of 30cm ~ 200cm objects inside the plane to do a number of measurements found that the maximum error is 5cm, and good Single-chip design can be seen on the ultrasonic ranging system has a hardware structure is simple, reliable, small features such as measurement Therefore, it can be used not only for mobile robot can be used in other detection Thoughts: As for why the receiver do not have the transistor amplifier circuit, because the magnification well, CX20106 integrated amplifier, but also with automatic gain control level, magnification to 76dB, the center frequency is 38k to 40k, is exactly resonant ultrasonic sensors frequency