Design and Implementation of a Self-Learning Path-Following Mobile Robot Model
2026-04-06 06:24:12··#1
Abstract: This paper introduces a design method for a wheeled mobile robot model with self-learning path-following function. The model uses two rear wheels as drive wheels to control forward speed and direction. During path learning, the instantaneous speed of the two wheels is recorded and stored as data. Then, a microcontroller (MCU) outputs control signals to drive the rear wheels to achieve path following. Keywords: MCU; robot; learning and memory; path following With the continuous development of science and technology, robot technology has been widely applied and developed in aerospace, marine, military, construction, transportation, industry, and service fields. In some special occasions (such as aerospace, deep-sea operations, and nuclear industry), robot technology represented by unmanned exploration vehicles, unmanned hazard removal vehicles, and unmanned transport vehicles is receiving increasing attention. Therefore, this paper designs a wheeled mobile robot model with road memory function, which is flexible, convenient to use, and has a wide range of applications. The robot model is based on a microcontroller (MCU). First, a human trains the robot model according to the desired route, that is, the robot model memorizes the route (by storing the route data in memory). Afterwards, the robot model can repeatedly walk along this route. Its route learning method is flexible and convenient, allowing for different route training to complete various tasks based on different requirements and needs. This model can be applied to situations where human activity is inappropriate or difficult to control (such as metal tank systems in miniature nuclear reactors, fire detection, radiation, firefighting, and detection of toxic, flammable, and explosive materials), and can also be used as an indoor service robot to replace humans in household chores, factory cargo handling, and the delivery of medical records and documents in hospitals. This robot model has the following characteristics: ● It has road learning and memory and route repetition functions; ● It can simulate map training, and the output magnification can be set as needed; ● In actual work, if it encounters obstacles, it can use a route transfer method to bypass the obstacles and continue along the original learned route; ● It operates without human control; ● It automatically turns on the light source when the light is dim; ● The forward distance can be displayed in real time on the LCD; ● The movement status can be displayed in real time with indicator lights; ● It has a system fault alarm function. 1. System Hardware Design The system hardware design block diagram is shown in Figure 1. The core control part uses Atmel's popular 8-bit MCU AT89C51. As a widely used MCU, the AT89C51 provides various driving functions and interfaces such as motor control, LCD driving display, and sensor information. Furthermore, this MCU is inexpensive and offers high cost-effectiveness. The external storage module uses a 256kB 24LC256 flash memory chip; of course, other capacities of flash memory chips can be selected according to actual needs. A photoresistor is used for light detection to sense the intensity of external light. Obstacle detection uses the PicoDot PD series laser sensor from Banner Engineering Corporation, which can accurately detect, locate, and count the position of the object being measured. 2. System Design Considerations The speed and direction of the wheeled mobile robot model can be controlled by the two rear wheels as drive wheels. The MCU drives the two rear wheel motors through the L293B driver chip. The AT89C5 can control the speed of the two rear wheels separately through two speedometers corresponding to the two rear wheels, thereby realizing the forward and turning functions of the model. 2.1 The speed measuring system consists of a photoelectric switch and a disc with evenly distributed small holes. Its circuit and pulley connection diagram are shown in Figure 2. When a black object blocks the center of the photoelectric switch, the output level is 0; when unobstructed, the output level is 1. When the edge of the disc with evenly distributed small holes rotates within the slot of the photoelectric switch, the disc's rotational speed N can be calculated based on the series of output pulses and the number of holes on the disc. Pulley 1 is attached to the disc, therefore its rotational speed is the same; pulley 2 is coaxial with the rear drive wheel of the model, and its speed is the same; pulley 1 and pulley 2 are connected by a belt. Assuming the circumference of pulley 2 is 5 times that of pulley 1, then the rotational speed of pulley 2 is N/5, which is the wheel's rotational speed N/5. 2.2 The road learning memory counting chip uses a 7-level binary serial counter CD4024. The output waveform of the photoelectric switch is shaped into a standard pulse waveform by a Schmitt trigger, making the CD4024 counting more convenient. Let M be the number of pulses recorded every T time interval. Then, the disk rotation speed N = M/(LT) within T time interval (let L be the number of holes on the disk), and the wheel speed is N/5 = M/(5LT). Since a smaller T results in a more accurate result, T is taken as several to tens of milliseconds. The recorded data is sent by the microcontroller (MCU) to an external 24LC256 flash memory for storage and output. Through the above process, road training can be performed on the model, that is, the speeds of the two rear wheels are recorded into the flash memory every T time interval. After training, the flash memory stores the speeds of the two rear wheels every T time interval, thus achieving the memorization of the training road. 2.3 When controlling the output of the model for repeated path tracking, the microcontroller (MCU) first reads data from the flash memory, then outputs the rotational speed data at intervals T via pulses, and drives the rotation of the two rear wheel motors through the L293B chip. To ensure that the output rotational speed is consistent with the original recorded rotational speed, a feedback control method can be used. While the rear wheel drive motors are rotating, the speedometer module simultaneously detects the rotational speed of the two rear wheels, and then compares whether the rotational speeds of the two rear wheels are the same as the original recorded speed: if it is less than the original recorded speed, an acceleration subroutine can be called; if it is greater, a deceleration subroutine can be called. Since the counting time T is small, coupled with the effect of feedback control, it can be ensured that the output motion trajectory is accurately close to the original training road with very small error. In actual operation, the training road can be simulated as a map scaled down to the actual road while ensuring the accuracy of recording and output. That is, the model is trained on the map, and the output is magnified proportionally, so that the robot can move on the actual road according to the training road. Since the output magnification factor is determined by the program, it can be set according to different needs, which is highly flexible. 2.4 The obstacle avoidance method of the road transfer robot model allows it to start walking from a preset location after training. During its movement, when the sensor detects an obstacle ahead, the model can invoke an obstacle avoidance program to bypass the obstacle and return to the original recorded path to continue moving. A schematic diagram of the obstacle avoidance process is shown in Figure 3. When the model's sensor detects an obstacle at point A, it simulates the obstacle as a rectangular object with one side perpendicular to the model's current direction (see the dotted rectangle in the figure). Then, it interrupts the reading of route data from flash memory and causes the model to turn 90° left at point A. It then moves forward at a constant speed v in a straight line for time t1 to point B, then turns 90° right at point B. Next, it recalls the original recorded route data from the point of interruption and moves forward for time t2 to point C. Afterward, at point C, it rotates in direction C1 by the angle θ between directions C1 and C2 (θ = 90° - difference in distance traveled by the two wheels / distance between the two wheels), changing the model's direction from C1 to C2. Then, it moves at a constant speed v in a straight line for time t1 to point D, at which point the direction is d2. Then, it moves in the opposite direction from C1 to C2, turning at an angle θ from d2 back to the d1 direction, i.e., d1 // C1. In fact, without obstacles, the model should move along segment AD according to the recorded route, reaching point D in the d1 direction. As shown in the figure, the motion of segment BC is completely equivalent to the motion of segment AD. That is, when encountering an obstacle, the robot will transfer segment AD to the actual BC segment to avoid the obstacle, while maintaining its proper motion state and returning to the original recorded route. The selection of t1 and t2 is related to the size of the dashed rectangle (representing the size of the obstacle), which can be determined by the size of the obstacle detected by the sensor. 2.5 Additional functions can be added as needed, such as installing cameras on the model for real-time observation or automatically taking photos to record the surrounding environment of the work area. When the model detects that the ambient light is dim, the microcontroller (MCU) can turn on the light source to provide illumination for the camera. Furthermore, the model is equipped with indicator lights to show its working status in real time. Different indicator lights indicate normal, left turn, right turn, and error status, allowing users to easily understand the model's working condition. An external LCD can display the model's forward distance in real time. The distance traveled by each wheel is calculated as the recorded wheel rotation count multiplied by the wheel's circumference. The average of the two wheel distances is then taken as the model's forward distance, allowing users to easily monitor the model's progress. If the model malfunctions during operation (such as being unable to move forward or losing control), an alarm bell and warning lights will alert the user to promptly repair it. 3. System Software Design Figures 4 and 5 show the software flow for the robot model's road learning and memory, and line-following repetition, respectively. In this program, the recording time interval T during road learning and memorization is 30ms. During output control, comparisons are performed 6 times within each recording cycle (counting once every 5ms, then multiplying by 6 and comparing with the original recorded number to determine whether to accelerate or decelerate), making the output more accurate than the original recorded data. Figure 6 shows the flowchart of the obstacle avoidance program, where the model's direction turning through a certain angle can be achieved by the distance between the two wheels multiplied by the rotation angle in radians when one wheel is stationary and the other wheel is moving. 4. Conclusion Compared to wirelessly remote-controlled robots, this robot model has the advantage of being able to operate in electromagnetically shielded environments. Compared to wired remote-controlled robots, it has the advantage of not requiring real-time human control during operation, being able to complete activities autonomously, and possessing high activity accuracy and efficiency. Compared to fixed-track robots, this model can break free from the limitations of fixed tracks, its activity routes are flexible and changeable, and its adaptability is wider.