Common line-following robots typically employ basic logical reasoning to navigate along a line. However, this article presents a novel approach to line-following that enhances line detection and prevents the robot from deviating from the black line.
Preparation Checklist1、Autonomously design various installation positions for 3D printed parts
2、TT motors
3、Line-following sensors: Required modification of pin headers for both left and right sensors, positioned vertically at 90 degrees
4、Omni-directional wheels for the robot
5、Button module
6、Rosbot mainboard
7、Power supply module capable of providing 5V output with switch control
8、Installation screws (M3) for all modules
9、3-pin DuPont cables
10、Rubber wheels specifically designed for use with TT motors
Hardware assemblyPrint the 3D structural component as depicted in the diagram.
Install the power supply module and route the power cable accordingly.
Install the bottom omni-directional wheel.
Install the TT motors on both the left and right sides, simultaneously affixing the rubber wheels.
Mount the line-tracking sensor in the designated position.
Please ensure to establish the DuPont connections first.
Secure the Rosbot mainboard in place.
Install the keypad module for debugging and usage.
Hardware ConnectionDuring the connection process, please ensure that the red wire is connected to the positive (+) terminal, and the black wire is connected to the negative (-) terminal.
Connect the left motor to the M1A terminal on the Rosbot.
Connect the right motor to the M1B terminal on the Rosbot.
Connect the left line tracking sensor to the A1 terminal on the Rosbot.
Connect the middle line tracking sensor to the A2 terminal on the Rosbot.
Connect the right line tracking sensor to the A3 terminal on the Rosbot.
Connect the keypad module to the 4th pin on the Rosbot.
Based on the calculation results obtained from the line-tracking sensor, where a value of 1 represents being on the black line and 0 represents being off the line, different conditions can be inferred.
The explanation regarding the "last" variable is as follows:
The "last" variable is used to keep track of the previous position of the black line. If the machine was previously on the black line but suddenly enters an all-white area, the machine needs to immediately correct its direction and return to the black line. The "last" variable helps in determining the previous position for making this correction.








Comments