Toggle Nav

Interfacing TCRT5000 Infrared Line Tracking Sensor with Arduino

Table of Contents

TCRT5000 Sensor Features

The TCRT5000 Sensor is used to detect color and distance. The sensor emits an infrared wave and then receives it. TCRT5000 Infrared Reflective Sensor Module is often used in line following robots and object sorting Robots since this module can sense if a surface is white or black.
The measuring distances range from 1mm to 8mm and the central point is about 2.5mm. There is also an onboard potentiometer to adjust the sensitivity.

TCRT5000 Sensor Pinout

This sensor has 4 pins:

  •  VCC: Module power supply – 5 V
  •  GND: Ground
  •  DOUT: Digital output data to the microcontroller
  •  AOUT: Analog output data to the microcontroller

You can see pinout of this module in the image below.

You can download the datasheet of this module here.


Required Materials

Hardware Components

Arduino UNO R3 × 1
TCRT5000 Infrared Reflective Line Track Sensor × 1
Male Female Jumper Wire × 1

Software Apps

Arduino IDE

Interfacing TCRT5000 Sensor with Arduino

Step 1: Circuit

The following circuit shows how you should connect Arduino to TCRT5000 module. Connect wires accordingly.

Step 2: Code

Upload the following code to your Arduino
modified on Sep 8, 2020
Modified by MohammedDamirchi from Arduino Examples 
// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  // print out the value you read:
After running the code, you will see the following image in the serial output.

Liked What you see?

Get updates and learn from the best

More To Explore

Leave a Reply

Your email address will not be published. Required fields are marked *