# Can a photodiode distinguish between daylight and white/blue LED?

I am working with a photodiode that is supposed to detect very tiny amount of LED light(the light will be programmed by an attiny 85). Using different kind of lenses I succeeded amplifying the light amount that will fall on the photodiode. Making use of op amps I could bring the photo detector to trigger an action (start a servo motor) as the small light amount was falling on it.

R1: 10M; Opamp: LM358; photodiode: VTB8440BH; Energy consumption should be as minimal as possible.

Now I have the problem as this experiment only works in dark environment. Since the photodiode has become very sensible with the op amp even small amount of daylight is detected by the photodiode. The photodiode I make use of is VTB8440BH (Datasheet Photodiode http://www.farnell.com/datasheets/57158.pdf.) As per datasheet its sensitivity peaks at 500nm. Since the light source is a white/blue LED ( arrnd. 450nm) I have selected this photodiode. However now I learned that even the wavelength of daylight settles btw 350 and 700 nm. Hence I experience the problem as mentioned above that the photodiode cannot differ between both the lights. I am aware to avoid this issue I should/might use an Infrared Light source. I have also learned that I might use a filter to avoid daylight however in my case I doubt (not sure though) that only daylight can be disselected filtering the led light. However I want to do it with an LED. Is there a possibility to avoid daylight and detect white/blue led???

I have already considered interesting discussions however I could not extract the required information for me to address my issue. how to make a system respond to IR laser? Poor man's IR obstacle sensor make sense(improve) from signal under daylight

• Can you modulate your LED source? – The Photon Jun 11 '15 at 18:43
• "...the wavelength of daylight settles btw 350 and 700 nm": this is not correct. That range is the only the spectral interval of visible light. Sunlight has a very wide spectrum: from far infrared to far UV. – Lorenzo Donati -- Codidact.org Jun 11 '15 at 19:31
• See a graph of the sunlight spectral emission. – Lorenzo Donati -- Codidact.org Jun 11 '15 at 19:35
• Also, you probably need a better op amp. Even a TL081 will give you bias currents 1000 times less and better noise performance. – WhatRoughBeast Jun 11 '15 at 21:07
• @ The Photon the light source will be a torch light where I will embed a programmed attiny 85...using attiny 85 I should be able to modulate the LED right? – Sathees Jun 11 '15 at 21:33

The peak spectral response of your photodiode is actually about 580 nm. So get rid of the blue/white LED, and go with a yellow-green ultra-high-brightness LED. Then get a narrowband filter at about the wavelength of your LED. Thorlabs, for instance, has a good selection for not too much money http://www.edmundoptics.com/optics/optical-filters/bandpass-filters/visible-bandpass-interference-filters/3429/. Don't worry too much about perfect matching of your filter and LED, LEDs usually have a pretty wide (10's of nm) spectrum. The use of a narrow-band filter will be critical in getting rid of unwanted sunlight.

Once you've done that, get a better op amp. If you're trying for cheap, even something like a TL081 will be better than an LM358. You'll have to use a split supply, something like +/- 12 or +/- 15 volts. Get over it. You need a split supply anyways in order to bias your photodiode. If you really don't like providing a higher supply voltage, and LF356 will work fine at +/- 5 volts. Also be aware that you probably should put a small capacitor across your feedback resistor for stability.

This may or may not fix your problem - it will help, but it may not be enough. There are two ways to work around this. The first is to get a second photodiode, and use a different filter on the input, with (let's say) a 100 nm difference in filter wavelength. Just as an example, let's say you use a 580 nm and a 680 nm filter. Both will receive about the same amount of power from sunlight, but only the 580 will get LED power. So you would detect a return only if a) the 580 signal level is high enough, and b) the 680 signal is distinctly lower, like less than 1/3 of the 580 signal.

If this doesn't work, you would need to modulate your LED, and look for the right frequency in the 580 return. The simplest (and least effective) approach is simply to put a bandpass filter on the 580 signal, so only the LED variation gets through. For tougher cases, you need a synchronous demodulator, which sounds scary but can be as simple as an op amp and a FET. See http://www.analog.com/media/en/technical-documentation/technical-articles/Use-Synchronous-Detection-to-Make-Precision-Low-Level-Measurements-MS-2698.pdf, figure 4. This is also called a lock-in amplifier. If you're willing to learn how to use one, you can do amazing things pulling a signal out of noise and background.

• Thx for your suggestions!! I have got some questions. 1. If I use LF356 and I will use it with a microcontroller such as attiny 85..in that case I will have +5V/0V(GND)..am I right? 2. I was aware of the lock-in-amplifier! To be honest I am afraid whether I can realize it given a restricted budget.... – Sathees Jun 11 '15 at 22:21
• @Sathees - 1. Yes, a single 5 volt supply is all you have. An LF356 won't work. Go buy a +/- 15 volt supply on eBay. 2. A lock-in amplifier can be done with an op amp and a FET, so money shouldn't be a real problem. But you must be able to send the modulation signal both to the LED and the lock-in amp. That pretty much says your LED and detector must share the same housing, or at least run a pair of wires between them. – WhatRoughBeast Jun 11 '15 at 23:28
• @ WhatRoughBeast- I was planning to make use of 4xAA batteries (6v all together)as power source...is there any OPamp you might recommend suited for this specific circumstance? 2. ok – Sathees Jun 11 '15 at 23:34
• I'd recommend using 8xAA batteries and making +/- 6 volts. Then use an LF356. Plus, if you look at the amplifier circuit you were intending to use, you should have noticed that the diode is connected to a - voltage, not ground. – WhatRoughBeast Jun 11 '15 at 23:51
• Reading the datasheet of LF356 I agree with you that I have to use a 12V for that opamp. ...howvever is there a recommendable one for 6 V (+/- 3V)??....since 4xAA is more handy for my purpose – Sathees Jun 12 '15 at 8:02

You could modulate your LED by driving it at a particular frequency (20kHz for example).
Then instead of just looking for a simple on/off signal from your photodiode, you look for that particular frequency instead.

• If you choose 36kHz, you'll be able to use prebuilt modules, with a filter in them; they are widely in consumer electronics. – ilkhd Jun 11 '15 at 19:35
• Here is the same problem discussed in the other answer - the sunlight will just saturate the photodiode, and the frequency will be indistinguishable from the noise. – Eugene Sh. Jun 11 '15 at 20:20
• @EugeneSh. probably with a modulation the problem is more manageable. Although full saturation will break the scheme here as well, if the diode doesn't completely saturate, the background daylight will only amount to a DC component of the photocurrent, which you could easily filter out. Of course huge amounts of sunlight will overwhelm any small signal, as a thunderstorm overwhelms the buzzing of a bee. – Lorenzo Donati -- Codidact.org Jun 11 '15 at 20:25
• @brhans Thx for you tip! .. the light source I was planning to make us of is a torch light where I will embed a programmed attiny 85...using attiny 85 I should be able to modulate the LED to 20kHz, right?? – Sathees Jun 11 '15 at 22:12

As the light source (white / blue LED) has the known emission spectrum, you can tell which wavelengths do not present there. So here is the idea: TWO photodiodes. One is detecting the "wanted" wavelength, and one is detecting the "unwanted" wavelength (the one that present in the daylight, but not in the LED). A little logic, and you are able to distinguish between the two.

Update:
I will enhance it with a more formal explanation:

Suppose that we have an LED emitting wavelengths in a range(or set) $L$. The sunlight is emitting in the range/set $S$. We can safely assume that $L\subset S$. So having photodiode $P_1$, sensitive to both $L$ and $S$, and having a photodiode $P_2$ sensitive to a set $D$, which is $D\subset S\setminus L$ (i.e. the spectrum which is a part of the sunlight but not of the LED), will allow us to make these conclusions: $$Sunlight\_detected = P_2$$ $$LED\_detected=P_1\wedge \lnot P_2$$
Of course, this logic won't be able to detect the case the LED is on and the sunlight all together, as the sunlight will defeat the LED.

• I don't know how much reliable such a system would be, since sunlight has a very wide spectrum (from far infrared, to far UV). I doubt there are LEDs that can emit spectral components that are not present in sunlight. – Lorenzo Donati -- Codidact.org Jun 11 '15 at 19:28
• @LorenzoDonati You have misread my proposition. We don't want an LED which won't emit the components of sunlight. We want a photodiode that will detect the components of sunlight, which are not the components of the LED. – Eugene Sh. Jun 11 '15 at 19:30
• mmmh. I'm not sure. Maybe I formulated my objection not so clearly. The problem I see is that once sunlight hits the device, hence both photodiodes, both will have their photocurrent increased. Of course the one which is also sensible to the LED will have a slightly higher photocurrent, but I fear the difference won't be much higher, unless the amount of sunlight reaching the diodes is small, or the luminous flux from the LED that reaches the photodiode is big. I fear that in practical cases most of the photocurrent will be due to the background sunlight.... – Lorenzo Donati -- Codidact.org Jun 11 '15 at 19:45
• ... In other words I fear the difference in photocurrent between the two photodiodes will be very small (I admit it's just a gut feeling), so it would need some very low-noise differential amplifier to be reliably detected. – Lorenzo Donati -- Codidact.org Jun 11 '15 at 19:47
• @LorenzoDonati See the update, I hope it will clarify what I mean. – Eugene Sh. Jun 11 '15 at 20:01

What I've done in the past to solve this exact problem was essentially to use a kind of waveguide. It wasn't fancy, just a cover around the LED and a cover around the receiver so that only light that was very directional could get to the receiver and thus, only light produced by my LED was received strongly enough to matter. I also used infrared LEDs. They worked well up to about 20 inches apart. I think I also modulated the LED, but I can't recall what frequency I used.

• what kind of material have used for the cover? – Sathees Jun 12 '15 at 7:19
• I didn't pick it out, but it was some kind of black hard plastic. – JonS Jun 14 '15 at 1:17
• I thought that black color might have absorbed light so I thought of alu foil... – Sathees Jun 14 '15 at 21:20
• Sure, the black absorbs the light that hits, but it's not going to absorb the light that's going down the open tube, that's the point. – JonS Jun 15 '15 at 2:45