VCC is your logic voltage
Over black tape or open air the receiver lets go and the pull-up takes SIGNAL all the way to VCC. So VCC is the most your pin will ever see, and it has to be the voltage your board's pins run at: 3V3 on an ESP32, an ESP32-S3 or a Pico, 5V on an Uno. The emitter is inside its limits on either.
The top of SIGNAL is VCC
When nothing comes back into the receiver, it takes no current, nothing drops across the 4.7 kΩ, and SIGNAL sits at VCC. That happens over every dark surface and every time the sensor points at nothing. So whatever VCC is wired to, your pin will see, often.
Pick your board and what VCC goes to.
Four boards, one rule
- ESP32, ESP32-S3, Pico: their pins run at 3.3 V. VCC on 5V puts up to 5 V on the pin, with only the 4.7 kΩ in the way. VCC goes to 3V3.
- Uno: its pins run at 5 V, so VCC goes to 5V, and a dark surface reads the top of the range. Its 3.3V pin works too: a dark surface then reads about 675 of 1023, and the block runs cooler.
One rule, then, whatever you plug it into: VCC to the voltage your board's pins run at.
The emitter takes either
The emitter's current is set by its 120 Ω resistor: about 17.5 mA from 3.3 V and about 31 mA from 5 V, both well under the TCRT5000's 60 mA maximum. At 5 V the resistor turns about 117 mW into heat against a 125 mW rating. That is inside it, with little to spare, which is why the block is warm to the touch on 5V. The emitter never rests has the arithmetic.
White moves less than black
In this book's model, white paper 3 mm away reads about 1.3 V from 3.3 V and about 1.4 V from 5 V. VCC moves the top of the range far more than the bottom, and the top is exactly the end that can hurt a pin.
When it does not work
Either works, because the Uno's pins take 5 V. On 5V a dark surface reads the top of the range, 1023, and the emitter's resistor runs warm, at about 117 of its 125 mW. On the 3.3V pin the reading tops out near 675 of 1023, still plenty to tell white from black, and the block takes about 18 mA, well inside the 50 mA that pin supplies.
Possibly not, but it was outside the ESP32's ratings every time the sensor saw something dark. Move VCC to 3V3, then check the reading still falls over white paper and rises over black tape. If a pin now reads wrongly on every block, try another pin.
SIGNAL is then connected to nothing that holds it, so the pin floats and picks up whatever is near it: your hand, the next wire. It can look like a working sensor. Wire VCC and the numbers settle.
Three wires and a number that falls when white paper comes near.
The first reading →Edit this page — content/books/reflective-optical-sensor/vcc-is-your-logic-voltage.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.