Docsity

ROBOTICS AND AUTOMATION, Lecture notes of Robotics and Autonomous Systems

Toggle sidebar
bg1
Assignment no 05
Title: Design and implementation of line follower robot
Outcome: To impart knowledge of basics of Robot Programming and robotic Applications
Hardware/Software Requirement:
Software: Arduino IDE
Theory:
A line follower robot (LFR) is designed to follow a specific path, typically represented by a black line
on a white surface or a white line on a black surface.
In this detailed guide, we’ll walk you through the entire process of creating an Arduino-based line
follower robot, from understanding its working principles to assembling and programming it. Let’s
dive in and bring your robot to life!
Working of a Line Follower Robot:
The fundamental principle lies in the reflective properties of light: black surfaces absorb most light,
while white surfaces reflect nearly all of it. This characteristic is utilized by various sensors like LDRs
(Light Dependent Resistors), IR sensors, or specialized line sensors to detect lines. For higher precision
and accuracy, we are using line sensors in this project.
A line sensor typically comprises an IR emitter (LED) and an IR receiver (photodiode). The IR emitter
continuously emits infrared light, and the receiver detects the reflected light.
Prepared by: Asst Prof. Vaibhav L. Nangare SVCET.Rajuri
Department of Computer Engineering.
Name Quantity Component
U1 1 Arduino Uno R3
1 Smart Robot Car Chassis Kit
UMotor Driver 1 L293d motor driver shield
DISTultrasonic sensor 1 Geared motors
BAT1 1 15V Battery
3 1 Breadboard Mini
2Line Sensor Module
pf3
pf4
pf5
pf8

Partial preview of the text

Download ROBOTICS AND AUTOMATION and more Lecture notes Robotics and Autonomous Systems in PDF only on Docsity!

Assignment no 05

Title : Design and implementation of line follower robot

Outcome: To impart knowledge of basics of Robot Programming and robotic Applications

Hardware/Software Requirement:

Software: Arduino IDE

Theory:

A line follower robot (LFR) is designed to follow a specific path, typically represented by a black line on a white surface or a white line on a black surface. In this detailed guide, we’ll walk you through the entire process of creating an Arduino-based line follower robot, from understanding its working principles to assembling and programming it. Let’s dive in and bring your robot to life!

Working of a Line Follower Robot:

The fundamental principle lies in the reflective properties of light: black surfaces absorb most light, while white surfaces reflect nearly all of it. This characteristic is utilized by various sensors like LDRs (Light Dependent Resistors), IR sensors, or specialized line sensors to detect lines. For higher precision and accuracy, we are using line sensors in this project. A line sensor typically comprises an IR emitter (LED) and an IR receiver (photodiode). The IR emitter continuously emits infrared light, and the receiver detects the reflected light. Prepared by: Asst Prof. Vaibhav L. Nangare SVCET.Rajuri Name Quantity Component U1 1 Arduino Uno R 1 Smart Robot Car Chassis Kit UMotor Driver 1 L293d motor driver shield DISTultrasonic sensor 1 Geared motors BAT1 1 15V Battery 3 1 Breadboard Mini 2 Line Sensor Module

Circuit Diagram of Line Follower Robot

The circuit of the line follower robot integrates four key components: two Line sensors, an L293D motor driver shield, four 12V BO motors, and an Arduino board. A 12V power supply is required, though not depicted in the schematic, and the motor driver shield is mounted directly onto the Arduino board. The IR sensors are powered by connecting their VCC and Ground pins to the corresponding VCC and Ground pins on the Arduino. Their analog output pins are used to send signals to the Arduino; the left Line sensor's output connects to the analog input pin A0, and the right IR sensor's output connects to A1. For motor control, the motors on the left side of the robot are wired in parallel to the M port of the motor driver shield, while the right-side motors are connected in parallel to the M4 port. This arrangement ensures coordinated motor control for smooth line following.

Assembling the Arduino-based Line Follower Robot:

With the circuit connections clear, we can move on to assembling the line follower robot. Below is a step-by-step guide to building your robot: Step 1: Preparing the Chassis Begin with a ready-made chassis and solder at least 15 cm long wires to all four motors. This ensures sufficient length for connections during assembly. Step 2: Mounting Motors, Sensors, and Wheels Peel off the protective cover from the chassis and securely attach all four motors, two line sensors, and the wheels. Wire the motors by connecting the red wires of the left-hand side motors (front and rear) and black wires of the right-hand side motors (front and rear). Repeat this for the other side. Maintain a center-to-center distance of 11 to 11.5 cm between the two line sensors for optimal line detection and smooth navigation. Ensure the distance between the sensor’s LED (closest to the ground) and the surface is 2 cm for accurate performance. Step 3: Installing the Arduino and Motor Driver Shield Attach the motor driver shield to the Arduino Uno board and mount them on the chassis using double- sided tape or screws. Position the assembly at the front for easy access to all components. Connect the motors and line sensors to the shield as per the circuit diagram. The left-side motors connect to the M port, and the right-side motors connect to the M4 port. Step 4: Programming the Arduino Prepared by: Asst Prof. Vaibhav L. Nangare SVCET.Rajuri

// Set the last direction to Stop char lastDirection = 'S'; void setup() { #if DEBUG_PRINT Serial.begin(9600); #endif // Set the current speed of Left Motor to 0 motorL.setSpeed(0); // turn on motor motorL.run(RELEASE); // Set the current speed of Right Motor to 0 motorR.setSpeed(0); // turn off motor motorR.run(RELEASE); // To provide starting push to Robot these values are set motorR.run(FORWARD); motorL.run(FORWARD); motorL.setSpeed(255); motorR.setSpeed(255); delay(40); // delay of 40 ms } void loop() { left_value = analogRead(LEFT_IR); right_value = analogRead(RIGHT_IR); #if DEBUG_PRINT // This is for debugging. To check the analog inputs the DETECT_LIMIT MACRO value 300 is set by analysing the debug prints Serial.print(left_value); Serial.print(","); Serial.print(right_value); Serial.print(","); Serial.print(lastDirection); Serial.write(10); #endif // Right Sensor detects black line and left does not detect if (right_value >= DETECT_LIMIT && !(left_value >= DETECT_LIMIT)) { turnRight(); } // Left Sensor detects black line and right does not detect Prepared by: Asst Prof. Vaibhav L. Nangare SVCET.Rajuri

else if ((left_value >= DETECT_LIMIT) && !(right_value >= DETECT_LIMIT)) { turnLeft(); } // both sensors doesn't detect black line else if (!(left_value >= DETECT_LIMIT) && !(right_value >= DETECT_LIMIT)) { moveForward(); } // both sensors detect black line else if ((left_value >= DETECT_LIMIT) && (right_value >= DETECT_LIMIT)) { stop(); } } void moveForward() { if (lastDirection != 'F') { // To provide starting push to Robot when last direction was not forward motorR.run(FORWARD); motorL.run(FORWARD); motorL.setSpeed(255); motorR.setSpeed(255); lastDirection = 'F'; delay(20); } else { // If the last direction was forward motorR.run(FORWARD); motorL.run(FORWARD); motorL.setSpeed(FORWARD_SPEED); motorR.setSpeed(FORWARD_SPEED); } } void stop() { if (lastDirection != 'S') { // When stop is detected move further one time to check if its actual stop or not, needed when the robot turns motorR.run(FORWARD); motorL.run(FORWARD); motorL.setSpeed(255); motorR.setSpeed(255); lastDirection = 'S'; delay(40); Prepared by: Asst Prof. Vaibhav L. Nangare SVCET.Rajuri

// take slight Left turn motorR.run(FORWARD); motorL.run(BACKWARD); motorL.setSpeed(TURN_SLIGHT_SPEED); motorR.setSpeed(TURN_SLIGHT_SPEED); } else { // take sharp Left turn motorR.run(FORWARD); motorL.run(BACKWARD); motorL.setSpeed(TURN_SHARP_SPEED); motorR.setSpeed(TURN_SHARP_SPEED); } delay(DELAY_AFTER_TURN); }

Connection/Circuit Diagram:

Conclusion:

The line follower robot successfully uses optical sensors to track pathways automatically without human intervention. This project demonstrates the practical integration of real-time sensor feedback, microcontrollers, and motor control dynamics. Prepared by: Asst Prof. Vaibhav L. Nangare SVCET.Rajuri

Prepared by: Asst Prof. Vaibhav L. Nangare SVCET.Rajuri