Line following robot

This project was part of Carnegie Mellon’s Introduction to Mechanical Engineering course. Students were tasked with building and programming a robot that could follow any curved or straight line on the ground and could stop at a pre-specified distance in front of a wall. I worked in a group with two other Carnegie Mellon engineering students, Elijah Sech and Grant Johnson

All students were given design specifications and car dimensions, however we could construct the robot as we saw fit. We were given a template for parts but ended up redesigning them so they would fit better together. We also had to determine the position and orientation of all of the sensors and wiring on our robot. The final design consisted of a robot with two back wheels, a roller on the bottom of the car in the front, 3 colors sensors positioned under the car pointed at the ground, and one ultrasonic sensor on the car’s front bumper.

Our algorithm was programmed using Arduino. We initially approached the algorithm by using the sensors to determine the curvature of the path at a given moment and continually adjusting the speed of each of the back wheels motors to follow it, but due to the sensors being cheap and somewhat unreliable, we opted for a simpler approach by imposing conditions for each of the three light sensors that would determine when each motor turned on, off, and how powerful it was. Instead of calculating and mimicking the curvature of the line, the robot would continually adjust and run each of its motors to stay on its line based on the feedback from the sensors. This method worked much better. For the stopping, we imposed a condition that if the ultrasonic sensors reading was below a certain threshold, both of the back wheel motors would turn off. We adjusted this condition by upping the distance thresh so that it was slightly larger than the prespecified stopping distance. This gave the car time to brake and allowed it to stop right where we wanted it to.

Our robot was raced against our classmates at the end of the project. Our robot placed in the top 20% of groups for course completion speed, and in the top 5% of groups for stopping accuracy.