Line Follower

The goal of this project was to create a robot that would be able to follow a colored line. The requirements specified that it would either be able to move quickly, follow multiple colors, and/or be able to retrace its steps if it comes off the line.
Modeling
The primary model and design are from a previous iteration that used a limited color sensor. This design aimed to utilize a camera, for a broader range of values and correctional ability. To achieve this, the sensor mount was lifted up and the wheels widened to allow for a wide angle and sensitive turning radius.
Code
The code for this robot builds on my existing stepper motor library. Threading allowed both motors to move in different timings, directions, and the number of steps. Pre-existing code was adapted to allow for the camera sensor to acquire images in a live feed, and isolate and locate blue regions. This data was then sent back to a PID controller to run the motors. The PID would use the error calculated to adjust the number of steps each motor would take during the robot's next phase.
Obstacles
Some of the challenges in this project came started with the fabrication and continued through the sensor acquisition. We decided to raise the camera off the ground, but it ended up still rather low. We were able to determine this due to the line coming in and out of frame rather quickly, giving little time for the follower to adjust. To combat this, we widened the range that the camera could see to its maximum. This way, the follower, if off-course, could still know which direction it should move to get back onto the line. We decided to tackle the "going fast" challenge, which mean we needed to take data and compute the PID rather quickly. Luckily, once we widened the range, this could be accomplished somewhat well. If I were to do this project again, I would likely raise the camera higher, to get an even wider view for more accurate error measurements as well as more reliable focusing.

You may also like

Back to Top