Line Follower using IR Sensors

(0 review)
Free
Check out

In this project you will be introduced to IR sensor which helps in sensing motion and heat emitted by surroundings this can be done by emitting and receiving the infrared radiation (light which is in form of heat). We can use this application of IR sensor and build Line Follower robot.

linesensor

KIT: Junkbot Edu kit.

Hardwire required:

  • Arduino Uno
  • Arduino shield
  • USB cable
  • Dc motors
  • Motor driver IC
  • IR sensors
  • Connecting wires

Code brick program:

23

Fritzing image:

24

How to test IR sensor

  • How to connect IR sensors to Arduino.

We can test the IR sensor by facing it towards the white and black surfaces and can learn about the reflection of the light.

  • Connect Vcc of both sensors to 5v pins of Arduino shield.
  • Connect GND pins of IR sensors to GND of shield.
  • Output pins of sensors are connected to 5 and 6 pins of Arduino shield respectively.

So when connections are done then face the sensors towards the white and black surfaces you’ll find the two lights on sensors are ON when there is white surface stating the light is reflected back and try it on black surface you’ll find only one light on and other is OFF stating the light is not reflecting.

  • Line follower configuration:

The configuration of line follower using the IR sensor is stated below.

  • Connect Vcc of both sensors to 5v pins of Arduino shield.
  • Connect GND pins of IR sensors to GND of shield.
  • Output pins of sensors are connected to 5 and 6 pins of Arduino shield respectively.
  • Connect 8,9,10 and 11 pins of Arduino to A-1A, A-1B, B-1A and B-1B and also connect Vcc and GND of Arduino to VIN and GND of motor driver IC.
  • Set pins 8 and 10 of Arduino to HIGH and connect the positive (red wire) of right motor and left motor respectively.
  • Set pins 9 and 11 of Arduino to LOW and connect the negative (black wire) of right motor and left motor respectively.

 

  • How to write to code to make the robot to follow the line using code bricks and upload it to Arduino.
  • Open the code bricks and drag.25
  • From26 drag27 operator since we’re using two IR sensors.
  • Drag and from robots and insert in the  block as illustrated .
  • When both digital pins are equal to 0 this means the robot is on white surface and the light is reflecting back.
  • To make the robot follow the black surface where the light is not reflecting back the case of both sensors should be 1.2829
  • So when31 the light is not reflecting back which means the robot is on black surface it should move forward.
  • We have32 to drag from robots and set as illustrated33.
  • Use34 block from the controls if both sensors are 1 then robot moves forward arrange them as shown35
  • Now to make it turn right when it is moving out of black track towards left then the case would be36
  • And when it is going out track towards right we have to make turn left and follow the black track for that case use37
  • When its totally out of track say its on white surface make it reverse till it finds the black surface line to follow it.38
  • So arrange the total blocks inside the 39block for continous working.
  • The final code should be similar to code shown below.

23

  • So when 40is clicked the robot will follow the line (black surface) and when ever is slightly out of track towards right it will turn left and finds the black line again and vice versa.
  • This entire project is carried out by the sensors which will operate the robot by the reflections of light read by them.
  • Connect the USB cable to arduino and laptop.
  • Go to BOARDS and select arduino uno 17
  • Go to CONNECT and select the USB port and wait until it says 22 serial port connected. 
  • The dot will turn from red to green, representing the connection established.16

 

  • Once port is connected19 upgrade the firmware and wait until it uploads 20.

 

 

 Uploading to Arduino:

  • And to upload this code into Arduino right click on the Arduino program and click on upload to Arduino41.
  • After clicking on upload to Arduino should find one more window opening where we find upload to Arduino click on it you find the uploading progress.42

 

  • Once the upload is finished disconnect the USB and connect power bank to Arduino Uno the robot will start moving as per the code given.

 

To make the project or the robot autonomous we can upload the program into the Arduino. And make the robot follow the line autonomously and make the line follower using the IR sensors.

 

 

 

Course Features

  • Lectures 0
  • Quizzes 0
  • Duration 50 hours
  • Skill level All level
  • Language English
  • Students 6
  • Certificate No
  • Assessments Self
  • Line Follower Using IR Sensors

Reviews

Average Rating

0
0 rating

Detailed Rating

5 stars
0
4 stars
0
3 stars
0
2 stars
0
1 stars
0
Free