When the reading is wrong
There is no LED on this block, so the first test is always the same: cover the sensor and the reading should fall to near 0, shine a phone torch on it and it should jump near the top. If both happen, the block works, and the problem is the light, the scale or the sketch.
Six symptoms
Pick what the reading is doing. The ringed part of the board is where to look first, and the list beside it is the order to check in, by how often each one is the answer.
It reads 0
With a torch on the sensor still 0: nothing is supplying the current. VCC is missing or the cable is one pin over. With a torch giving a number but the room giving 0: on an ESP32 that is the floor, about 43 lux for a typical sensor. Reading it on an ESP32 covers it.
It is stuck at the top
Shade it. If the number falls, it was simply bright: sun, a window or a lamp close by takes SIGNAL to its ceiling and holds it there. If it stays up with the sensor covered, check GND.
It barely moves in a lit room
That is what a lit room looks like on this block: roughly 50 to 240 on an Uno, well under half the scale. Cover it and torch it. If the number goes from near 0 to near the top, it is working.
It jumps around
Under many mains lamps it is the ripple, 100 or 120 times a second, and the sensor is fast enough to see it. Average over 50 ms, as in the flicker under room lights.
It reads high under some lights, or differs from another block
It sees infrared best, so filament bulbs and daylight read high for how bright they look, and a TV remote makes it jump. And any one sensor can be 30 % more or less sensitive than typical. Both are reasons to calibrate under the real light with the real block, as a night light does.
When it does not work
Power it, GND and VCC only, and put a multimeter on its volts range between SIGNAL and GND. Covered, it should read close to 0 V. In a room, a few tenths of a volt to about a volt. Under a torch held close, near the ceiling: about 4.6 V from 5V, 2.9 V from 3V3.
An ADC1 pin, so Wi-Fi does not stop the reading: GPIO 34 on an ESP32, GPIO 4 on an ESP32-S3. Never the flash pins, and preferably not the strapping pins read at reset. GPIO 34 is input only, which is all an analog pin needs.
Try the torch. If it jumps, the block is fine and the room is dim; on an ESP32, under about 43 lux reads 0. If it stays at 0, a wire has come loose, most likely VCC. The right-angle pins lie flat, and a cable's weight can pull the block out of its row.
Ordinary light cannot hurt it, and its datasheet rates it to work from −30 to +85 °C. The likely ways are heat, such as a soldering iron held on it too long, or a cracked lens. If a torch held against it moves nothing with VCC and GND measured correct, that is the time to suspect it.
Forty-odd blocks, and this is the one that knows whether the lights are on.
Back to the blocks →Edit this page — content/books/ambient-light-sensor/when-the-reading-is-wrong.mdx
Questions about this product
See what other owners have asked, and read their solutions.
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.