Same-day dispatch before 2 PM · Free delivery over ₹999 · GST invoices Get the appPrices incl. GST
Geekobot
Snap & SendNEWGeeko AIWhere's myOrder
Log in
Products
  • Projects
    • Component guidesHow parts work, with code you can run
    • Learning pathsFrom your first LED to your first robot
    • Workshops & eventsOnline sessions for makers and classes
    • ElectrolarkFree guided builds, simulator and certificates
    • Students & teachersStudent discount and classroom help
    • CommunityShare builds and ask other makers
    • CalculatorsOhm's law, LED resistor, 555 and 100+ more
    • Circuit builderWire parts and run the circuit, powered by Electrolark
    • Geeko AIAsk what to buy or how to wire it
    • Snap & SendPhotograph a part or list, we find it
    • Part finderAnswer a few questions, get the right part
    • Compatibility checkWill these two parts work together?
    • Compare partsSpecs side by side
    • Business & bulk ordersGST invoices, credit and volume prices
    • Request a quotationSend your list, get a quote
    • Classroom kitsPer-student kits and lab bundles
    • Gift cardsFor students, teams and events
  • Atal Tinkering Lab
BOM to cart
Geekobot

Components, kits and know-how for makers, students, engineers, labs and businesses across India.

Ask Geeko AIOrders, parts and projects, any timeEmail supportReply within 1 working dayGet the Geekobot appAdd it to your home screen, free

Follow us

Shop

  • Boards & SBCs
  • Sensors & Modules
  • IoT & Wireless
  • Drone & FPV
  • 3D Printing
  • Filaments & Resins
  • Motors & Drivers
  • Power & Batteries
  • Semiconductors
  • Passive
  • Displays & LEDs
  • Switches & Relays
  • Wires & Cables
  • Prototyping
  • Tools & Test
  • Robotics
  • STEM Kits
  • Atal Tinkering Lab
  • Mechanical Parts
  • Audio

Orders

  • Track your order
  • Help & support
  • Shipping and delivery
  • Refunds and cancellation
  • Contact us

Learn

  • Projects
  • Geeko AI project assistant
  • Learning paths
  • Guides
  • Calculators
  • Electrolark: free guided builds

Part tools

  • Part finder
  • Compare parts
  • Will it work with my board?

Institutions

  • Classroom kits
  • Atal Tinkering Lab
  • Students & teachers
  • Workshops & Events

Business

  • Business & education
  • Request a quotation
  • BOM bulk upload
  • Quick order by SKU

Company

  • About Geekobot
  • Community
  • Gift cards
  • Terms & conditions
  • Privacy policy
  • Product directory
  • Sitemap

© 2026 Geekobot, a trade name of OLatus Systems Private Limited. All rights reserved.

20, 1st Floor, Neeladri Complex, 10th Cross, Sampige Rd, 2nd Main, Malleshwaram, Bengaluru, Karnataka 560003 · GSTIN 29AACCO0462F1ZM

+91 91810 15607 · connect@geekobot.in · Monday to Saturday, 10 AM to 2 PM IST

UPI · CARDS · NETBANKING · GST INVOICES

ShopProjectsGeeko AIGuides
Compare 0 parts →
Log in

Shop by category

Shop all components
  • Boards & SBCs1,910 products
    • Alternative Single Board Computers
    • Arduino Ecosystem
    • FPGA & Logic Boards
    • Microcontroller & Wireless Boards
    View all
  • Sensors & Modules4,701 products
    • Biomedical & Heart Rate
    • Current, Voltage & Power
    • Force, Weight & Pressure
    • Gas, Weather & Environmental
    View all
  • IoT & Wireless2,314 products
    • RF Modules
    • RFID & NFC
    • Antennas & RF Accessories
    • Cameras & Smart Vision
    View all
  • Drone & FPV3,558 products
    • Flight Control & Navigation
    • FPV Video & Optics
    • Frames & Structural Parts
    • Motors & Propulsion
    View all
  • 3D Printing2,204 products
    • 3D Printers
    • 3D Scanners & Digitizers
    • Laser Engravers & Cutters
    • Material Management & Upgrades
    View all
  • Filaments & Resins1,472 products
    • Filaments
    • Photopolymer Resins
    View all
  • Motors & Drivers463 products
    • BLDC Motor Drivers
    • DC & Geared Motors
    • DC Motor Drivers
    • Linear Actuators & Solenoids
    View all
  • Power & Batteries557 products
    • Battery Holders & Connectors
    • Breadboard Power
    • Chargers & BMS
    • DC-DC Converters
    View all
  • Semiconductors295 products
    • Diodes & Rectifiers
    • Interface & RF Encoder ICs
    • Logic ICs (74xx)
    • Logic ICs (CD4000)
    View all
  • Passive67 products
    • Capacitors
    • Circuit Protection
    • Crystals & Oscillators
    • Inductors
    View all
  • Displays & LEDs572 products
    • 7-Segment & Dot Matrix
    • Addressable LEDs
    • Character LCDs
    • Graphic LCDs
    View all
  • Switches & Relays184 products
    • Keypads & Touch
    • Push Buttons & Tactile
    • Relay Modules
    • Relays
    View all
  • Wires & Cables233 products
    • Board-to-Wire Connectors
    • Crimp & Splice
    • Headers & Dupont
    • Heat Shrink & Sleeving
    View all
  • Prototyping101 products
    • Breadboards
    • Interface Modules
    • PCBs & Perfboards
    View all
  • Tools & Test717 products
    • Bench Power Supplies
    • Hand Tools
    • Measuring Tools
    • Meters & Testers
    View all
  • Robotics180 products
    • Humanoid & Legged Robots
    • Robot Chassis & Platforms
    • Robotic Arms & Grippers
    • Wheels & Casters
    View all
  • STEM Kits268 products
    • Arduino Learning Kits
    • Coding & IoT Kits
    • Early Coding (Ages 3-8)
    • Invention Kits
    View all
  • Atal Tinkering Lab196 products
    • Package 1: Electronics, Robotics, IoT and Sensors
    • Package 2: Rapid Prototyping Tools
    • Package 3: Mechanical, Electrical and Measurement Tools
    • Package 4: Power Supply, Accessories and Safety Equipment
    View all
  • Mechanical Parts212 products
    • Bearings
    • Brackets & Mounts
    • Couplers
    • Fasteners & Standoffs
    View all
  • Audio109 products
    • Amplifier Modules
    • Buzzers & Sirens
    • Speakers
    View all
  1. Home
  2. ›Guides
  3. ›Sensors
  4. ›TCRT5000 IR Line Sensor

Component guide · Beginner · 3 min read

TCRT5000 IR Line Sensor

Pinout, Wiring and Code

By Geekobot Learning Team · Updated 29 Oct 2026

I'm using
Wiring, code and the Run it panels follow your board.
On this page
Short answerWhat the TCRT5000 sensor isTCRT5000 sensor pinoutWiring the TCRT5000 sensorExample codeSetup and tuningWhat you needAlternatives and when to choose themCommon mistakesFAQsParts and next steps
Short answer

The TCRT5000 is a reflective infrared sensor: an IR LED and a phototransistor side by side. On a module with an LM393 comparator it gives a digital output that changes between a white and a black surface, which is how line-following robots find the line. It works best 1 to 3 mm from the surface and runs from 3.3 to 5 V.

Key specs at a glance

Sensor
TCRT5000 IR LED (950 nm) and phototransistor
Best distance
About 1 to 3 mm (peak 2.5 mm), usable up to about 1.5 cm
Output
Digital (LM393 comparator), some modules also analog
Supply
3.3 to 5 V
Channels
Single, dual or 3-channel modules
Adjustment
Trim pot sets the threshold

Models in this guide

These are alternatives. Pick the one that fits your project; you only need one.

  • Option 1TCRT5000 IR Tracking Sensor Module – Digital Output, 5V₹43
  • Option 2TCRT5000 Single Channel Line Tracking Sensor Module₹41
  • Option 3TCRT5000 Dual Channel Line Tracking Sensor Module – Infrared Reflective Detection₹36
  • Option 4TCRT5000 3-Channel Line Tracking Sensor Module – 5V DC Digital Output₹125
01

What the TCRT5000 sensor is

White surfaces reflect infrared light and black surfaces absorb it. The TCRT5000 shines IR down and measures how much comes back. The module's comparator turns that into a clean digital signal, with an LED that lights when the output switches.

Its daylight filter makes it less sensitive to room light than a bare IR LED and photodiode, but strong sunlight still affects it.

02

TCRT5000 sensor pinout

The pins on the TCRT5000 sensor and what each one does.

PinFunction
VCCSupply, 3.3 to 5 V
GNDGround
D0 / OUTDigital output (one per channel on multi-channel boards)
A0Analog output on modules that have it
PinFunction
VCC
Supply, 3.3 to 5 V
GND
Ground
D0 / OUT
Digital output (one per channel on multi-channel boards)
A0
Analog output on modules that have it
03

Wiring the TCRT5000 sensor

Most modules pull the output LOW when they see a reflective (white) surface and HIGH over black, but check yours: the on-board LED shows the state. Mount the sensors 1 to 3 mm above the track.

TCRT5000 sensor pinArduino UnoESP32
VCC5V3V3
GNDGNDGND
OUT (left)D2GPIO 25
OUT (centre)D3GPIO 26
OUT (right)D4GPIO 27
VCC
Arduino Uno:
5V
ESP32:
3V3
GND
Arduino Uno:
GND
ESP32:
GND
OUT (left)
Arduino Uno:
D2
ESP32:
GPIO 25
OUT (centre)
Arduino Uno:
D3
ESP32:
GPIO 26
OUT (right)
Arduino Uno:
D4
ESP32:
GPIO 27
04

Example code

Replace the Serial prints with your motor driver commands, for example from the L298N guide.

Simple line-follower decisions (Arduino) · Arduino C++Verify & upload in Electrolark
const int L = 2, C = 3, R = 4;

void setup() {
  Serial.begin(115200);
  pinMode(L, INPUT); pinMode(C, INPUT); pinMode(R, INPUT);
}

void loop() {
  // HIGH = black line under the sensor on most modules
  bool l = digitalRead(L), c = digitalRead(C), r = digitalRead(R);
  if (c && !l && !r)      Serial.println("forward");
  else if (l)             Serial.println("turn left");
  else if (r)             Serial.println("turn right");
  else                    Serial.println("line lost: stop");
  delay(50);
}
05

Setup and tuning

Set the threshold

hold the sensor at its working height over white, then over black, and turn the pot until the LED switches cleanly between the two.

Height

1 to 3 mm gives the sharpest difference; a skid or caster keeps the height constant.

Shade it

a black shroud around the sensor reduces errors from room lights and sunlight.

Analog output

read A0 to tune the threshold in code, or to follow the line edge smoothly.

06

What you need

Shop this list6 of 7 found in our store · ₹420

  • TCRT5000 single-channel module: for one-sensor detectors and countersTCRT5000 Single Channel Line Tracking Sensor Module₹41Closest match, check the specs
  • TCRT5000 Single Channel Line Tracking Sensor Module: another version this guide coversTCRT5000 Single Channel Line Tracking Sensor Module₹41
  • TCRT5000 Dual Channel Line Tracking Sensor Module – Infrared Reflective Detection: another version this guide coversTCRT5000 Dual Channel Line Tracking Sensor Module – Infrared Reflective Detection₹36
  • TCRT5000 3-channel line tracking module: the sensor this guide coversTCRT5000 3-Channel Line Tracking Sensor Module – 5V DC Digital Output₹125Closest match, check the specs
  • Uno R3 development board: the controller used in the wiring tableFind this part
  • L298N motor driver: to drive the robot's motorsL298N Dual H-Bridge Motor Driver Module₹128Closest match, check the specs
  • Dupont jumper wires: for the connectionsDupont Jumper Wires (40 pcs)₹49Closest match, check the specs
07

Alternatives and when to choose them

  • ✓IR obstacle sensor module: longer range (several cm) for obstacles, not lines.
  • ✓Line follower robot: the full build with motors and PID.
  • ✓Photointerrupters: slot sensors for encoders and end stops.
08

Common mistakes to avoid

  • !Mounting the sensor too high (over about 1 cm), so black and white look the same.
  • !Testing in sunlight, which floods the receiver.
  • !Not setting the threshold pot for your track and height.
  • !Assuming the output polarity without checking the on-board LED.
09

Frequently asked questions

How far can the TCRT5000 detect?

It works best at 1 to 3 mm and reliably up to about 1.5 cm on white surfaces.

Does it work with 3.3 V boards?

Yes, power it from 3.3 V for a 3.3 V output.

Is the output HIGH on black?

On most modules yes, but check the LED on yours.

Can it detect colours?

Only light versus dark. Use a colour sensor such as the TCS34725 for colours.

How many sensors does a line follower need?

Two work for simple tracks, three or five for smoother control and junctions.

Parts for this guide

  • TCRT5000 IR Tracking Sensor Module – Digital Output, 5V
    ₹43View
  • TCRT5000 Single Channel Line Tracking Sensor Module
    ₹41View
  • TCRT5000 Dual Channel Line Tracking Sensor Module – Infrared Reflective Detection
    ₹36View
  • TCRT5000 3-Channel Line Tracking Sensor Module – 5V DC Digital Output
    ₹125View
  • Uno R3 Development Board (No Cable)
    ₹359View
  • L298N Dual H-Bridge Motor Driver Module
    ₹128View
  • Dupont Jumper Wires (40 pcs)
    ₹49View
Shop Infrared & Optical Detection Modules

Projects that use it

Put this into practice: 11 step-by-step builds in our project library use parts from this guide.

Intermediate · 3–4 hoursLine follower robot with L298N and TCRT5000View projectIntermediate · 3 hoursTable-edge avoiding robotView projectBeginner · 45 minutesConveyor and production line counterView project
Browse all 11 projects

Keep learning

How-toIntermediateLine Follower RobotA line follower uses a row of infrared reflective sensors (TCRT5000 type) under the robot to see a black line on a white floor, and steers two DC motors to keep the line centred.3 min read · RoboticsComponent guideBeginnerIR Obstacle Sensor ModuleAn IR obstacle sensor module shines infrared light from an LED and watches for its reflection with a photodiode; when something is within about 2 to 30 cm, its OUT pin goes LOW.3 min read · SensorsComponent guideBeginnerPhotointerrupters and Slot SensorsA photointerrupter has an infrared LED and a phototransistor facing each other across a slot.3 min read · SensorsBuying guideBeginnerChoosing a Robot ChassisFor a first robot car, a 2WD acrylic chassis with two gear motors and a caster wheel is cheapest and easiest to program.3 min read · Robotics

Sources

  • TCRT5000 reflective optical sensor datasheet (Vishay)
  • LM393 dual comparator datasheet

Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

On this page
Short answerWhat the TCRT5000 sensor isTCRT5000 sensor pinoutWiring the TCRT5000 sensorExample codeSetup and tuningWhat you needAlternatives and when to choose themCommon mistakesFAQsParts and next steps
Need a hand?Ask Geeko AI which part fits your project, or talk to the Geekobot team.Ask Geeko AIHelp & support

Parts for this guide1 item · ₹43

TCRT5000 IR Tracking Sensor Module – Digital Output, 5V

Run itChange the inputs and watch the output

Each sensor outputs HIGH over the black line on these modules (check yours).

Serial monitor115200 baud
forward

A simulation of the sketch above, so you know what to expect. Real readings vary with your parts and wiring.

Ask the Community

Ask a question