When we talk about the basic Arduino projects or basic robotics project then the line follower bot is the first thing that comes up to our mind. Arduino line follower bot is a small robot which detects and follows a black line on a contrasting background using its IR sensors. It is one of the fun Arduino projects which are very easy to build. Even if you are a novice, you can easily build a line follower robot in 4 easy steps and it will take only 15 minutes to get a bot finished.
The line follower robot kit includes.
* Arduino Clone
* Two servo motors.
* One ball caster
* 6 IR LEDs and IR detectors
* 1k and 10k resistors
* Two small wheels
* A small acrylic board
* batteries and holders.
The above was the hardware requirements for a line following robot. The software required is “Arduino IDE”.
How does a Line Follower Bot work?
The working of the bot is pretty simple. An Arduino line follower bot has the ability to sense dark line on a light surface. They follow the line by estimating whether the line under them is shifting to the left or right. On the basis of which they direct the motors to turn left or right and by doing this they maintain a steady center with respect to the line.
A line follower robot uses an IR sensor to detect the dark line on a contrasting surface. Since black absorbs light, it reflects less of it back when compared to the lighter surface. Low reflectance is the criteria used by the bot to detect the line and respond accordingly. The higher reflectance will be the surface around the line. There is a linear array of IR sensors. If the left/right sensor detects the low value to reflectance in comparison to the other one, then the black line must be on the left/right direction of the line following robot. Then the microcontroller compensates for this by signaling servo motor to move in the opposite direction.
There is a linear array of IR sensors. If the left/right sensor detects the low value to reflectance in comparison to the other one, then the black line must be on the left/right direction of the line following robot. Then the microcontroller compensates for this by signaling servo motor to move in the opposite direction.
So the basic thing which is happening in the line follower bot is that the IR LED emits light on the surface. A part of this light is absorbed and some of it is reflected. The photodiode which will be installed to detect the reflected light will sense the light and generate the corresponding amount of voltage and by the detection of the voltage produced, the line following robot describes its path.
That’s all about the working of the robot, Now let’s see how to build one.
STEP 1: Making a sensor array. (optional)
This step is optional because you can also buy a ready-made sensor array, the Pololu reflectance sensor. Using the Pololu QTR-8A in place of your custom sensor array will be a lot easier at this software part of your line follower bot. But I prefer a custom sensor array if you really want to learn about building robots.
To make the sensor array, take six IR LEDS and connect all of them in parallel to each other and also place an equal no. of photodiodes just below them. Wrap them in pairs using an insulation tape (black colored) and keep the tips exposed. Take all the six pairs of photodiodes and IR LEDs. Arrange them in a straight line. But make sure there is an approximate distance of 1.5cm between each pair.
STEP 2: Assemble the components of Line Follower Bot.
After arranging everything for your line following robot and preparing the sensor array, It’s time to assemble all of the components together. Take the acrylic board or chassis and fix the servo motors on the left and right edges. For fixing the servo motors you can use super glue or hot glue. Now attach a ball caster on the opposite edge. On the top of the two servo motors fix the array of sensors made in the previous step using a small piece of plastic. For the optimal performance of the array of sensors, you need to fix it 4 to 5 mm above the ground. Stick the Arduino board and the battery holder using a double sided tape on the top side of the structure made.
STEP 3: Connecting the components.
Now you need to connect all of the components of the line follower bot together. First of all set up the hardware connections with Arduino and servo motors. These servo motors are a special type of motors because the continuous rotation servo motors can’t be controlled or set at a particular angle. They have 3 types of wire coming out of them: Red, black and white/yellow. The left servo motor is hooked up to the digital pin 9 and the right one to Arduino digital pin 10 ( this is for white/yellow wire).
Now connect the red wires to the terminal of the battery holder and black wires of both the motors are to be connected to Arduino GND. This will connect all the basic components of your line follower bot.
Here we will only talk about the connection for the custom fabricated sensor array and not about the readymade Polulu reflectance sensor array.
So in the custom fabricated sensor array, short (connect without resistance between them) all the anode terminals of your IR LEDs and connect them to Arduino Vcc via a 220 Ohm resistor. Now short the cathode terminals together and connect to the Arduino GND. You also need to connect a 10K resistor to each of the IR photodiodes.
Short all the free ends of 10k resistors and connect them to Arduino GND. Also short the anode terminals of IR photodiodes together and connect to Arduino Vcc. AT last, you have to connect a wire to the cathode of each IR photodiodes. After this, connect all the wires in sequence to the Arduino’s analog input pins A0, A1, A2, A3, A4, and A5.
STEP4: Uploading the code.
You can get the code for your line follower bot from THIS LINK.
Find out the rough values of reflectance over the black line and the outer surface. Use these values to substitute in the code and calibrate it. For calibration, after uploading the code sweep the array of sensors over the black line from left to right for roughly 3 seconds. Calibration is done to find the maximum and minimum value for reflectance. Now you can place your line following robot on the line and watch it following the path.
If you can make interesting things out of a line follower bot then mail us your idea. We will feature your idea in our next article with your name on it. Follow us for more interesting projects.