Near is not a number
The TCRT5000 sees best at 2.5 mm. Closer, and the emitter's beam and the receiver's view stop overlapping; farther, and less comes back, down to a fifth of the peak by 15 mm. So the reading depends on the surface and the distance at once, and a grey card near reads the same as white paper far. Fix the distance, and it tells surfaces apart.
A peak at 2.5 mm
The emitter and the receiver sit side by side, each looking straight out, with a wall between them. Light has to leave one, hit a surface and come back into the other. Very close, the patch the emitter lights and the patch the receiver sees hardly overlap. Farther away they overlap well, but the light spreads and less of it comes back.
Vishay's datasheet draws the result: the current peaks with a reflecting card 2.5 mm from the sensor, and stays above a fifth of that peak from 0.2 mm out to 15 mm. Past that, the reading drifts up towards VCC as though nothing were there.
Pick a surface and slide the distance. The curve's shape is Vishay's; the volts are this book's model at 3.3 V, not a measurement. The dashed line is white paper, for comparison.
Two unknowns, one number
A reading of 2.6 V could be grey card at 3 mm, or white paper at about 10 mm. Nothing in the number says which. The sensor measures how much light came back, and both the surface and the distance decide that.
That is why it suits jobs where one of the two is fixed:
- Following a line, finding an edge: the sensor rides at a fixed height, and only the surface changes.
- Counting things on a belt, slots in a disc: the same surface passes at the same distance each time.
- Something is there, or not: a hand, a cup, a sheet of paper in a tray. Anything close enough reads low.
What it will not do is tell you how far away something is. The page this book replaces said as much, and it is the reason the TK50 exists.
Near the peak, white holds still
The curve is flat across its top, so around 2.5 mm white paper a little nearer or a little farther reads about the same, at its lowest. That is useful for a line follower, which wants white to be steady while the robot bounces. For telling greys apart, hold the sensor a little farther away, where the curve is steeper and the reading has room to move.
When it does not work
Not reliably. The reading depends on how much the surface reflects as much as on how far away it is, and it rises again closer than about 2.5 mm, so one reading can mean two distances. For distance use an ultrasonic sensor such as the TK50.
Right against the surface the emitter's beam and the receiver's view barely overlap, so little light reaches the receiver. The datasheet's curve falls to nothing at 0 mm. Hold it 2 to 5 mm away; a spacer or the height of a robot's chassis does that.
A few centimetres at most, and it depends on the hand. The datasheet gives 0.2 to 15 mm for a reading above a fifth of the peak, against a reflecting card. Skin is a good reflector, so a hand can register farther out, but as a reading that is small and easy to confuse with room light.
Learn the two readings, put two lines between them, count each mark once.
A counter that learns →Edit this page — content/books/reflective-optical-sensor/near-is-not-a-number.mdx
Questions about this product
See what other owners have asked, and read their solutions.
Reflective Optical Sensor
Loading discussions…
Discuss this article
Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.