The LED bends the curve
The red LED hangs off SIGNAL and runs on the sensor's own current. Below about 2 V it is dark and the reading is 10 mV per microamp. Above, it takes most of each extra microamp, so the reading climbs eleven times more slowly, and the ceiling is reached at about 1.2 mA instead of 0.29 mA from 3V3. Worked out, not measured.
Two paths for one current
The phototransistor's current leaves by SIGNAL and has two ways down to GND: the 10 kΩ, and the 1 kΩ with the red LED. An LED passes almost nothing until the voltage across it reaches its forward voltage, about 2 V for a red one. So while SIGNAL is under 2 V, the 10 kΩ takes everything, and the reading is the plain sum from light becomes a voltage.
Past 2 V the second path opens. The 1 kΩ is a tenth of the 10 kΩ, so from then on it takes about ten parts in eleven of any extra current. SIGNAL still rises, eleven times more slowly.
The solid line is the board as built; the dashed one is what the 10 kΩ alone would do. Below 2 V they are one line. Drag past 0.2 mA and they part: the dashed line runs straight on to the ceiling, which it reaches at 0.29 mA from 3V3, and the solid one bends and does not get there until about 1.2 mA. At 5V the same thing happens higher up, at about 0.46 mA and 3.1 mA.
These are worked out, not measured. A real LED turns on gradually from about 1.6 V, so the corner is rounded, and it sits wherever your LED's forward voltage is.
What the bend costs, and what it buys
It costs detail at the top. Under 2 V, each microamp of photocurrent is 10 mV on SIGNAL, about 14 counts on an ESP32. Above it, under 1 mV, about 1 count. Two lights that differ by a little read almost the same once both are past the knee.
It buys range. Without the LED, anything past 0.29 mA would read as the ceiling; with it, the reading keeps moving until about four times that. And the LED is a free display: lit means SIGNAL is past about 2 V, before any code runs.
The light is part of the circuit
That is the one surprise on this board. On a switch block such as the reed switch, the LED only shows what the switch did. Here it shares the very current being measured, so it is part of the measurement.
When it does not work
Because the LED and its 1 kΩ take most of any extra current. Each extra microamp raises SIGNAL by under 1 mV instead of 10 mV. The reading still rises, only slowly. For fine detail, keep the light in the range where the LED stays dark: move the emitter back, or shade the sensor.
You can, and SIGNAL would then climb at 10 mV per microamp all the way to the ceiling, reaching it at about 0.29 mA from 3V3. You lose the light that shows strong infrared without a sketch, and the range between faint and pinned becomes four times narrower. Most projects are better off leaving it.
That is a real LED: it does not switch on at one voltage, it starts gradually, from roughly 1.6 V for a red one. The book models it as a switch at 2.0 V, so the real knee in the curve is rounded rather than sharp.
Edit this page — content/books/ir-photodiode/the-led-bends-the-curve.mdx
Questions about this product
See what other owners have asked, and read their solutions.
Infrared Receiver
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.