TCRT5000 Infrared Reflective Sensor Module

The TCRT5000 IR reflective sensor module detects lines or objects by measuring IR light reflection, outputting a high/low signal via an LM393 comparator to a Raspberry Pi GPIO pin. It is ideal for line-following robots or object detection.
R14.89  Inc VAT
Order Quantity Price Per Item
3 R14.59
10 R14.37
30 R14.15
100 R13.78
Qty:
Add to wish list - You'll need to login first.

The 4-pin TCRT5000 module is significantly more versatile than the 3-pin version because it provides both a Digital Output (D0) and an Analog Output (A0).

The Digital pin is perfect for "Yes/No" detection (like staying on a line), while the Analog pin allows you to see the intensity of the reflection, which is useful for measuring varying shades of gray or very small changes in distance.

Features 

  • Compatibility: Perfectly designed for Arduino projects, ensuring seamless integration and operation.
  • Advanced Sensing: Utilizes IR technology with TCRT5000 sensors for accurate detection of reflective materials or barriers.
  • Easy to Use: Simplified setup, suitable for beginners and professionals alike.
  • Versatility: Ideal for a wide range of applications including line tracking robots, object detection, and automatic control systems.
  • Optimized Design: Compact form factor for efficient performance.

 

Specifications

  • Colour: Blue
  • Material: ABS

 

Due to different batches, there may be differences in product printed text, which will not affect use.


What's in the box?

1 x Infrared Reflective Sensor


Resources


The 4-pin TCRT5000 module is significantly more versatile than the 3-pin version because it provides both a Digital Output (D0) and an Analog Output (A0).

The Digital pin is perfect for "Yes/No" detection (like staying on a line), while the Analog pin allows you to see the intensity of the reflection, which is useful for measuring varying shades of gray or very small changes in distance.

 

1. Hardware Connections (4-Pin Module)
 
Module PinRaspberry Pi PinPhysical Pin #Function
VCC3.3V PowerPin 1Power for the IR LED and comparator.
GNDGroundPin 6Common ground.
D0GPIO 17Pin 11Goes LOW when a reflection is detected.
A0See Note BelowProvides a voltage (0V to 3.3V) based on reflection.

Important: The Raspberry Pi does not have a built-in Analog-to-Digital Converter (ADC). You cannot plug the A0 pin directly into a Pi GPIO and read its value. You have two choices:

  1. Ignore A0: Use only D0 for simple line following.
  2. Use an ADC Chip: Connect A0 to an MCP3008 chip if you need precise reflection data.
 
2. Using the Digital Output (D0)
 
This is the most common use. The onboard potentiometer (the blue screw) sets the "threshold."

Python Code (gpiozero):

Python
from gpiozero import DigitalInputDevice
from signal import pause
# TCRT5000 D0 is connected to GPIO 17
# pull_up=True because the sensor output is Active Low
sensor = DigitalInputDevice(17, pull_up=True)

def detected():
print("Reflection Detected! (LED on module should be lit)")

def cleared():
print("Reflection Lost.")

sensor.when_activated = detected
sensor.when_deactivated = cleared

print("Starting TCRT5000 Digital Test...")
pause()
 
3.Using the Analog Output (A0)-The Pro Way
 
If you want to use the A0 pin to detect how "black" or "white" a surface is (rather than just a switch), you need an MCP3008 ADC.

Wiring A0 through an ADC:

  1. Connect A0 from the sensor to CH0 on the MCP3008.

  2. Connect the MCP3008 to the Pi via the SPI pins (GPIO 8, 9, 10, 11).

Python Code (gpiozero with MCP3008):

Python
from gpiozero import MCP3008
import time

# Create a reference to the Analog sensor on Channel 0 of the ADC
reflectivity = MCP3008(channel=0)

while True:
# Value will be between 0.0 (no reflection) and 1.0 (max reflection)
print(f"Reflection Intensity: {reflectivity.value:.2f}")
time.sleep(0.1)
 
4. Summary of Benefits (4-Pin vs 3-Pin)

  

  • Sensitivity Tuning: You can use the D0 pin for a fast interrupt-based response (like emergency stops) while simultaneously using A0 to log data or calibrate your robot's speed based on how well it sees the line.

  • Dual Monitoring: The onboard LED on the 4-pin module typically follows the D0 state. This makes it much easier to "sight in" your sensor by eye before you even write a single line of code.

  • Availability: Out of Stock
  • Model: TCRT5000 IR line sensor
  • Brand: Generic2