Skip to main content

Introduction to robotics .............. Part-2

Line Follower Robot


Our Line Follower Robot
Line followers are one of the most prominent kinds of robots. They have existed for a very long time, however, the technologies used for building them have changed rapidly. Earlier, controller boards the size of bricks were used, but now they have shrunk and become tremendously powerful. Now, technology allows you to build a line follower in just under 10 minutes if you have the parts for it. So enjoy building this quick and easy line follower. Have fun with this DIY hacking tutorial!

Required Materials

Hardware :
1.      Arduino / Arduino Clone or make your own custom Arduino board.
2.      Two continuous rotation servo motors like this: Continuous rotation servo.
3.      A ball caster: Ball caster.
4.      An infrared sensor array like this: Pololu QTR-8A IR sensor array OR a set of six IR Leds and Detectors.
5.      Resistors: 1K and 10K.
6.      Two robot wheels, select wheels after checking if they fit in the servo.
7.      Chassis, usually a small acrylic board will do.
8.      Four AA Duracell batteries and battery holder.

Software :
1.      Arduino IDE.

 

How Does it Work?

The workings of a line follower robot are pretty straight forward. These robots have the capability to detect a black/dark line on a lighter surface depending on the contrast. They estimate whether the line underneath them is shifting towards their left/right as they move over them. Based on that estimation, they give respective signals to the motors to turn left/right so as to maintain a steady center with respect to the line.
These robots usually use an array of IR (Infrared) sensors in order to calculate the reflectance of the surface beneath them. The basic criteria being that the black line will have a lesser reflectance value (black absorbs light) than the lighter surface around it. This low value of reflectance is the parameter used to detect the position of the line by the robot. The higher value of reflectance will be the surface around the line. So in this linear array of IR sensors, if the leftmost/rightmost IR sensor presents the low value for reflectance, then the black line is towards the left/right of the robot correspondingly. The controller then compensates for this by signaling the motor to go in the opposite direction of the line.


Line Follower Block Diagram
 The IR sensor array consists of individual IR LEDs and IR photodiodes. The IR light emitted by the LED strikes the surface and is reflected back to the IR photodiode. The photodiode then gives an output voltage proportional to the reflectance of the surface (high value for light surface and low for black/dark surface).

IR Sensor Working


Making the Sensor Array for the Line Follower (Optional)

(Only if you don’t want to buy the Pololu reflectance sensor)
To make an IR sensor array, take the six IR LEDs and connect them in parallel with each other. Now, take the IR photodiodes and place each of them just below the six IR LEDs. Wrap each pair together using black insulation tape and leaving their tips exposed. Take these six pairs of IR LEDs and photodiodes and join them in a straight line, each pair should be 1.5cm apart from the next.

IR Photodiode and IR LED


Taping them together


Assembling the Components for the Line Follower

Take the piece of acrylic board and stick the servo motors to the left and right edges using hot glue or super glue. Then attach the ball caster on the opposite edge. Take the pololu IR sensor array or your own sensor array and stick it on top of the two servo motors using a small piece of plastic or foam. The sensor must be positioned in such a way that it’s about 4-5mm from the ground for optimal performance. On the top side, stick the Arduino board using double sided tape, do the same for the battery holder. This is how it looks:
Bottom View
 Full View

 

Connecting the Components Together for the Line Follower

Setup the hardware connections with the Arduino and the servo motors. The continuous rotation servo motors are those types of servo motors that cannot be controlled or set at a particular angle, unlike normal servos. Servos have three wires coming from them: Red- Power, Black -Ground, White/Yellow- PWM /PPM Signal. The left servo motor (white/yellow wire) is hooked up to Arduino digital pin 9 and the right servo motor (white/yellow wire) to Arduino digital pin 10. The black wires of both the motors are connected to Arduino GND and the Red wires to the positive terminal of the battery holder.
Arduino Connections for Line Follower

Using Pololu QTR-8A Reflectance array sensor

If you are using the Pololu sensor, and you don’t need all the 8 IR detectors. You can remove 2 of them by cutting at the indicated perforation line on the board. The code we are using is only for 6 of them. Then solder some header pins to the board for Vcc, Gnd, and signals 1,2,3,4,5,6. Connect the Vcc and Gnd of this sensor to the Arduino’s Vcc and Gnd. The signals 1,2,..6 are connected to the Arduino’s analog input pins A0, A1, A2, …A5.

Using the Custom Fabricated Sensor Array

If you are using the custom fabricated sensor array, then short the anode terminals of all the IR LEDs together and connect it to the Arduino Vcc through a 220Ohm resistor. Next, short the cathode terminals together and connect it to Arduino Gnd. Now, connect a 10K resistor to the cathode of each of the IR photo-diodes. Short the free ends of all the 10K resistors together and connect it to Arduino Gnd. Now, short the anode terminals of the IR photo-diodes together and connect it to Arduino Vcc. Lastly, connect a wire to the cathode of each of the IR photodiodes (between the cathode and the 10K resistor). Connect each of the wires in sequence to tArduino’s analog input pins A0, A1,..A5.

Connections for your custom IR sensor array

 Uploading the Code for your Line Follower

The code for the line follower can be found here: DIY_LineFollower. After uploading the code, you need to sweep/move the sensor array over the black line from left to right for roughly 3 seconds. This is done in order to calibrate and find the max and min values for reflectance. After that, place the robot on the line and watch the bot follow it. If you’re using the Pololu QTR-8A reflectance array sensor then no significant changes may be required, try to check the values coming from the sensor through the serial monitor. Based on those values, adjust the values in the code correspondingly.

For those who made the custom board, find out the rough values of reflectance over the black line and the outer surface. Substitute these values in the code and calibrate it. You can use normal black insulation tape as the line for your line follower. You can see the line follower in action below.



If you like our blog, then please don't forget to like us on facebook :

 our facebook page


Comments

Popular posts from this blog

Practical Projects for Engineering Students-8

Soldier Health & Position Tracking System The soldier Health and Position Tracking System allows military to track the current GPS position of soldier and also checks the health status including body temperature and heartbeats of soldier. The System also consists extra feature with the help of that soldier can ask for help manually or send a distress signal to military if he is in need. The GPS modem sends the latitude and longitude position with link pattern with the help of that military can track the current position of the soldier. The system is very helpful for getting health status information of soldier and providing them instant help. The nation’s security is monitored and kept by army, navy and air-force. The important and vital role is of soldiers who sacrifice their life for their country. There are many concerns regarding the safety of the soldier. Soldiers entering the enemy lines often lose their lives due to lack of connectivity, it is very vital fo

Introduction to robotics .............. Part-3 (Automation)

Automated Portable Hammering Machine Hammering is the most widely used industrial as well as construction activity. Hammering or screws, metal sheets, parts etc requires a lot of time and effort. So here we propose an automated hammering system that allows for fully automatic hammering process. This allows for accurate, fast and automated hammering wherever and whenever needed using a 12V battery. The person just needs to insert workpeice and start the hammering machine. This machine can be used for automatic hammering work as and when needed. We here use a dc motor in order to move the hammer. The DC motor consists of a pulley attached to it which is connected to a larger pulley for efficient power transfer and to increase torque. This large pulley is connected to a shaft that has a connecting rod attached to it. This rod is used to achieve lateral motion from the spinning shaft. We now connect the other end of hammer to this connecting rod through a mid swinging arrangement i