Home Arduino Projects Here is How To Build A Line Follower Arduino Robot

Here is How To Build A Line Follower Arduino Robot

by Nikodem Bartnik
Here is How To Build A Line Follower Arduino Robot

We’ve built an obstacle avoiding robot and a Bluetooth controlled robot in the past.

What we didn’t do yet is one of the most popular robots every beginner do when starting with robotics.

A line follower!

A line follower is a satisfying robot especially when it follows the line the way you want it to.

I would first want to point out that we will go with the simplest code possible without making the use of a PID controller which most of the advanced robots of such use.

If you want some more advanced algorithm, you need to read about PID controllers. Every robot on competitions has one or more PID controllers and 10 or more line sensors so that it can track the line really fast and precisely.

Parts needed

Here is How To Build A Line Follower Arduino Robot

We will also need a 3d printed part to attach our line tracking sensors to the chassis at a proper height above the ground, you can download it here: https://www.thingiverse.com/thing:2594606

This robot is quite similar to our last Bluetooth controlled robot. We have to connect 4 cables to 5V but there is only one 5V pin on Arduino. That’s why we needed to use a breadboard (or just a piece of it). I had a medium size breadboard with detachable power lines. So, I used one of them to connect all 5V and GND pins without soldering.

Here is How To Build A Line Follower Arduino Robot

The 3d printed holder should be fixed at the front of the robot and you should try fixing the sensors on it as seen in the image below.

Here is How To Build A Line Follower Arduino Robot

The LEDs on the sensor indicate whether it detects a line or not, you might need to calibrate it before it works perfectly on your set-up. There is a potentiometer on the sensor which you can use to adjust its accuracy.

You should also keep in mind that the line detection accuracy depends on the light conditions as well.

Here is How To Build A Line Follower Arduino Robot
Here is How To Build A Line Follower Arduino Robot
Here is How To Build A Line Follower Arduino Robot
Here is How To Build A Line Follower Arduino Robot

The logic here is the following:

  • When the left and right sensors detect no line and at the same time the middle sensor detects a line, the robot should move forward.
  • When the right sensor detects the line, the robot should turn right
  • When the left sensor detects the line, the robot should turn left

That’s all it does. Incomplete right! But not a bad algorithm to start with. There is plenty room for improvement here.

The motor functions are exactly the same as there were in our Bluetooth controlled robot example at the only difference that the PWM values here are low. This robot needs to move slowly in order to stay on track. Feel free to experiment with faster speeds to check its limitation.

Here is the robot working on a dark floor, not too bad. Quite inefficient, but the good news is, it stays on track.

And that’s it for today. One task at hand right now for you is to go and find ways to improve the performance of this robot.

You might also like:

Related Posts

Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Privacy & Cookies Policy