Description
TCRT5000 Infrared Line-Follower Sensor Module
This TCRT5000 infrared sensor module is designed to detect lines and nearby surfaces. It uses reflected infrared light and provides a digital HIGH/LOW output for use with line-following robots and other detection projects.
Specifications
- Operating voltage: 3.3–5 V
- Operating current: 10–20 mA (as stated in the source listing)
- Detection distance: 1–25 mm
- Output: digital HIGH/LOW signal
- Operating temperature: −25 °C to +85 °C
- Dimensions: 32 × 14 × 10 mm
How it works
The infrared emitter sends light toward the surface, and the phototransistor detects the reflected light. According to the source description, a black line produces a LOW output, while a white or light-colored surface produces a HIGH output. Actual readings can depend on surface, distance and sensor adjustment.
Pinout
- GND: ground
- VCC: 3.3 V or 5 V supply
- OUT: connect to a digital input on the Arduino
Applications
- Line-following and maze-solving robots
- Presence detection and security projects
- Obstacle and surface detection
- Position and object detection in automation projects
Basic Arduino Uno example
Parts
- 1 × TCRT5000 sensor module
- 1 × Arduino Uno
- Jumper wires and a breadboard
Basic example code
int sensorPin = 2; // Broche connectée à la sortie du capteur
int ledPin = 13; // Broche connectée à la LED intégrée
void setup() {
pinMode(sensorPin, INPUT);
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
int sensorValue = digitalRead(sensorPin);
if (sensorValue == LOW) {
digitalWrite(ledPin, HIGH);
Serial.println("Ligne détectée");
} else {
digitalWrite(ledPin, LOW);
Serial.println("Pas de ligne");
}
delay(1000);
}
Advanced example: LCD status display
The second example reads the sensor output and displays whether a line is detected on an I2C LCD. It also controls an LED and reports the result over the serial monitor.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
int sensorPin = 2; // Broche connectée à la sortie du capteur
int ledPin = 13; // Broche connectée à une LED externe
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
lcd.begin();
lcd.backlight();
pinMode(sensorPin, INPUT);
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
int sensorValue = digitalRead(sensorPin);
lcd.setCursor(0, 0);
if (sensorValue == LOW) {
lcd.print("Ligne detectee");
digitalWrite(ledPin, HIGH);
Serial.println("Ligne détectée");
} else {
lcd.print("Pas de ligne ");
digitalWrite(ledPin, LOW);
Serial.println("Pas de ligne");
}
delay(1000);
}
Advanced example wiring
- GND: Arduino GND
- VCC: Arduino 5 V
- OUT: Arduino digital pin 2
- LCD SDA: Arduino A4
- LCD SCL: Arduino A5
- LED long leg: Arduino pin 13 through a 220 Ω resistor
- LED short leg: Arduino GND
Library installation
- Open the Arduino IDE and select Sketch → Include Library → Manage Libraries.
- Search for
LiquidCrystal_I2Cand install the library by Frank de Brabander.
Keywords: TCRT5000, line follower, infrared sensor, IR sensor, line tracking, reflective sensor, proximity detection.









