Views:0 Author:Site Editor Publish Time: 2020-07-31 Origin:Site
Ultrasonic sensors are widely used in robot obstacle avoidance systems. Based on the ultrasonic ranging principle, a parallel ranging system is designed. The hardware composition and software realization method of the system are introduced. Aiming at the phenomenon that multi-sensor parallel ranging is easy to produce interference, the reason of interference is analyzed and an effective solution is proposed. The system is used in the mobile robot obstacle avoidance experiment, and the experimental calibration results of the system's measurement range are given.
Ultrasonic sensor for distance measurement is widely used in applications requiring distance measurement such as mobile robots to avoid obstacles and reversing radars due to their advantages of simple information processing, fast speed and low price. Due to the radiation characteristics of ultrasound, the existing multi-sensor ranging system uses round-robin transmission to reduce the generation of interference. This method has a large blind spot for distance, and real-time performance cannot be guaranteed. The measuring data is also troublesome for subsequent processing such as obstacle positioning and shape discrimination.They designs an ultrasonic ranging system with multiple sensors working in parallel. The system is used for obstacle avoidance experiments on intelligent mobile robots, and good results are obtained.
1 Design of Ultrasonic Ranging System
There are many methods of ultrasonic distance measurement. This article adopts the time of flight method, that is, the distance is calculated by measuring the time t of the ultrasonic wave from the transmitting sensor through the propagation medium to the receiving sensor. Its principle can be expressed by the formula as L=vt/2, (L is the distance to be measured; v is the propagation speed of ultrasonic waves in the air, and t is the transit time). The propagation speed of ultrasound in the air is related to the temperature of the environment, and the accuracy of distance measurement can be improved through temperature compensation.
1.1 Hardware circuit design
It mainly includes upper computer, processor, ultrasonic oscillator circuit, drive circuit, signal amplification, shaping and comparison circuit.
The processor adopts the STC single-chip STC12C5410, which is compatible with the 51 series. Each single-chip microcomputer controls two ultrasonic sensors through a multiplexer, which are located on the front and back of the robot. The main task of the single-chip microcomputer is to measure the transit time and ambient temperature, and calculate the distance of obstacles. The single-chip microcomputer communicates with the host computer through RS232. The upper computer analyzes the received data to locate obstacles and control the movement of the robot.
The ultrasonic transmitter circuit is composed of two parts: an oscillation circuit and a driving circuit. The oscillating circuit is a simple circuit composed of a NAND gate, a resistor and a capacitor, which can generate a 40kHz square wave signal to drive the ultrasonic sensor to emit ultrasonic waves; the driving circuit generates an ultrasonic electric pulse with a certain power to excite the ultrasonic sensor, which is composed of 6 NOT gates in parallel composition, using the driving capability of the chip itself. After being driven, the final signal added to the ultrasonic sensor is a square wave with an amplitude of 5V.
1.2 Software program design
In the system, the single-chip microcomputer must control 2 timers, one is used to measure the transit time, and the other is used to set the baud rate of the communication between the single-chip and the PC to ensure the accuracy of communication; control an external interrupt port to monitor the ultrasonic receiving sensor in real time Whether to receive the reflected ultrasonic signal; use an I/O to control the ultrasonic transmitter sensor to emit ultrasonic at a certain frequency ; using a single bus protocol to control an I/O to read the temperature value collected . The single-chip microcomputer also needs to receive and process the commands of the upper computer, and send the data back to the upper computer in real time according to the requirements of the upper computer.
The ultrasonic transducer sensor circuit is divided into three parts: signal amplification, shaping and comparison. The signal received by the ultrasonic receiving sensor is very weak, in the millivolt level, the signal needs to be amplified before it can be detected by the single-chip microcomputer. In this paper, two-stage amplifying circuits are used to amplify a total of 1000 times. The two-stage amplifying circuits are connected by resistance-capacitance coupling. The signal output from the amplifier flows into the comparator after passing through the voltage doubler shaping circuit. Adjusting the reference voltage of the comparator can change the measurement range and measurement accuracy of the ranging system. The signal output by the comparator is connected to the INT0 of the single-chip microcomputer, triggering the single-chip interrupt.
Multi-computer communication is used to transmit data between the single-chip computer and the host computer. The PC does not have a multi-computer control bit, and
ultrasonic distrance sensor module needs to use software to simulate the TB8/RB8 bit of the microcontroller. The communication protocol setting steps are as follows:
1) Set the MCU to be in the address monitoring state;
2) The PC sends a set of address data with a parity bit of 1;
3) The single-chip microcomputer judges whether the received address is the same as the local address. If it is the same, the address will be sent to the host to establish a handshake agreement with the host;
4) After the host receives the address, it sends data with a parity bit of 0 to notify the microcontroller to send the distance information;
5) The single-chip microcomputer sends the distance data. After sending, return to step to continue to monitor the address.
The task is to send a set of query commands to the serial port every 50ms according to the set communication protocol to read the distance information measured by the single-chip microcomputer; locate the obstacle by analyzing the read distance information, and roughly judge the shape characteristics of the obstacle; take the necessary obstacle avoidance measures control the operation of the robot and display the running track. The software has a good user interface, which is conducive to program debugging.