Line Following Robot Using IR Sensor

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 21

Line Following Robot

using IR Sensor
Line Following Robot using IR Sensor
• In a line follower robot, the robot autonomously follows
a black line in white floor. Detection of line in this robot
is done using two IR sensors.

2
Logic Control

3
Forward
• When both sensors detect
white area, then the robot
should move forward.
• For this both sensors will
be giving 0 output.

4
Left
• When the left sensors
detect black line and right
sensor detects white area,
then the robot should
move left.
• For this
✗ Left sensor – 1
✗ Right sensor - 0

5
Right
• When the right sensors
detect black line and left
sensor detects white area,
then the robot should
move right.
• For this
✗ Left sensor – 0
✗ Right sensor - 1

6
Brake
• When both sensors detect
black area, then the robot
should stop.
• For this both sensors will
be giving 1 output.

7
Programming

8
Select Board
• Select evive as Board

9
Variables
• Create three variables:
✗ Left Sensor – To store the sensor reading from
the left IR sensor.
✗ Right Sensor
✗ Speed – You will be able to control the overall
speed of the robot, if the robot is going too fast,
then it will not follow the line, if it is going too
slow, then it will be too late and boring. So we
have to calibrate this speed after the
programming. This will be done using
potentiometer 1.

10
Assigning values to the variables
• Make a block named Indicate Color.
• Set the values of the variable accordingly.
• The speed will vary from 0 to 255. Hence we are
dividing the potentiometer reading by 4.

11
Easy Debugging for IR Sensors
• For debugging of IR sensor we will make two
rectangles on the TFT and change its colour like this:
✗ Green – Detects black line
✗ Red – Detects white line

12
Easy Debugging for IR Sensors
• Final Script for
Debugging.

13
Go Straight
• Create a block named Go Straight.
• Go to the Actuators extension and drag and drop
the run motor () in direction () with speed () block
below the Go Straight definition hat block; set the
motor as 1, the direction as forward, and speed
as 100 %.
• Repeat Step 2; this time set the motor as 2.

14
Turn Left
• Create a block named Turn Left.
• Go to the Actuators extension and drag and drop
the run motor () in direction () with speed () block
below the Turn Left definition hat block; set the
motor as 1, the direction as reverse, and speed as 100
%.
• Repeat Step 2; this time set the motor as 2 &
direction as forward.

15
Turn Right
• Create a block named Turn Right.
• Go to the Actuators extension and drag and drop
the run motor () in direction () with speed () block
below the Turn Right definition hat block; set the
motor as 1, the direction as forward, and speed
as 100 %.
• Repeat Step 2; this time set the motor as 2 &
direction as reverse.

16
Brake
• Create a block named Brake.
• Go to the Actuators extension and drag and the drop
the () motor () block below the Brake definition hat
block and set the motor as 1 and condition lock.
• Repeat Step 2; this time set the motor as 2.

17
Assigning Motion
• Make the final
script according to
the logic.

18
Testing

19
Calibrating IR Sensor
• The IR sensor calibration in this case is
differentiating the black line in the white region.
• To calibrate turn the potentiometer.
• Make sure you calibrate your IR sensor before
running the robot.

20
21

You might also like