Photodiode to measure LED light

Thread Starter

Alexandru Chiser

Joined Feb 16, 2017
44
Hello,

I have 10 LEDs with different colors: blue, red, green, orange, yellow and each LED has a different Imax: 2mA, 5mA, 10mA, etc... up to 120mA (the last one). The task is to get them at the same luminosity, by changing the current through the LED. This is the part when the photodiode comes in. I`ve searched all datasheets of the LEDs and the whole light spectrum is between 420 and 675 nm. This is why i chose this photodiode: BPW21R.

I need a circuit, that uses this photodiode and provides me a maximum of 3v3 output (the analog pins i`m using are 3v3 tollerant), but he whole circuit is powered by 5V. This is what i`ve found: https://www.circuitlab.com/circuit/g7t4a9/transimpedance-amp/ (I need a 3v3 maximum output)

So by applying 3v3 at the VCC of the OpAmp, the maximum output should be arround 3v3, right? Or... i can apply 5V to the VCC and make a voltage divider at the output to have a maximum of 3v3. The output of this circuit will be connected to an Analog Pin of a Teensy3.5 uC.

I will place the photodiode above 1 LED (it doesn`t matter which) and i will save the value i read on the pin. Then i`ll move the photodiode above the rest of the LEDs and increase/decrease the current untill i get the same value on the pin (an error of 5-7% is okay). The only problem is that this photodiode, doesn`t have the same Spectral Sensitivity vs. Wavelength. I need to measure the intensity of the light of different LEDs (red / blue / green / orange).

I know that this will need to be calibrated, but i don`t know how. If you have other ideas, involving a photodiode, feel free to post.

PS: the LEDs are separated by walls + ceiling, so the light from one LED or the ambiental light won`t affect the measurement on an other LED.

Thanks in advance!
 

OBW0549

Joined Mar 2, 2015
3,566
I need a circuit, that uses this photodiode and provides me a maximum of 3v3 output (the analog pins i`m using are 3v3 tollerant), but he whole circuit is powered by 5V. This is what i`ve found: https://www.circuitlab.com/circuit/g7t4a9/transimpedance-amp/ (I need a 3v3 maximum output). So by applying 3v3 at the VCC of the OpAmp, the maximum output should be arround 3v3, right?
That circuit is the right circuit, but the LM324 is the wrong op amp for use on such a low supply voltage since its output doesn't go all the way to the positive rail. You'd be better off using an op amp with a "rail-to-rail" output and guaranteed operation at low voltage. I use an LMC6482 in such situations; there are many others available.

I will place the photodiode above 1 LED (it doesn`t matter which) and i will save the value i read on the pin. Then i`ll move the photodiode above the rest of the LEDs and increase/decrease the current untill i get the same value on the pin (an error of 5-7% is okay). The only problem is that this photodiode, doesn`t have the same Spectral Sensitivity vs. Wavelength. I need to measure the intensity of the light of different LEDs (red / blue / green / orange).
You don't want to adjust the LEDs so they all give the same output from your photodiode and amplifier; you want to adjust their current so the output is scaled according to the photodiode's spectral sensitivity at each LED's dominant wavelength. From the photodiode datasheet, this is it's spectral sensitivity curve:

Untitled.png

Choosing green (565 nm) as a reference point, since that's the peak of the photodiode's response curve, note the amplifier output at whatever LED current you think is appropriate. Then with the yellow LED (590 nm), you would adjust it's current to get an amplifier output about 95% of the value you got for green. For both the red LED (625 nm) and the blue LED (470 nm), you'd adjust the current so the amplifier output is about 80% of the green value.

Using this method, you're compensating for the photodiode's sensitivity variations with wavelength to get the same light output from each LED.

Note that you'll have to experiment with different values of feedback resistor in your transimpedance amp (R1 in the circuit you linked to) to adjust the amplifier's gain to suit your particular situation.
 

Thread Starter

Alexandru Chiser

Joined Feb 16, 2017
44
You sir... deserve a medal. Thanks for explaining me how it works, and how can i easily calibrate it (using the software ofc). I still have some questions like:

1) What would be the maximum output, if the VCC of the op-amp is 5V - theoretically it should be 5V
2) Do i need a Low pass filter at the output of the op-amp for smoother response?
3) How do i calculate the Resistor and Capacitor values (the ones from the feedback and the ones from the negativ input of the op-amp)

THANKS ONCE AGAIN!
 

OBW0549

Joined Mar 2, 2015
3,566
1) What would be the maximum output, if the VCC of the op-amp is 5V - theoretically it should be 5V
For a rail-to-rail output op amp like the LMC6482 the maximum output would be very close to 5 volts, probably 4.98 volts or better. For an LM324, it would probably go only up to about 3 volts, possibly only 2 volts.

2) Do i need a Low pass filter at the output of the op-amp for smoother response?
Yes, a low-pass filter on the output (or using a larger capacitor, like 100 nF, for C2 in the circuit you linked to) will help reduce noise in your microcontroller's ADC output.

3) How do i calculate the Resistor and Capacitor values (the ones from the feedback and the ones from the negativ input of the op-amp)
You won't be able to calculate a feedback resistor value; you'll have to determine the best value by experiment.

As for C1 and R2 in the circuit you linked to, if you decide to use an LMC6482 or other CMOS op amp you can just eliminate them (i.e., just connect the op amp's non-inverting input directly to circuit ground). Otherwise, use the values given in the schematic.
 

Thread Starter

Alexandru Chiser

Joined Feb 16, 2017
44
Choosing green (565 nm) as a reference point, since that's the peak of the photodiode's response curve, note the amplifier output at whatever LED current you think is appropriate. Then with the yellow LED (590 nm), you would adjust it's current to get an amplifier output about 95% of the value you got for green. For both the red LED (625 nm) and the blue LED (470 nm), you'd adjust the current so the amplifier output is about 80% of the green value.
Why do i think it`s the other way arround? Here`s an example:

Let`s say i have a green LED and i measure (using the circuit i provided) 2V - this coresponds to a certain luminosity. When i measure the luminosity of a blue/red LED i should have more than 2V, that coresponds to the same luminosity as the green LED, because the photodiode`s response to blue/red is lower than to green...

Or... am i thinking upside-down?
 

OBW0549

Joined Mar 2, 2015
3,566
Yeah, I'd vote for "upside-down."

Suppose you have two LEDs, one green and one red, outputting exactly the same light intensity. Because of your sensor's spectral response curve, you will have only about 80% of the output when looking at the red LED than you got when looking at the green LED. So that (80% of the green level) is the output level you should adjust for if you want the two LEDs to be giving the same actual intensity.
 

Thread Starter

Alexandru Chiser

Joined Feb 16, 2017
44
Yeah, I'd vote for "upside-down."

Suppose you have two LEDs, one green and one red, outputting exactly the same light intensity. Because of your sensor's spectral response curve, you will have only about 80% of the output when looking at the red LED than you got when looking at the green LED. So that (80% of the green level) is the output level you should adjust for if you want the two LEDs to be giving the same actual intensity.
I see...

As perceived by what? The sensor or the human eye?
The human eye theoretically. I know: each one of us can see better or worse than others. But for this project, i`ll stick to the sensor. The eye perception is something relative.
 

OBW0549

Joined Mar 2, 2015
3,566
The human eye theoretically.
The graph I showed from the photodiode data sheet gives both the photodiode response and the human eye response. If you want the LEDs to all have the same perceived brightness, just set each LED current so the amplifier output equals the photodiode response (relative to green, where it peaks) divided by the human eye response relative to green (where it, too, peaks).

For example, with the blue LED (470 nm), adjust the LED current so the amplifier output is (0.8 / 0.1 = 8) times the output you get when looking at the green LED. Do that for each LED and they should then all appear to be the same brightness.

I think.
 

Thread Starter

Alexandru Chiser

Joined Feb 16, 2017
44
The graph I showed from the photodiode data sheet gives both the photodiode response and the human eye response. If you want the LEDs to all have the same perceived brightness, just set each LED current so the amplifier output equals the photodiode response (relative to green, where it peaks) divided by the human eye response relative to green (where it, too, peaks).

For example, with the blue LED (470 nm), adjust the LED current so the amplifier output is (0.8 / 0.1 = 8) times the output you get when looking at the green LED. Do that for each LED and they should then all appear to be the same brightness.

I think.
8 times? let`s say the green output is 0.5V, this means for blue it should be 4V... I still have a hard time figuring this out :(
 

OBW0549

Joined Mar 2, 2015
3,566
8 times? let`s say the green output is 0.5V, this means for blue it should be 4V... I still have a hard time figuring this out :(
Think of it logically, and in two stages:

First, we adjust the blue LED current so that the amplifier output is 0.8 times whatever it was when we set up the green LED; this reflects the fall-off in spectral response of the sensor from green to blue, and ensures that the blue LED is putting out exactly the same amount of light as the green LED was.

And last, we look at the chart and note that the human eye response at 470 nm (blue) is only one-tenth what it is for green; therefore we need to increase the blue LED current so the amplifier output is increased by a factor of 10, to compensate for the fall-off of the human eye response.

The blue and green LEDs should now have approximately the same perceived brightness.
 

Thread Starter

Alexandru Chiser

Joined Feb 16, 2017
44
upload_2018-3-26_11-24-13.png

Simulation:

- Current source: pulse from 0-90uA for 50ms

Now, the blue curve is for a feedback resistor of 150K, red for 100K and green for 50K.

As you can see, the output voltage clamps at 3v3 at a certain point, regarding the feedback resistor.

From what i see, i need to choose a resistor which gives me a full ramp from 0 to 3v3 with a current from 0 to 90uA.
 

Thread Starter

Alexandru Chiser

Joined Feb 16, 2017
44
From this graph i see that the maximum short current is 100uA, at 10^4 lx... I don`t know what illuminance my leds give. Or at least, what`s the biggest illuminance i can get, so i can properly choose the feedback resistor.

upload_2018-3-26_11-34-43.png

My brightest led has a maximum of 45lumens...

I need to determine what the maximum short current of the photodiode can be.

How do i transform lumens to lux... i`ve found some online calculators, but they require some surface...

PS: There might be a chance this photodiode won`t respond to my 5mA-20mA LEDs (they say these LEDs have arround 11 and 90mcd)

PS2: 45mcd, with a viewing distance of 10cm, equal 4.5lux... waaaay to low. But if i decrease the distance to 1cm, i can achieve 450lux - so a short current of aprox 8uA...

This means, i should measure the illuminance at 2-3 cm above the LEDs, right?
 
Last edited:

Phil-S

Joined Dec 4, 2015
238
You can save yourself a lot of grief by using an amplified photodiode in a single chip.
have a look at TSL series of light sensors (may be AMS now) - simple Vcc, GRD and volts out.
Not that much more expensive if time is important. Out of the packet, 5-volts in, job done. Infrared or visible, available in a range of sensitivities.
Attenuate the light by using a neutral filter.
 

Thread Starter

Alexandru Chiser

Joined Feb 16, 2017
44
One quick question regarding the short circuit current:

In this link https://www.circuitlab.com/circuit/g7t4a9/transimpedance-amp/ it shows 90uA and from the datasheet we can see that this represents the short circuit current. This current is achieved when both leads of the photodiode are shorted. In the circuit this short is produced by the virtual ground at the op-amp? You have the + entry connected to GND, one lead of the photodiode connected to the GND, and the op-amp makes the - entry connected to the GND also, resulting in a short. Right?
 

OBW0549

Joined Mar 2, 2015
3,566
In this link https://www.circuitlab.com/circuit/g7t4a9/transimpedance-amp/ it shows 90uA and from the datasheet we can see that this represents the short circuit current. This current is achieved when both leads of the photodiode are shorted. In the circuit this short is produced by the virtual ground at the op-amp? You have the + entry connected to GND, one lead of the photodiode connected to the GND, and the op-amp makes the - entry connected to the GND also, resulting in a short. Right?
Correct.
 
Top