infrared receiver/When it is wrong/09. When the reading is wrong
When it is wrong · 09 of 9

When the reading is wrong

Three ways it goes wrong. Stuck at 0 means no current: VCC missing, the wrong pin, or a light with no infrared in it. Stuck at the top means the sensor is at the ceiling: sunlight or a lamp on it, and the red LED lit. Wandering means it is doing its job, reading every infrared source in view: average, shade it, subtract the room.

Stuck, or wandering

When the reading is wrong
What you see
No current is reaching the 10 kΩ. VCC is missing (it looks exactly like a dark room), or SIGNAL is on another pin than the sketch reads, or the light has no infrared in it: a white LED torch reads nearly nothing. Test with a TV remote held against the dome and a button held down: the reading should jump.

Pick what you see. The red LED helps only at the top: it lights once SIGNAL passes about 2 V, so lit proves the sensor, VCC and GND are all working. Dark proves nothing in an ordinary room, where the reading moves well below the LED's threshold.

Stuck at 0

No current is reaching the 10 kΩ. The usual causes, most likely first: VCC not wired, which looks exactly like a dark room; SIGNAL on another pin than the sketch reads, or on NC beside it; and a light with no infrared in it. A phone torch is a white LED, and to this sensor it is nearly dark. Test with a TV remote held to the dome, a button pressed: the reading should jump.

Stuck at the top

The sensor has run out of room: SIGNAL is about 0.4 V under VCC and more light changes nothing. Sunlight does it, and so does a filament or halogen bulb, or an emitter held against the dome. The red LED is lit. Shade the sensor with a short black tube, turn it away from the window, or move the emitter back until the LED goes out.

Wandering

This is the block working. It adds up every infrared source it can see, and nothing on the board filters any of it out: a remote pressed across the room, a cloud past the window, a warming bulb, even the sensor's own temperature, which the datasheet shows raising its current by about half a per cent per degree. Average several readings for a steadier number. For a beam, read the room with the emitter off and subtract, as a beam that breaks does.

When it does not work

It reads 0 with the emitter on and pointed at it.

Check VCC and GND first: without them there is no current and it reads like darkness. Then the pin, and then that the emitter is sending: a phone camera shows a working TK63 as a faint glow. Last, the direction: both domes look straight up off their boards.

It reads the top of the scale and will not come down.

SIGNAL is pinned at the ceiling, about 2.9 V from 3V3. Turn the sensor away from windows and filament or halogen lamps, move the emitter back, or put a short black tube over the dome. If the red LED goes out, you are back in range.

My ESP32 reads nothing once Wi-Fi starts.

SIGNAL is on an ADC2 pin, and ADC2 is not available to analogRead while Wi-Fi runs. Move it to an ADC1 pin: GPIO 34 on an ESP32, GPIO 4 on an ESP32-S3.

The reading drifts over minutes.

Something in view is changing: daylight through a window, a lamp warming up, the sensor itself warming, which raises its current by a few per cent. For a beam, the off-then-on subtraction in the break-beam sketch cancels all of it.

Where this goes next

A 940 nm LED switched by a transistor, the colour this sensor sees best.

The other half of the beam: the TK63 Infrared Transmitter →

Edit this page — content/books/ir-photodiode/when-the-reading-is-wrong.mdx

Community

Questions about this product

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

Ask a question ↗

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.

Browse Modules and blocks on the forum →