Robots should have several features: mobile function, execution function, feeling and intelligence. At present, there are more than 20 types of robot competitions involving hardware and software simulation held in various countries around the world. Various robot competitions have a common purpose: to cultivate scientific and innovative spirit, stimulate imagination of thinking, and encourage the combination of theory and practice. In addition, more and more automatic control products have been involved in production and are widely used in agriculture and industry. The new working method will greatly shorten the time of manual work and reduce the expenditure of physical labor. The micro robot mouse walking through the maze is mainly based on the principle of automatic guided vehicle (AGV), which enables the robot mouse to identify the route, judge and automatically avoid obstacles, and choose the correct route to get out of the maze. Here we choose to make a simple traveling device so that it can smoothly avoid obstacles or mazes. In order to realize the recognition of the route by the car, judge and automatically avoid obstacles, and choose the correct route, the obstacle judgment adopts a single-beam reflection sampling infrared sensor, the drive motor adopts a DC motor, and the control core adopts an MCS-51 single-chip microcomputer. The control adopts time-division multiplexing technology, and only one single-chip microcomputer is used to realize functions such as signal acquisition, line judgment, and motor control. The maze consists of 16×16 areas. The starting point is set at the corner and the end point is set in the center, occupying 4 areas. Each area is 180 mm×180 mm in size, with a partition wall height of 50 mm and a thickness of 12 mm. The sides are painted white and the bottom is painted black, as shown in Figure 1.
1 Overall design of the maze car control system
The maze car is composed of wall sensors, a single-chip control board, a power system and a steering system. The control block diagram is shown in Figure 2.
The maze car uses a wheeled movement method. The advantages are: simple structure and control and mature technology. The speed of the car can be simply calculated by selecting the motor speed and tire diameter. However, the resistance of the road surface or the driving torque uphill becomes an important factor. Considering this, plastic tires of wireless remote control cars are used on the tires. As shown in Figure 3, the front wheel 1 is a universal caster or a ball wheel, and the rear wheel 2 and the rear wheel 3 are independent drive wheels, and the speed difference between them is used to achieve steering. The characteristics of this combination are that the pivot combination is easy, and when the two drive wheels rotate at the same speed and in opposite directions, the body can rotate around the midpoint of the line connecting the two drive wheels. It is worth noting that the center of rotation is inconsistent with the center of the body.
The choice of materials for the body of the maze car. Most of the materials used in the maze car are used for the structure, and metal materials should generally be used. The maze car should not cause serious deformation and fracture during load and movement, which means it has sufficient strength from a mechanical point of view. The maze car has a small load, light weight, and low requirements for life. Therefore, iron sheets are selected.
1.1 Design of maze car control circuit
The control circuit is mainly composed of motor drive circuit, single chip microcomputer interface circuit, power supply circuit and sensor circuit. The control block diagram is shown in Figure 4.
(1) The infrared light sensing circuit sensor emits infrared light through a light-emitting diode. If there is an obstacle in front, the infrared light will be reflected back and received by the photosensitive transistor. The microcontroller program compares and processes the signal and sends control commands to the two motors of the rear wheels according to the set action requirements to control the movement of the car.
(2) The motor drive circuit uses the 89S51 single-chip microcomputer, which controls the movement of the two drive motors through the L293D chip. The 89S51 determines the direction of the maze car according to the signal fed back by the infrared sensor after detecting the outside world, and according to the maze car pathfinding algorithm, it sends control instructions to the left and right drive motors respectively. After being driven by the L293D chip, the signal directly controls the movement of the corresponding motors, so that the maze car moves forward, backward, and turns according to the predetermined action. [page]
1.2 Maze car control program design
Control algorithm:
There are generally four control algorithms for maze cars:
(1) Left Algorithm
① The default left-hand walking method is to walk along the left wall all the time. When there is a wall on the left, keep moving along the left wall. When there is no wall on the left, turn left and continue to move along the left wall. This algorithm is used for the simplest maze walking method. As shown in Figure 5, the dotted line represents the route of the car.
②The algorithm flow chart is shown in Figure 6.
③ Disadvantages of the left-leaning algorithm. According to this algorithm, the car can get out of the maze in one go when it walks through the maze for the second time, but this path is not necessarily the shortest path; if there is an "island" in the maze itself, the car is likely to not get out of the maze. As shown in Figure 7. The two dots in Figure 7 represent the entrance and exit respectively. If the car enters the maze from the entrance and moves forward to the left, it will cause the car to keep circulating in the maze along the route drawn by the dotted line, and will eventually not get out of the maze.
(2) Front Algorithm
① The forward algorithm is to keep moving forward along the road ahead (keep moving forward when there is no obstacle ahead). If there is no wall ahead, turn left. If there is no wall on the left, turn left. If there is a wall on the left, turn right. Then repeat the cycle. This algorithm is used for the simplest maze walking method.
②The algorithm flow chart is shown in Figure 8.
③ Program idea: If there is no wall in front, go forward. If there is a wall in front, judge the left side. If there is no wall on the left, turn left. If there are walls in front of the left and right, judge the right side. If there is no wall on the right, turn right. If there are walls on three sides, turn back 180° and continue to go forward. 0 means there is a wall, 1 means there is no wall, p3.0 means the left sensor; p3.1 means the front sensor; p3.2 means the right sensor.
The idea of turning angle control is to calculate the rotation speed of the wheels, measure the distance traveled by each wheel when the car turns 90°, divide the speed by the distance, and calculate a time as the delay time when the car turns, and then further refine the turning angle through debugging.
[page]
(3) Flooding algorithm
The flooding algorithm uses 256 B of additional memory, which greatly improves performance. This algorithm is 20 to 50 times more efficient than the general maze algorithm. At the same time, an area can be established in the memory, which corresponds to the number of maze cells in the actual maze. The algorithm is not too complicated in actual use. The additional memory area is called the "wave head", which will be reflected in the actual situation of the memory area as shown in Figure 9. When the maze is flooded, the front of a wave expands outward from the target cell. This cell in the memory area is the only one that needs to be processed. When the wave head reaches the starting cell, the robot has been flooded. Generally speaking, the starting cell can be any cell. However, for convenience, the starting point is set at the first cell of the maze, and the end point is arbitrary. Conversely, the exit can be placed in the first cell and the starting point can be set in the middle or the desired position. Once the starting point is reached, the search is completed. The shortest path allows the robot mouse to move to the cell with a smaller value among the surrounding cells, and so on. The robot mouse can reach the end point.
Advantages and disadvantages of flooding algorithm:
① According to this algorithm, when the car walks through the maze for the first time, it must walk through all the roads in the maze. However, this algorithm allows the car to walk through any maze, even if the maze itself has "isolated islands" and the car can still walk out of the maze smoothly.
② When the car goes through the maze for the second time, it can take the correct route out of the maze once and for all, and this route must be the shortest route.
(4) Paving algorithm
Create an area in memory that corresponds to the actual number of maze grids, and memorize all the paths you have walked. If you find a dead end ahead or a path you have walked, turn back to the previous fork in the road; when you encounter a fork in the road during walking, keep left by default. Because of the memory function, you can walk a second time.
Advantages and disadvantages of the paving algorithm:
① This algorithm can be used to walk through complex mazes without the problem of being unable to get out.
② Using this algorithm, the car can get out of the maze in one go when it goes through the maze for the second time, but it cannot guarantee that this road is the shortest route.
These algorithms have their own advantages and disadvantages. After weighing and comparing, the top algorithm was finally selected.
1.3 System operation and debugging
Problems encountered during program operation and their solutions:
(1) The shell and wheels of the car are installed purely by hand, and the precision is not very high. The car cannot always go straight during driving, and it is easy to cause a wall collision accident, which affects the car's maze. If it is caused by hand-made, it can be solved by wrapping some tape around the wheel that lags behind during driving to increase the circumference of the wheel. It can also be solved by adding an A/D converter to the circuit, making relative improvements to the program, and constantly measuring the distance between the car and the surrounding walls to keep the car at a certain distance from the surrounding walls.
(2) The ST188 infrared sensor is susceptible to external interference and cannot accurately detect wall signals, especially under strong light. It cannot receive light reflected by certain materials and is easily interfered by sunlight, resulting in the car being unable to get out of the maze correctly. The reason for the interference is that the infrared rays emitted by sunlight are the same as those emitted by the infrared sensor. They are both continuous and cannot be distinguished, so they are easily interfered by surrounding light. The solution to this problem is to use the basic principle of wireless remote control to make the infrared emitted by the infrared sensor a signal with a fixed frequency that is different from the surrounding infrared. The receiver is also processed by circuit processing to enable it to directly receive infrared signals with a fixed frequency. Both improvements are achieved by improving the circuit. If it is caused by a reflective surface, it can be solved by limiting the material of the reflective surface. According to the principle of the 555 timer, the improved sensor circuit is shown in Figure 10. Its working principle is that the 555 circuit emits a square wave with a frequency of 100 Hz, driving the light-emitting diode at the radiation end of ST188 to flash at a frequency of 100 Hz, emitting flashing light waves. When an obstacle approaches, the reflected light causes the photoresistor at the receiving end of ST188 to change at the same frequency, causing the voltage value VA at point A in Figure 10 to change accordingly. VA contains a DC component V and an AC component V with a frequency of 100 Hz, the latter of which reflects the approach of the obstacle. In order to retain the useful AC signal V and remove the DC component V, the DC isolation capacitor C1 is used to complete the function of isolating DC and passing AC, and the first operational amplifier circuit completes the amplification of V, and the second operational amplifier realizes the conversion from DC to AC. Specifically, when far away from the obstacle, the output VO of the operational amplifier is high; when the sensor approaches the obstacle, VO outputs a low level.
(3) The speed of the car is difficult to control. It is difficult to grasp the rotation time of the car through program control. When the car turns 90° and 180°, it often turns beyond the specified angle, which affects the car's inability to walk out of the maze in a straight line. One solution is to connect a voltage regulating circuit, and adjust the voltage on the motor to change the wheel speed when the car has a certain turning time, and practice continuously until the predetermined standard is reached. Another solution is to keep the car's speed constant and constantly change the car's turning angle by changing the car's turning angle time in the program, and practice repeatedly to achieve the predetermined goal. Through actual debugging, it was found that these two methods are difficult to achieve the predetermined goal when used alone. Therefore, combining the two methods and debugging can easily achieve the goal.
2 Conclusion
The robot maze car is a common electronic production project for college students. It is a comprehensive application of various knowledge such as electronic circuits, mechanical transmission and automatic control. The steering control of the car involves motor speed regulation. You can first build a control model for the car, and then apply the knowledge of automatic control principles to give a specific control algorithm, so that the steering control and path selection of the car can be more accurate.
Previous article:Design and implementation of large program and data space based on single chip microcomputer
Next article:Design of dynamic digital display circuit based on single chip microcomputer
- Popular Resources
- Popular amplifiers
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
- How to use PieVectTable in DSP2812
- Single-chip MEMS clock generator
- Discuss STM32H750——by RCSN
- Goodbye 2019, hello 2020+ Busy days never change
- Help with esp8266 micropython issue
- [RISC-V MCU CH32V103 Review] + Hardware SPI drive OLED display DHT11 temperature and humidity
- Multi-channel LED driver
- Which formaldehyde sensor is good? Which model? If you have used it, please share and discuss.
- X-NUCLEO-IKS01A3 sensor test based on STM32F401RE development board 4 LIS2MDL magnetometer test
- Issues that need attention when initializing SPI of TI C2000 series 280049 chip