top of page

Line Following Robot

Lasercutting, 3D Printing, Python

2/8/24 - 2/20/24: Group of 2

Overview

IMG_3522_edited.jpg

Line-Following Robot

For this project, we were tasked with creating a line-following robot using a color sensor. Specifically, we had a piece of paper with 4 distinctly colored lines on it and our robot had to be able to follow one of these lines autonomously. 

​

We were also challenged to incorporate proportional, integral, and derivative (PID) control to make our readings more accurate. In the end, my partner and I created a robot that could successfully follow the blue line using one color sensor! As always, I added a Kirby to my project as a mascot.

Approach

We were given the option to use one or two color sensors. Originally, my teammate and I opted to use two, with one sensor on either side of the colored line. The RGB values of the color sensors would alter when the sensor went from being on the white paper to the colored line, and our system would adjust accordingly.

​

However, the color sensors were not always reliable and the values that both were reading for the same colors were not always the same. Therefore, we then shifted our design to incorporate one color sensor, which we always wanted to be positioned to the right of the colored line.

Incorporating PID

The biggest challenge in this project was successfully incorporating PID to calibrate the speed of our motors continuously while the color sensing was reading values. For this project, we did not incorporate the integral control.

​

Our methodology was to read the red values from the white paper and make that our desired value. This is because the red values for blue were significantly lower. Then, we would subtract what our color sensor was reading from the desired value to find the error. The PID output would then be added or subtracted to the motor, continuously updating the speed of the motors according to the color sensor values.

 

A more in-depth look at our code can be found at the github link above.

Screenshot 2024-02-21 143852.png

PID Control Code

Results

Below you can see the successful demo run of our line-following robot! 

  • We wanted to have the robot move faster, but then the color sensor would move too fast for it to read and adjust speed (also why we made the robot pause periodically)

  • To get more accurate readings, we could also compare green and blue values instead of only red

Challenges/Areas of Improvement

Learning Summary

  • Enjoyment of Design and Fabrication: Wanting to try and recycle old materials, we originally planned to reuse an old chassis. However, we found that it was not only easier to make a new chassis, but more fun and rewarding to create a personalized project. While I enjoyed learning and challenging myself more with code, I found that when we remade the chassis I had a lot of fun, emphasizing to me that I like fabricating and design!

  • Implementation of PID: We were able to integrate PID to continuously make the robot adjust its speed and direction and create a more accurate reading of the sensors.

bottom of page