Source: https://mokxi.com/parts/tcrt5000
Updated: 2026-11-10

Part

# Line sensor, TCRT5000

An infrared LED and eye side by side. Low over white, high over the black line.

See every part

- 4 pins
- 1 setting
- In 3 projects

Drawn live by the editor's own code, at the size you see it.

At a glance

## The Line sensor, TCRT5000 in brief

What it is, and every setting the properties panel gives it.

The TCRT5000 is Vishay’s reflective sensor, an infrared LED and a phototransistor side by side in one black block, and its blue LM393 board is the eye of most line-following robots. The pins are VCC, GND, DO and AO, at 3.3 to 5 volts. On an Uno, VCC goes to 5 V, DO to a digital pin and AO to an analog pin if you want the level; on an ESP32, power it from 3.3 V so DO’s pull-up stays at 3.3 V. The phototransistor sits under a 10 k pull-up, so reflection pulls AO down, and DO goes low over white and stays high over the black line. Mokxi models the datasheet’s distance hump as 2x / (1 + x^2) with x = d / 2.5 mm, peaking at 0.58 mA at the board’s LED current, with white reflecting 90 percent and black 5; the slider runs from 0.2 to 40 mm, and a swatch swaps white paper for black tape. By about 15 mm white reads like black. The classic mistakes are the line backwards, since low is white, and mounting it too high. Ambient sunlight, gray or glossy surfaces and part-to-part spread are not modeled.

Family

Sensors

Pins

4

threshold

0.5

Pins

## 4 pins

Named as the editor names them, so a wire lands where you expect it.

Pin

Role

What it does

VCC

Input or output

Supply, 3.3 V to 5 V.

GND

Input or output

Ground.

DO

Output

Low over white, high over black. Open collector with a 10 k pull-up.

AO

Output

The phototransistor under its pull-up: lower means more reflection.

How to use it

## How to use the TCRT5000 line sensor with an Arduino

Wire VCC to 5 V, GND to GND and DO to a digital pin; in the kit circuit here DO goes to pin 3 and the sketch prints digitalRead(3) four times a second. Drag its slider to raise or lower the surface, and click the swatch beside it to swap white paper for black tape.

Low is white and high is the black line. White reflects the infrared back, the phototransistor pulls AO down past the trimmer and DO goes low with its lamp lit; black swallows it and DO stays high. A line follower that steers the wrong way usually has this backwards.

Height matters as much as color. The response peaks at about 2.5 mm, and by about 15 mm white reads like black, so a robot’s sensors ride a few millimeters off the floor.

Part pin

Board pin

DO

Pin 3

VCC

5 V

GND

GND

The board runs from 3.3 V, so on an ESP32 power it from 3.3 V and DO’s 10 k pull-up stays at the ESP32’s own logic level.

Click to open it in the editor

This is the simulator itself, running here. Click anything to open it in the editor.

Open this project in the editor Read the full tutorial

Over the line or not

How it is modeled

## What is true about the Line sensor, TCRT5000, here

In its help article’s own words: what the simulation gets right, and where it stops.

### Modeled

The distance curve. The datasheet draws the collector current against distance as
one hump: nothing at contact, the most at 2.5 mm (the "peak operating distance"), and
falling away to about a fifth of the peak by 15 mm. The model's hump peaks in the same
place and falls at the same order of rate. The sheet's 1 mA at the peak is with the LED
at 60 mA; the board's 100 ohm resistor runs it at about 35 mA, so the peak here is
0.58 mA.

The surface. White reflects 90% and black 5%. Over white at a couple of
millimeters the transistor saturates and DO is low; over black it barely conducts
and DO is high. Lift it and white fades until, at about a centimeter and a half, it
reads like black. That is why a line follower's sensors ride a few millimeters off the
floor.

### Not modeled

Ambient light. A real one outdoors sees plenty of infrared in the sunlight and reads
nonsense; here the room is dark in the infrared. Surfaces that are neither white nor
black, glossy surfaces that mirror the LED away, and the sheet's two-to-one spread
between parts are not modeled. The comparator has no hysteresis, as on the real
board.

From TCRT5000 line sensor, in full.

Projects

## See the Line sensor, TCRT5000 in a project

3 built-in projects use it. Each opens in the editor, already wired.

Boards

## The boards it is shown on

This board has a built-in project with the Line sensor, TCRT5000 in it.

- Arduino Uno R3

More parts

## The rest of the bench

Every one of these is drawn and simulated the same way.

Full-size breadboard

A real 0.1 inch grid with the rails and the center channel, 63 columns wide.

Jumper wires

Drag from any pin or hole to any other. Corners snap, and you can drag them.

Power

A supply rail at the voltage you choose.

Ground

The other end of every circuit.

LED

Lights when current flows. Five colors, and the brightness is what your eye would see.

Filament lamp

A tungsten bulb in a holder: an inrush when it is switched on cold, tens of milliseconds to warm up, and dim on half its voltage.

Resistor

Any value you like, with the color bands drawn to match.

ESP32-C3-DevKitM-1

A RISC-V board that runs your firmware at 160 MHz on the real memory map.

Pushbutton

A 12 mm tactile switch. Hold it while the simulation runs.

Raspberry Pi Pico

The RP2040 board on our own Cortex-M0+ core. Pick a program and press Run.

Raspberry Pi Pico W

Raspberry Pi Pico W (RP2040). The same board and the same pinout as a Pico, with the CYW43439 on it. The WiFi is simulated (no radio; real internet through the Cloud panel’s switch), and the on-board LED, which hangs off that chip rather than off GP25, is driven through the same path. Everything else is the Pico.

Raspberry Pi 4 Model B

Raspberry Pi 4 Model B: the 40-pin header, driven by main.py with RPi.GPIO or gpiozero.

See every part

## Wire up the Line sensor, TCRT5000

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.

Start building free Open the editor
