This paper introduces a DSP-based autonomous obstacle avoidance system for robots. The DSP, acting as a microprocessor, collects feedback from ultrasonic sensors regarding the robot's external environment and its own state. After analysis, it generates control commands for the robot's movement direction and sends them to the servo controller via an extended asynchronous communication unit, thereby driving the motors and achieving real-time obstacle avoidance.
1 Introduction
With the advancement of science and technology, the research and application of robots are becoming increasingly widespread. They are not only widely used in industrial production, but also play a significant role in dangerous and harsh environments such as aerospace and deep-sea exploration, and are even gradually penetrating people's daily lives. With the application of computers and the development of sensing technology, research on mobile robots has reached new heights, among which autonomous obstacle avoidance is an important research direction. This paper introduces an autonomous obstacle avoidance system for robots, which uses a high-speed DSP as a processor to collect real-time data from ultrasonic sensors sensing the external environment, thereby determining the robot's movement path and achieving autonomous obstacle avoidance.
2 System Design
The system design framework is shown in Figure 1. Three ultrasonic sensors are used to sense the environment in front, and then the collected information is sent to the DSP for judgment and processing. The asynchronous communication unit of the DSP is extended to send control commands to the motor controllers of the left and right wheels using the RS232 asynchronous communication protocol.
Figure 1 System Design Diagram Figure 2 Sensor and DSP Interface Circuit Diagram Figure 3 Serial Data Transmission Circuit3 System Hardware Selection and Design
The system uses TI's TMS320LF2407A DSP as its microprocessor. This DSP has an execution speed of 40 MIPS, which meets the system's real-time control requirements. It has up to 32K words of on-chip FLASH program memory, a built-in 16-channel 10-bit A/D conversion module, a serial communication interface module, two quadrature encoding circuits, and several 16-bit general-purpose timers, simplifying the peripheral hardware circuitry.
3.1 Sensor and DSP Interface Design
The sensor used in this paper is the Polaroid 6500 series ultrasonic sensor, which uses the same transducer for both transmitting and receiving ultrasonic waves. Its connection to the DSP is shown in Figure 2.
The sensor is triggered by a pulse output from the DSP's general-purpose I/O port. Since the DSP's output level is inconsistent with the sensor's input level, a level conversion unit is required. After triggering, the internal counter is started immediately. When an echo is returned, the sensor outputs a corresponding pulse as an external interrupt source for the DSP, and the DSP stops counting.
3.2 Design of Asynchronous Communication Extension Unit
The servo controller can receive control commands via an RS232 interface. Since the left and right wheels need to be controlled separately, and the DSP selected for the system only has one serial communication module, the TI TL16C554A is selected as the asynchronous communication expansion chip. Each TL16C554A contains 4 asynchronous communication units, and the serial data transmission circuit is shown in Figure 3.
In the circuit, the DSP's A3, A4, and A5 address lines and the /IS signal line are decoded by a 74LV138D decoder chip to generate strobe signals for four asynchronous communication units. These, along with the A0, A1, and A2 address lines and the /WE and /RD read/write signals, allow simultaneous access to any register of the TL16C554A. /IS is the DSP's I/O space strobe pin, meaning the DSP accesses the TL16C554A's registers using I/O addresses. The TL16C554A serial communication circuit uses a MAX3232 driver chip to implement level conversion for the TL16C554A.
4. Ultrasonic ranging principle
Ultrasonic ranging typically employs the time-difference ranging method. An ultrasonic transmitter emits ultrasonic waves in a specific direction, which propagate through the air. The location and distance of the obstacle are determined by the time interval between the waves' reflections from an obstacle and the intensity of the reflected waves. Since the speed of ultrasound in air is related to air temperature and humidity, more precise measurements require consideration of temperature variations and other factors. In applications with less stringent requirements, the following formula can be used: s = c × t / 2, where s is the distance to the obstacle; c is the speed of ultrasound in air, typically taken as 340 m/s; and t is the time difference between the emission and reception of the ultrasonic waves.
5 Obstacle Avoidance Strategy Design
During the movement of the mobile robot, obstacles may be encountered at any time, and the size and number of these obstacles are unknown. Therefore, in order to successfully reach the destination, this design system uses three ultrasonic sensors to detect environmental information, allowing their information to complement each other. The ultrasonic sensors mounted on the mobile robot are shown in Figure 4, where s1, s2, and s3 are the three ultrasonic sensors, and the arrows indicate the direction of the mobile robot's movement.
The ultrasonic transmitter operates under the drive of the processor and pre-amplifier circuit. The signal from the receiver is amplified and shaped, generating an interrupt at the processor's interrupt port. The relative distance between the robot and the obstacle is calculated using the time difference between transmission and reception. The processor then implements an obstacle avoidance algorithm, makes judgments and decisions, and issues corresponding control commands. Finally, the motor's built-in controller controls the motor's movement and steering, thereby achieving active obstacle avoidance for the robot. Figure 5 shows the flowchart of the robot's obstacle avoidance program.
To achieve autonomous control for obstacle avoidance and movement of a mobile robot, the fundamental problems are: on the one hand, sufficient environmental information is required; on the other hand, the ability to process the acquired environmental information and transform it into control information is needed. The design of the obstacle avoidance algorithm mainly addresses how the robot can optimally avoid obstacles. In the initialization phase, the robot calculates a minimum safe distance based on its own size and the size of the obstacle. Then, it uses ultrasonic sensors to detect the current distance to the obstacle. By comparing these two distances, the robot's motion state can be determined. The specific obstacle avoidance rules of the robot are shown in Table 1.
Figure 4. Schematic diagram of sensor installation location. Figure 5. Flowchart of obstacle avoidance procedure. Table 1. Obstacle avoidance rules of the robot.Note: A sensor status of 0 indicates no obstacle; a sensor status of 1 indicates an obstacle.
6. Conclusion
This paper demonstrates how to enable a mobile robot to move smoothly using ultrasonic ranging information. Using ultrasonic sensors for ranging has the advantages of simple and fast information processing, but it also has certain limitations, mainly manifested in the large angle and poor directionality of the emitted detection beam, which can only obtain distance information to the target but cannot accurately provide the target's position and boundary information. During the experiment, it was found that when the angle between the robot and the obstacle is too large, a collision may occur. Future work will focus on achieving multi-sensor fusion to enable the robot to quickly and accurately achieve obstacle avoidance.