1

I want to use an IR sensor for object detection. An LED will be turned on if an object is detected. But because of sunlight, it's malfunctioning (i.e. always getting logic 1).

So, how do I omit the interference due to sunlight?

Sadat Rafi
  • 2,467
  • 10
  • 34
glibin dsilva
  • 11
  • 1
  • 2
  • 1
    Try pulsing your IR emitter and looking for a response in the receiver that matches the pulses. – Hearth Jul 26 '20 at 13:33
  • In addition to all the other "electronic" approaches, there's another to add to the list. You can use a quad-detector with an astigmatic lens to perform yet another add-on technique if you want something truly robust. Achieving this at IR wavelengths useful for body temperatures is another problem. If you "go active" with an IR source, instead of passive, then there are thin-film filters plus crystal-controlled narrow-band filtering, plus baffling, plus astigmatism/quad (which adds accurate distance to everything else) that combined are near bullet-proof. – jonk Jul 26 '20 at 17:11

4 Answers4

3

I'd like to expand on analogsystemsrf's answer a bit:

Thus pulses, or squarewaves, of photons may be your best bet.

Exactly.

Sunlight doesn't change quickly.

If your illuminating IR LED is pulsed on/off, e.g. at 25 kHz (easy with a microcontroller), then you can simply measure the photocurrent at every pulse:

Add all measurements when the LED is on, subtract all measurements where the LED is off.

When you write that down, you'll see that you're simply subtracting the background light, which stays constant.

Marcus Müller
  • 88,280
  • 5
  • 131
  • 237
  • This is how TV remotes work... This is probably the only reliable method. – MadHatter Jul 26 '20 at 16:11
  • TV remotes typically work at 39 kHz, but other than that: exactly. Not the only method, though: Any amplitude-differential method would work here; one could do really complex spreading sequences, for example. – Marcus Müller Jul 26 '20 at 16:17
  • Can you please eloborate when the LED is exactly on and off? Or in other words: When do I know that the measured signal is sunlight only? – Ben Jul 27 '20 at 05:07
  • **you** turn the LED on and off, multiple times, quickly. You measure while it's off (i..e background light only), and you measure while it's on (i.e. background light + LED light). Then you subtract the value you measured while the LED was off from the one while it was on. – Marcus Müller Jul 27 '20 at 05:08
2

WARNING --- if your circuit is just a photodiode and a resistor, then high amounts of DC_photon flux (the sunlight) will push the output voltage close to rail, and the circuit will become VERY UNRESPONSIVE to changes. Thus you need to find a way to AVOID pushing close to rail/VDD/GROUND.

Thus I offer this:

If you run the photodiode current thru a normal silicon diode, you can get a LOGARITHM of the current.

This --- the LOG --- greatly extends your dynamic range.

As the reflectance of your "object" changes with different objects, you may need to calibrate any thresholding or detecting activity in the circuits.

And there will be temperature effects.

Thus pulses, or squarewaves, of photons may be your best bet.

However, you need to bias the photodiode, despite the sunlight;

Or use a black_looking IR filter, taken from a discarded VCR.

To handle sunlight, I've very successfully used a parallel_load for the photodiode:

  • a transistor to pull DC (sunlight) current from the photodiode

  • a resistor, perhaps 10,000 Ohms, to convert small fast photocurrents into voltages; connect this resistor from the output node (photodiode, resistor, transistor_collector) to ground.

Operate the transistor base from a low_pass version of its collector.

analogsystemsrf
  • 33,703
  • 2
  • 18
  • 46
1

You will need a filter. Sunlight doesn't vary rapidly. All you have to do is to use high-frequency pulse for driving the LED. And design a bandpass or high pass filter to receive the desired signal.

You can find an IR sensor with built-in bandpass filter in the market.

And if you are using a high-frequency microcontroller (STM32, ATSAM, etc.) then you can implement digital signal processing (FFT/ IIR/ FIR). You will find library function related to FFT/ IIR /FIR on the internet.

Sadat Rafi
  • 2,467
  • 10
  • 34
1

In addition to pulsing, you can also pick a wavelength where the sun is less bright. 1.5 um for example is often used for that purpose, although it does not work with cheap silicon diodes. 930nm is also sometimes used, since water absorption attenuates sunlight somewhat at that wavelength. Add a bandpass filter at one of these wavelengths and you will detect a lot less solar radiation.

user1850479
  • 14,842
  • 1
  • 21
  • 43