Autonomous tracking system of robot on complex routes based on AT89C52

Publisher:古古斋Latest update time:2011-09-10 Keywords:AT89C52 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

introduction

The intelligent track-seeking robot is a robot that has been widely studied, and many important competitions both at home and abroad are centered around track-seeking robots.

The so-called complex route is an irregular guide line composed of small radius curves, various angles, straight roads, etc. It is relative to the simple route composed of large radius curves and smooth transitions. The tracking robot car designed by the author uses AT89C52 microcontroller as the control chip and three homemade infrared photoelectric sensors to achieve autonomous tracking of the robot under complex routes with simple design and low cost.

1 Hardware and Circuit

1.1 Control chip

Considering the practicality and cost performance, the AT89C52 microcontroller is used as the robot control chip. AT89C52 is a low-voltage, high-performance CMOS 8-bit microcontroller produced by Atmel Corporation of the United States. It contains 8 KB of repeatedly erasable read-only memory (PEROM) and 256B of random access data memory (RAM), 32 I/O lines, 3 16-bit timers/counters, and 1 full-duplex serial port. The device is produced using Atmel's high-density, non-volatile storage technology and is compatible with the standard MCS51 instruction system and 8052 product pins.

1.2 Sensor Module

As the "eyes" of the tracking robot, choosing the right sensor is the key. Currently, there are two main sensors available on the market: CCD sensors and infrared photoelectric sensors. In recent years, CCD sensor technology has matured. In the recent "Freescale" Cup Smart Car Competition, more and more smart cars use CCD sensors and have achieved good results. However, CCD sensors are relatively expensive, large in size, and data processing is quite complicated. Therefore, in the design of a tracking robot that walks along a predetermined route, infrared photoelectric sensors are more advantageous due to their small size, low price, and simple data processing.

The infrared photoelectric sensor consists of an infrared emitting tube and a photodiode. When working, the infrared light emitted by the infrared emitting tube is reflected back by the measured surface, and the photodiode receives the reflected light. Due to the different materials of the measured surface, the reflectivity is also different. When the measured surface is white, the reflected light is strong, and the photodiode will be turned on; conversely, when the measured surface is black, the photodiode will be cut off. Taking into account interference factors such as external ambient light, the output voltage value has a certain fluctuation range. If it is directly input to the single-chip microcomputer, it may cause detection and judgment errors. Therefore, it is necessary to compare the output voltage with the preset threshold voltage through a comparator (LM324), and then obtain a high and low level to input to the single-chip microcomputer. The threshold voltage is obtained by experimental measurement, and its circuit is shown in Figure 1. Among them, LED is the sensor working indicator, and R1 is the threshold voltage adjustment resistor.

Sensor circuit diagram

Figure 1 Sensor circuit diagram

According to the above circuit, three simple infrared photoelectric sensors were made. The test showed that they had good performance and an effective detection distance of 1 to 4 cm, which met the requirements of robot tracking.

1.3 Driver Module

The two motors driving the robot need different speeds to turn. The driver chip selected is L293D, which contains 4 output channels, with a maximum output peak current of 1.2 A, and can drive two DC motors at the same time; its signal input and enable terminals receive signals from the microcontroller to control the on and off, forward and reverse rotation of the motor, and can also adjust the motor speed (PWM mode) by inputting square wave signals with different duty cycles to the enable terminal.

As shown in Figure 2, the IN port is connected to the control signal, the OUT port is connected to the two ends of the motor, and the EN port is connected to the enable signal. When a group of IN port inputs are high/low or low/high level, the motor can be forward/reverse. When a group of IN port inputs are all high or low level, the motor will stop. When the EN enable terminal is high level, the corresponding port input signal is valid; otherwise, the input signal is invalid. Input PWM wave at the EN terminal, and by adjusting the duty cycle of the PWM wave, the motor can be steplessly adjusted.

Motor drive circuit

Figure 2 Motor drive circuit

2 Tracking control

The schematic diagram of robot tracking control is shown in Figure 3. The robot adopts a three-wheel differential walking mode with front wheel driving and rear wheel assisting. The two front wheels of the vehicle body are active wheels, which are driven by two motors respectively, and their speed difference is used to control the movement direction of the robot; the rear wheel is a driven universal wheel, which only plays the role of supporting the vehicle body. Three self-made infrared photoelectric sensors are placed symmetrically on the front of the vehicle floor with the center line of the vehicle body as the axis, which serve as the robot's tracking sensors.

Figure 3 Schematic diagram of tracking control

Except for the black line, the rest of the area in the robot tracking field is white. When the line is black directly below the sensor, the output is "0", and when it is white, the output is "1". Therefore, in theory, there are 8 combinations of the outputs of the three sensors, as listed in Table 1. Each combination corresponds to a robot's next walking action, with a total of 7 actions: forward, turn left, turn left quickly, turn right, turn right quickly, rotate in place, and stop.

Table 1

This robot has a two-level turning design, namely ordinary turning and fast turning. When the robot deviates from the black line less, ordinary turning is used, that is, both driving wheels move forward, with one speed higher than the other, and the turning is achieved by relying on the speed difference between the two wheels; and when the robot deviates far from the black line, fast turning is used, that is, one of the two driving wheels moves forward and the other moves backward, so that the turning can be achieved quickly. Ordinary turning is used for large-radius curves and large-angle turns, while fast turning is used for non-smooth transition routes such as small-radius curves and right-angle sharp turns. For non-closed routes, an in-situ rotation action is also designed to achieve return to the original route: once the robot car completes the journey, the three sensors will all detect the white area and output the combination state "111". At this time, one wheel moves forward at full speed and the other wheel moves backward at full speed. The car rotates in place until it turns around and the sensor detects the black line.

3 Programming

When designing the program, assembly language is used for programming. The idea is: Step 1, after the system is initialized, read the value of the P2 port of the microcontroller, and then perform bitwise AND on its P2.0, P2.1, and P2.2 to obtain the combined value of the sensor module. Step 2, compare the obtained combined value with the predetermined value. If they are equal, perform the corresponding action, otherwise continue to compare until the correct action is obtained. After comparing all the actions, go to step 1 to rescan the status value of the sensor.

In order to further improve the safety and reliability of the system, an exception handling algorithm needs to be added. Possible abnormal situations include: when passing a small bend or a small angle turn, the robot has completely deviated from the black line before it has time to turn. In this case, all three sensors output "1" and cannot detect the black line. If not handled in time, the robot will not be able to continue tracking. In response to this situation, an in-situ rotation action is designed to find the predetermined route, but the in-situ rotation is divided into clockwise and counterclockwise, so it must be distinguished. The idea of ​​​​the improved programming is: before reading the P2 port value each time, the last sensor combination value is stored in a register. When the combination value is "111", the last value is immediately queried. According to this value, it can be determined from which side the robot deviated from the black line, so as to rotate clockwise or counterclockwise in place. The main program is as follows:

......;System initialization

SENSOR: MOVA,P2

ANLA,#07H; Read the value of P2 port, and take the bitwise AND of P2.0, P2.1, and P2.2

CJNEA,#07H,NEXT; If the combination value is 111, go directly to the action judgment program, otherwise go to NEXT

LJMPDATA_PROCESS

NEXT:MOVR5,A; assign the current sensor combination value to R5

LJMPDATA_PROCESS

DATA_PROCESS: CJNE A,#07H,D1; Judge the combination value to determine whether it is a normal action or a rotation action

LJMP ROTATE

D1: ...; continue with routine action judgment

ROTATE: MOV A,R7; Rotation judgment, assign the last sensor combination value to A

CJNE A,#06H,R1; judge the last sensor combination value and decide the clockwise and counterclockwise rotation

LJMPCLOCKWISE

R1: ...; continue to judge the forward and reverse

CLOCKWISE: ...; clockwise rotation

LJMP DELAYS

DELAYS:MOV A,R5

MOV R7,A; assign the current sensor combination value to R7

LCALL DELAY; call the DELAYS subroutine for delay

LJMP SENSOR ;Rescan sensor status

END; End of program

Conclusion

According to the above design ideas, we made a tracking robot and tested it. The test site is shown in Figure 4. The width of the black guide line is 3 cm, and the area around the black line is covered with white paper. The test results show that the tracking robot can smoothly and smoothly walk along the black line in this complex route, and return along the original route at the end, achieving the expected goal. This provides a reference for further research on automatic walking robots in complex environments.

Robot tracking test image

The innovation of this paper is that it uses three homemade infrared photoelectric sensors to achieve the robot's tracking on complex routes with a simple design and less hardware. Based on the design concept of the robot's double-stage turning, the number of sensors can be increased to form a sensor array to achieve multi-stage turning, thereby having more precise control over the robot's autonomous tracking.

References

[1] Han Yi, Zhang Xuefeng. Implementation of a low-cost tracking robot[J]. Microcomputer Information, 2008, 52: 233-235.

[2] Zhu Yibin, Hu Xuelong, Zhu Yafeng, et al. Design of autonomous tracking robot[J]. Foreign Electronic Measurement Technology, 2006, 25(7): 4042.

[3] He Limin. MCS51 Series MCU Application System Design[M]. Beijing: Beijing University of Aeronautics and Astronautics Press, 2003.

Keywords:AT89C52 Reference address:Autonomous tracking system of robot on complex routes based on AT89C52

Previous article:Design of Image Processing System Based on 89C55 Single Chip Microcomputer
Next article:Support and code generation for dual data pointers in Keil C51 in 8051 architecture

Recommended ReadingLatest update time:2024-11-16 15:34

Design of intelligent traffic light using AT89C52 microcontroller
introduction With the increasing number of cars in cities, the problem of urban traffic congestion is gradually attracting people's attention. Traffic lights are an important tool for the traffic control department to manage urban traffic. At present, the time of most traffic lights is set. Regardless of the traffic p
[Microcontroller]
Design of intelligent traffic light using AT89C52 microcontroller
Design of Multi-ultrasonic Signal Fusion Processing System Based on AT89C52 Single Chip Microcomputer
1 Introduction In the ultrasonic ranging navigation system of mobile robots, a single ultrasonic sensor is difficult to complete the comprehensive detection of the environment due to its inherent deficiencies such as the emission angle. Therefore, in practice, a large number of ultrasonic sensor array
[Microcontroller]
Design of Multi-ultrasonic Signal Fusion Processing System Based on AT89C52 Single Chip Microcomputer
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号