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.
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.
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.
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.
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
- Popular Resources
- Popular amplifiers
- 西门子S7-12001500 PLC SCL语言编程从入门到精通 (北岛李工)
- Siemens Motion Control Technology and Engineering Applications (Tongxue, edited by Wu Xiaojun)
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- EEWORLD University Hall----Live Replay: CAN SIC signal improvement function
- TMS570 learning 2-bootload jump experiment
- Playing with Zynq Serial 2——GPIO peripherals of Zynq PS
- Ask the big guy, about the problem of DS1302
- EEWORLD University Hall----Application of IoT sensing technology
- [micropython] STM32 branch improves support for wiznet5k
- MSP430 MCU Development Record (18)
- Oscilloscope probe compensation principle - explain the fundamental reason for oscilloscope probe compensation calibration
- About c0_init_calib_complete of ddr4
- MSP430F5529 generates PWM waves with CCS