From light to a voltage · 04 of 10

VCC sets the ceiling

In a room, VCC makes no difference: the light sets the current and the 4.7 kΩ sets the voltage. What VCC sets is the ceiling, about 0.4 V below it, where bright light flattens out: about 2.9 V from 3V3 and about 4.6 V from 5V. So 3V3 beside an ESP32, an ESP32-S3 or a Pico, and 5V beside an Uno.

VCC does not set the reading

In a divider, two resistors split VCC, and the output is a fraction of it: raise VCC and every reading rises with it. That is how the NTC thermistor block works. This block is not a divider. The light sets a current, and the 4.7 kΩ turns the current into a voltage. VCC is not in that sum at all.

So at 300 lux SIGNAL is about 0.7 V with VCC on 3V3 and about 0.7 V with VCC on 5V. The block reads a room the same either way.

VCC sets the ceiling

Where VCC matters is at the top. The transistor needs a little voltage across itself, at most 0.4 V by its datasheet, so SIGNAL can never climb closer to VCC than about that. Bright light flattens at about 2.9 V from 3V3, reached at about 1230 lux for a typical part, and at about 4.6 V from 5V, at about 1960 lux.

VCC sets the ceiling
Your board
The block's VCC pin goes to
Light
SIGNAL
2.90 V
Reads
3822 of 4095
Tops out at
about 2.90 V
In bright light SIGNAL climbs until the transistor runs out of room, about 2.90 V with VCC on 3.3 V, and stays there: 3822 of 4095. That is inside the ESP32-S3's own range. This is the wiring.

Pick Window or torch with an ESP32-S3 and VCC on 3V3. SIGNAL flattens at about 2.9 V, inside the pin's range. Now move VCC to 5V. The same light takes SIGNAL to about 4.6 V on a pin built for 3.3 V.

The dangerous part is that with A room picked, 5V on VCC looks fine. The reading is right, the numbers move, and nothing warns you. It stays fine until the block sees the sun.

So

3V3 beside an ESP32, an ESP32-S3 or a Raspberry Pi Pico. 5V beside an Uno, where it gives the whole of the Uno's scale; 3V3 works there too, it just flattens lower.

Even at the ceiling the block draws very little: 4.6 V across 4.7 kΩ is just under 1 mA, and in a room it takes tens to a couple of hundred microamps.

When it does not work

Can I power it from 5V next to an ESP32?

No. In a room it reads correctly and seems fine, which is the trap. The first time a window or a torch lights it, SIGNAL climbs towards about 4.6 V on a pin built for 3.3 V. Connect VCC to 3V3. Nothing about the reading in a room changes.

Will it work on an Uno from 3V3?

Yes. Room light reads exactly as it would from 5V, because the light sets the voltage, not VCC. Only the ceiling drops, to about 2.9 V, so bright light tops out around 590 on the Uno's 1023 scale instead of about 940. Use the 5V pin if you want the whole scale.

How much current does it draw?

Very little. In a room, tens to a couple of hundred microamps. The most it can ever take is at the ceiling: about 4.6 V across 4.7 kΩ, just under 1 mA from 5V, and about 0.6 mA from 3V3.

I left VCC unconnected and it reads 0 everywhere.

With nothing on VCC there is no current to turn into a voltage, and the resistor holds SIGNAL at 0 V. It looks exactly like a very dark room. A torch on the sensor still gives 0, which is the tell. Connect VCC.

Where this goes next

Three wires, and a sketch that prints what the analog pin sees.

The first reading

Edit this page — content/books/ambient-light-sensor/vcc-sets-the-ceiling.mdx

Community

Questions about this product

See what other owners have asked, and read their solutions.

Ask a question ↗

Ambient Light 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.

Browse Modules and blocks on the forum