Back to Sensors & Actuators Series

TCRT5000 Reflective IR Optical Sensor

April 10, 2026 Wasil Zafar 7 min read

TCRT5000 deep dive — IR reflective principle, analog/digital interface, surface reflectance, line-detection circuits, complete code, and robotics applications.

Contents

  1. Working Principle
  2. Electrical Characteristics
  3. Interfacing with MCU
  4. Calibration
  5. Code Example
  6. Real-World Applications
  7. Limitations

Working Principle

The Vishay TCRT5000 is a reflective optical sensor containing an IR LED emitter and a phototransistor detector in one package. The LED emits 950 nm infrared light. When a reflective surface is within range (1–25 mm), light bounces back to the phototransistor, causing it to conduct current proportional to the reflected intensity.

Analogy: Imagine holding a flashlight and a light-meter side by side, pointing at a wall. The closer and whiter the wall, the more light bounces back to your meter. Dark surfaces absorb the light, giving low readings.

Electrical Characteristics

ParameterValue
Emitter Wavelength950 nm (infrared)
Optimal Detection Distance2.5 mm (peak sensitivity)
Working Range1 – 25 mm
Emitter Forward Current60 mA max (20 mA typical)
Collector Current (detector)Up to 100 mA
OutputAnalog (phototransistor collector) or digital via comparator module
PackageThrough-hole, 4-pin

Interfacing with an MCU

The bare TCRT5000 has 4 pins: emitter anode, emitter cathode, collector, and emitter (phototransistor). Most hobbyists use breakout modules with built-in comparator (LM393) providing both analog (A0) and digital (D0, adjustable threshold via pot) outputs.

Module Wiring (Arduino): VCC → 5 V, GND → GND, A0 → Analog Pin A0, D0 → Digital Pin 2. Adjust potentiometer to set digital trigger threshold.

Calibration

Calibration depends on target surface and distance:

  • Distance tuning: Mount the sensor 2–5 mm above the surface for line-following; adjust if the analog reading saturates or is too low.
  • Threshold adjustment: On modules with an LM393, turn the potentiometer until the digital output toggles at the desired reflectance boundary (e.g., black vs white tape).
  • Multi-sensor normalisation: Read each sensor on a known white and black surface; map raw ADC values to a 0–1000 normalised range.

Code Example

/*
 * TCRT5000 Line Follower — Arduino
 * Uses breakout module with A0 (analog) and D0 (digital)
 * Wiring: VCC→5V, GND→GND, A0→A0, D0→Pin2
 */
#define ANALOG_PIN  A0
#define DIGITAL_PIN 2

void setup() {
    Serial.begin(9600);
    pinMode(DIGITAL_PIN, INPUT);
    Serial.println("TCRT5000 Ready");
}

void loop() {
    int analogVal = analogRead(ANALOG_PIN);  /* 0-1023 */
    int detected  = digitalRead(DIGITAL_PIN);

    Serial.print("Analog: "); Serial.print(analogVal);
    Serial.print(" | Object detected: ");
    Serial.println(detected == LOW ? "YES (reflective)" : "NO (dark/absent)");

    delay(200);
}

Real-World Applications

Robotics

Line-Following Robot

Line-following robots use arrays of 3–8 TCRT5000 sensors mounted 3 mm above the ground to detect black tape on white surfaces. A PID controller adjusts motor speeds based on which sensors see the line, enabling smooth path tracking at speeds up to 1 m/s in competitive robotics events.

Line FollowerPID ControlRobotics

Limitations

  • Short range: Effective only to ~25 mm — unsuitable for object detection beyond close proximity.
  • Ambient IR: Direct sunlight contains strong IR that can swamp the phototransistor, causing false readings outdoors.
  • Surface dependent: Works best on matte surfaces; glossy or transparent materials cause specular reflections or pass-through.
  • Analogue noise: The bare sensor output varies with temperature and LED ageing; periodic recalibration is recommended.