Electronics

Line Follower 1 Channel Infrared Tracking Detection Sensor On Back TCRT5000

Out Of Stock

1

Description

This IR reflective sensor utilizes a TCRT5000 to detect color and distance. It emits IR and then detects if it receives the echo. This sensor is often used in line following robots, auto data logging on utility meters because this module can sense if a surface is white or black.

The measuring distance range from 1mm to 8mm and the central point is about 2.5mm. There is also an on-board potentiometer to adjust the sensitivity. The infrared diode will be emitting the infrared continuously when the module connects to the power when the emitted infrared light has not been reflected or the strength is not big enough, the module will in the off state, at this time, D0 output logic HIGH and the signal indicates LED off.

Specifications:

  • Supply Voltage: 3.3V~5V
  • Detect distance: 1mm-8mm
  • Digital Outputs LOW when objects detected
  • On-board indicator LED to show the results
  • Onboard potentiometer to adjust the sensitivity


this tutorial you will use the Line Follower 1 Channel Infrared Tracking Detection Sensor On Back TCRT5000, and learn how to make an Arduino line follower robot!

It’s a very cool project and it’s one of the first important projects that a maker has to make!!!

What is a Line Follower Robot?

A line follower is a robot that thanks to its sensors can follow a line. Usually, it’s a black line, and it uses IR sensors.

What’s the concept behind a Line Follower Robot?

The concept of working of line follower is related to light. In fact, we use the IR sensor. You have to know that a white surface reflects the light and the black surface absorbs it. This behavior of light is used in building a line follower robot.

Light absorbed
light reflected

How does it work?

In this project, we are using two IR sensor modules (left and right). When both left and right sensor senses white, the robot moves forward.

If the left sensor comes on a black line, the robot turns to the left side.

If the right sensor comes on the black line, the robot turns right side.

When white surface comes robot starts moving on forward again.

If both sensors come on the black line, the robot stops.

 

Code for Line Follower 1 Channel Infrared Tracking Detection Sensor On Back TCRT5000 :

int vSpeed = 110; // MAX 255
 int turn_speed = 230; // MAX 255
 int turn_delay = 10;
//L293 Connection
 const int motorA1 = 8;
 const int motorA2 = 10;
 const int motorAspeed = 9;
 const int motorB1 = 12;
 const int motorB2 = 13;
 const int motorBspeed = 11;
//Sensor Connection
 const int left_sensor_pin =A0;
 const int right_sensor_pin =A1;
 int left_sensor_state;
 int right_sensor_state;
void setup() {
 pinMode(motorA1, OUTPUT);
 pinMode(motorA2, OUTPUT);
 pinMode(motorB1, OUTPUT);
 pinMode(motorB2, OUTPUT);
 Serial.begin(9600);
 delay(3000);
}
void loop()
{
left_sensor_state = analogRead(left_sensor_pin);
right_sensor_state = analogRead(right_sensor_pin);
if(right_sensor_state > 500 && left_sensor_state < 500)
{
 Serial.println("turning right");
 digitalWrite (motorA1,LOW);
 digitalWrite(motorA2,HIGH);
 digitalWrite (motorB1,LOW);
 digitalWrite(motorB2,HIGH);
 analogWrite (motorAspeed, vSpeed);
 analogWrite (motorBspeed, turn_speed);
 }
if(right_sensor_state < 500 && left_sensor_state > 500)
{
 Serial.println("turning left");
 digitalWrite (motorA1,HIGH);
 digitalWrite(motorA2,LOW);
 digitalWrite (motorB1,HIGH);
 digitalWrite(motorB2,LOW);
 analogWrite (motorAspeed, turn_speed);
 analogWrite (motorBspeed, vSpeed);
 delay(turn_delay);
 }
if(right_sensor_state > 500 && left_sensor_state > 500)
{
 Serial.println("going forward");
 digitalWrite (motorA2,LOW);
 digitalWrite(motorA1,HIGH);
 digitalWrite (motorB2,HIGH);
 digitalWrite(motorB1,LOW);
 analogWrite (motorAspeed, vSpeed);
 analogWrite (motorBspeed, vSpeed);
 delay(turn_delay);
 }
if(right_sensor_state < 500 && left_sensor_state < 500)
{
 Serial.println("stop");
 analogWrite (motorAspeed, 0);
 analogWrite (motorBspeed, 0);
 }
}