TCRT5000 line sensor
The TCRT5000 reflective sensor on its LM393 board: a line follower's eye and a short-range object sensor. Aliases: line sensor, IR reflective sensor.
The TCRT5000 is an infrared LED and a phototransistor side by side in one black block,
with a wall between them so the only light the transistor sees has bounced off
something in front. White paper bounces most of it back; black tape swallows nearly
all of it. The board puts the phototransistor under a 10 k pull-up, so a reflection
pulls AO down, and the comparator pulls DO low and lights its lamp.
Pins
| Pin | What it does |
|---|---|
VCC |
Supply, 3.3 V to 5 V. |
GND |
Ground. |
DO |
Low over white, high over black. Open collector with a 10 k pull-up. |
AO |
The phototransistor under its pull-up: lower means more reflection. |
Properties
threshold is the trimmer as a fraction of the supply, 0.5 by default.
While it runs
The slider is how far the surface is from the sensor, from 0.2 mm to 40 mm (the far end is nothing in front at all). Click the swatch beside it to swap white paper for black tape.
What the model gets right
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.
What it does not model
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.
Common mistakes
Getting the line the wrong way around: low is white, high is the black line.
Mounting it too high. Past a centimeter it cannot tell white from black at all.
See it in action
Comparator boards has a TCRT5000 lighting a lamp from DO, beside an MQ-2 and a
flame sensor. Open it at /templates.