The purpose of this circuit is to measure light intensity.
and uploaded the code below to my Arduino nano
/* Here is a bare-bones Arduino sketch to read the
outputs of the photodiode detectors described
in Figure 1 and Figure 2. The output pin of the
circuit's opamp is connected to analog pin 0
of the Arduino. The data are read every 0.1 second
in this example. However, you can change the sampling
rate by simply changing the argument of the
delay() statement. */
#define inPin0 0
void setup(void) {
Serial.begin(9600);
Serial.println();
}
void loop(void) {
int pinRead0 = analogRead(inPin0);
float pVolt0 = pinRead0 / 1024.0 * 5.0;
Serial.print(pVolt0);
Serial.println();
delay(1000);
}
The reading that I'm getting is always 0.00 I don't know why, can anyone help ?
If you wired it exactly as shown in that Fritzing diagram (one can never tell with those awful diagrams), then it should work. But make sure the photodiode is the right way around and reverse it if need be.
The standard schematic below shows a much clearer representation of the circuit, with the diode in "photovoltaic" mode.
Current flows from the photodiode through the resistor and back, in a circuit.
If you are serious about measuring light intensity, that circuit is not the way to do it. You would use a reverse biased photodiode and usually, a transimpedance amplifier.
Search the forum for many discussions and examples.
This sketch is about 5x more sensitive, and should work (tested with a common LED as sensor, and a LED torch).
If.. the burden resistor is ~100k-1Megohm and the polarity of the photo diode is right (cathode to ground).
The 5mm green LED I found on the floor, and a 1Megohm burden resistor even detected daylight inside.
A 100n cap across the LED was needed to stabilise the readings.
Leo..
The circuit in #1 is wrong, no wonder you read 0.00 all the time because you effectively connect your analog pin to the ground. You should wire it as voltage divider instead, like this image (just Googled "how to wire a photo diode"):
Photo diodes are indeed very sensitive to IR and therefore commonly used for receiving IR signals, like from a remote control or as alarm.
Even easier: get a digital lux sensor like the TSL2561, and you get an absolute number in lux right away. It also has an IR filter built in.
The circuit works just fine if I only connect the photodiode
wvmarle:
The circuit in #1 is wrong, no wonder you read 0.00 all the time because you effectively connect your analog pin to the ground. You should wire it as voltage divider instead, like this image (just Googled "how to wire a photo diode"):
Photo diodes are indeed very sensitive to IR and therefore commonly used for receiving IR signals, like from a remote control or as alarm.
Even easier: get a digital lux sensor like the TSL2561, and you get an absolute number in lux right away. It also has an IR filter built in.
I tried to wire it as a voltage divider. It kept giving me a reading of 5.00
Hi,
You are trying to use the photodiode as a voltage output device.
A photodiode is like a PV a CURRENT SOURCE.
The current is very very small, uA, you need to, as previously advised, amplify it.
In particular a Trans-conductance Amplifier to convert current to a voltage output.
With the sketch from post#8 and a common green 5mm LED (with 1Megohm resistor and 100n cap across) I got stable readings of around 50 with dim daylight (rainy day).
I assume a real photo sensor (with larger chip area) will do much better than that.
Will dig one up tomorrow (midnight here).
Leo..
edit:
With a BPW34 with 100k burdon and 100n cap across I get values of ~300 inside.
I rearranged the circuit according to what people suggested with the current resistors that I have but no luck. I'm only getting reasonable readings when I only connect the photodiode. I'll get a 100k - 1M resistor to try if it works.
Not a problem to use the photodiode without resistor across, as long as you're getting values below ~300.
A burden resistor just makes the sensor less sensitive.
Low(er) values are needed when you measure e.g. daylight or sunlight.
The 100n cap across is needed when the burden resistor is >10k (or missing),
to keep hum pickup of the wiring under control and to give the A/D someting "solid" to sample from.
Leo..