Using Photodiode to measure the light - voltage measurement isnt working

Hi guys, I am relatively new. I am trying to use a photodiode ( 2 pins) to read a voltage depending on the amount of light hitting the photosensitive surface. I have tried to use various examples on the internet.

The photodiode I am using is the OSD15-E. Its nothing crazy and im using it because it has a peak sensitivity in the visible range which is what i want. Both legs are the same length, but i think i know which the cathode/anode.

What ive tried so far is connecting anode to ground, 5V to the cathode and a resistor which connects to the 5v and the cathode. I then have a wire connecting the cathode (which has 5v and resistor to it) to the analog pin 1. Its essentially this.

The easier one on the left.

I upload the code:

void setup()
{
Serial.begin(9600);
Serial.print();
}

void loop ()
{
int lightsensor = analogRead(A1);
float voltage = lightsensor * (5.0 / 1023.0);
Serial.print(voltage);
Serial.println();
delay(2000);
}

Essentially what i get it one constant value on my serial monitor. The value depends on the resistor i use and ohms law.
I measure the voltage drop across the resistor and whatever is left shows up on my monitor. i.e. if its 4.3 V over the resistor. Ill have 0.7 continuously coming up on my screen.

It does not vary light - so im just confused

Any help would be much appreciated.

MrDropsy

1 Like

You have the photodiode backwards, so it is conducting current like an ordinary diode, with a voltage drop of about 0.7 V.

You have the photodiode backwards, so it is conducting current like an ordinary diode, with a voltage drop of about 0.7 V.

When i change it around so the cathode is now ground ....my serial monitor just reads 5V all the time - light still has no effect on it.

1 Like

Both legs are the same length, but i think i know which the cathode/anode

The cathode should have a "flat" on the flange.

led.jpg

1 Like

This is the data sheet for the photodiode'

this image shows the legs to be different lengths, but mine isnt.

On the side which i think is the cathode is a flat tab.

But ultimately it doesnt matter which way i put the photodiode, the voltage measurement is not changing.

the voltage measurement is not changing.

Maybe it's not the part number you think it is: perhaps it's not working in the visible spectrum as you thought. Try it with a tv remote or some other IR emitter.

The photodiode works totally fine by itself. If i take out the photodiode and have it independent from everything else, i can put a meter across the legs and obtain a voltage of about 0.3V. THis makes sense as it in ambient light.. I then shine a high intensity light at the photodiode and it goes up to about 0.6 V. Clearly it is working as a photodiode, but not while its in my small circuit.

also if i cover the sensor the voltage just drops out to zero as expected

I think the problem is that the arduino analog input is just not sensitive enough to detect the difference on your photodiode. The input impedence expected for the ADC would usually be measured in Ks, not Megs. I think you're going to need an opamp.

Try using the 1.1V internal reference. analogReference() - Arduino Reference

Riva:
Try using the 1.1V internal reference. analogReference() - Arduino Reference

This is a good idea, Assuming the voltage divider is left as is, (on the 5v) then the reading would have almost 5x the sensitivity.

The photodiode works totally fine by itself. If i take out the photodiode and have it independent from everything else, i can put a meter across the legs and obtain a voltage of about 0.3V. THis makes sense as it in ambient light.. I then shine a high intensity light at the photodiode and it goes up to about 0.6 V.

OK, the photodiode is working in photovoltaic mode -- in that case the end connected to the negative probe of the multimeter is the banded end of the diode (the cathode). The photoinduced current flows in the opposite direction of the diode symbol.

Why not just use the photodiode in that mode, with a 1.1V reference? Connect the banded end to ground and the other end to the Arduino input. I suggest to add a 100 nF capacitor in parallel to the photodiode to lower the output impedance for the ADC. You should try a ~ 10 megohm resistor across the diode, depending on the lighting conditions.

Hi guys, thanks for all of your suggestions!

I will be sure to try some of the stuff you guys have said

WIthout trying what you all said i have actually managed to get readings.

It is interesting however because in ambient light, i get a reading of 1023 or 5v - but when i shine light on it it goes down.

So its like working the opposite way - im pretty new to this kind of stuff and really dont understand whats happening there

Im not also not really sure how to do the 1,1V reference thing - if someone could give me some steps to do that, that would be fantastic

MrDropsy:
Im not also not really sure how to do the 1,1V reference thing - if someone could give me some steps to do that, that would be fantastic

void setup()
{
//unremark as applicable :)

//IF YOU'RE USING A MEGA
//analogReference(INTERNAL1V1);

//OR ANYTHING ELSE
//analogReference(INTERNAL);


}

The following is an excellent reference, with lots of tips and tricks on how to use photodiodes: http://ecee.colorado.edu/~ecen4827/hw/hw1/PhotodiodeAmplifers.pdf