2
\$\begingroup\$

So I have bought a photodiode, which I intend to hook up to the analog port of my Arduino, so that I can measure differences in the light that the photodiode picks up.

I realized, that when I don't ground the photodiode, I get a lot of mV spanning from 2600mV to 5400mV when I measure with my multimeter - Obviously, however, I cant supply my analog ports with 5.4v or possibly more, as I would destroy the Arduino.

I then tried to ground my anode with the output just before the resistor as follows:

schematic

simulate this circuit – Schematic created using CircuitLab

Unfortunately now, I get close to nothing with a 10kΩ resistor. even with 40kΩ, the output is nothing to brag about - I would at least expect something in 1000mV range, but I barely get 200mV.

What's going on here - Am I doing anything wrong?

\$\endgroup\$
2
\$\begingroup\$

A specification for accuracy is missing.
As others have pointed out, leakage current of your Arduino input pin likely limits the accuracy, especially for low-light measurements. Leakage current of the photodiode is probably less than that of Arduino, but also impacts low-light accuracy. Leakage currents are affected greatly by temperature.

If you're using analog-to-digital converter, increase the current-sensing resistor to a large value to improve sensitivity, but be aware that large value resistors, while fairly temperature-stable themselves, make temperature-variable leakage currents impact accuracy to a greater degree.
If you're only interested in light level changes, then to a first approximation you can calibrate out the offsets caused by leakage by taking a zero-light reference reading as a stored reference, and measure light-level changes from that point. A change in temperature might require a new reference reading.

Consider too the maximum light level you anticipate. This will set the maximum value of current sense resistor...as the voltage across the resistor approaches +5V, the diode's voltage decreases - your detected voltage is no longer proportional to light intensity.

A requirement for very wide-range detection (both low-light and high-light situations) might suggest switching in various values of current sense resistors. An extra I/O pin can be programmed for a logic low, or else a high-impedance state where its attached resistor is disconnected. But now leakage is from two I/O pins:

schematic

simulate this circuit – Schematic created using CircuitLab
In this circuit, high-sensitivity is achieved by programming the I/O pin to be high-impedance, so that R2 (100k) is not connected. R1 (10Meg ohm) is the active current-sense resistor. However the leakage current of the R2 I/O pin still impacts accuracy.
To decrease sensitivity in high-light situations, the I/O pin is set to be active logic low. Now you have 10Meg in parallel with 100K as the current-sense resistor.

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ Thank you for your answer! When you say setting the I/O pin to high-impedance, does that just mean that I set the output of a given digital port to be high? \$\endgroup\$ – Jeppe Christensen Dec 7 '18 at 21:56
  • \$\begingroup\$ @JeppeChristensen No, you could set that digital pin to "input" - that should make it high-Z, disengaging R2. When you want to engage R2, you'd change it to "output", and set it low (logic zero). \$\endgroup\$ – glen_geek Dec 7 '18 at 22:14
  • \$\begingroup\$ Oh! Is that whats called a floating pin too? \$\endgroup\$ – Jeppe Christensen Dec 7 '18 at 22:46
  • \$\begingroup\$ @JeppeChristensen That digital input pin will see the voltage across the 10Meg resistor. Doing this really isn't kosher...when a digital input voltage rises through half-Vcc (about 2.4V), the PMOS+NMOS buffer inside can draw a fair bit of "shoot-thru" current from Vdd-to-Vss. This current doesn't flow through R2 - you only need worry about leakage current, which is usually small at room temperature. The shoot-thru current would only be a concern if your power source is a small battery. That said, yes: a digital input pin can be considered "floating" (high-Z). \$\endgroup\$ – glen_geek Dec 8 '18 at 1:14
  • \$\begingroup\$ I've been reading your comment over and over again, and I somewhat think I understand what you are accomplishing. My novice logic, however, tells me, that when we want to increase the accuracy of the reading (high-sensitivity), we would want to pull the I/O pin low, meaning that it sort of functions as a pulldown resistor to catch potential leakage current? When you say that R2 is not connected, what exactly do you mean then? \$\endgroup\$ – Jeppe Christensen Dec 8 '18 at 2:08
6
\$\begingroup\$

You have a datasheet that references two different versions with different responses, nevertheless back of envelope calculations are...

Your photodiode (datasheet references two) has a 6.3uA or 13uA typical Isc at 100Lux. 6.3uA*40K= 252mV, 13uA*40K=520mV.
So no major surprise there...

This doesn't take into account your light source spectrum which will modify these values (see the spectral response curve).

If you want higher voltages, you will need some amplification (plenty of info on "photodiode amplifier") to get you started.

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ Thank you for your answer. In your calculation you put in 40K, what is that? - I have a few op-amps that I will try to test, hopefully, I get something out of it. \$\endgroup\$ – Jeppe Christensen Dec 7 '18 at 16:52
  • \$\begingroup\$ Your 40kΩ resistor. \$\endgroup\$ – isdi Dec 7 '18 at 16:53
  • \$\begingroup\$ Oh, my bad. :-) Instead of going the Op-amp way, wouldn't I then just put in a 100 megaohm resistor? \$\endgroup\$ – Jeppe Christensen Dec 7 '18 at 16:55
  • 2
    \$\begingroup\$ Only if your analog port has an input impedance of much greater than 100 megohms. Which it doesn't. The input impedance appears in parallel with your sense resistor (10k or 40k). It is probably about 1 megohm or so, so it doesn't affect readings with a 40k resistor, but it will be the limiting factor for very large resistances. \$\endgroup\$ – WhatRoughBeast Dec 7 '18 at 16:58
  • 2
    \$\begingroup\$ Accurately reading a source with a 100M\$\Omega\$ output impedance is getting into pretty sophisticated electronics. You're certainly not going to be able to just plug it into an Arduino pin and have it work. Find a suitable photodiode amplifier circuit, use that. \$\endgroup\$ – TimWescott Dec 7 '18 at 16:58
2
\$\begingroup\$

As pointed out in another answer, the configuration you have will saturate (no voltage across the diode) and cause non-linearity at full scale.
You don't describe your application at all (light value range) so it's hard to divine an answer.

For example, Let's assume you are going to be sensing in the range of 1-10k Lux (See here for ranges/scenarios). At maximum Lux level you'd expect the S1223 to pass about 6.3mA at full scale. You want that full scale to be either 5V or 3.3V depending on the Arduino you are using. You need to be able to adjust your full scale setting (calibration) but are limited to the resolution of the A/D for the low end of the scale (about 6uA/LSB). You also here run into leakage currents for the A/D input that may dominate a reading on the very low end.

You also need to ensure that there is a reasonable voltage across the photo diode to prevent no-linearity, so driving the diode from the same supply as your MCU is not going to work well.

Assuming you are driving the Arduino from Vin and not from the MCU VCC level, you could do the following:

schematic

simulate this circuit – Schematic created using CircuitLab

Assuming a 5V Arduino and a Vin of 9V or greater, the above will ensure that you don't exceed the A/D voltage yet always have at least 4V across the photo diode.

|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

This is pretty basic.

Your DMM is 10 MΩ input which shunts the low current into a higher voltage instead of 10 kΩ. Since 10 MΩ is 1k bigger than 10 kΩ, so is the voltage yet the same power P = VI.

Depending on your experiment and desired dynamic range of voltage, change the value of R1 to obtain the desired conversion of PD from I to V. (conversion factor is just Ohm's Law V=IR). Perhaps 100k to 1M is more suitable.

Panasonic makes an inexpensive 5mm radial "Light sensor" that compresses the range with a log scale so >4 decades of light input from near dark to bright sun gives an output to 5V output with a selected R-value to choose your optimum input light range.

The sensitivity, S for Silicon, is 0.6 A/W at λ=λp with a declining sensitivity from IR towards blue. This is the same as 0.6 uA/uW. The output current depends on the surface area of ~ 5 x 5 mm like a tiny PV power source.

Consider 1uA times R1 = 1Mohm * 1uA = 1V output. This simply uses the shunt resistor to convert the photon microamps * R = microvolts.

For overvoltage protection, the analog inputs are usually ESD protected with Diodes but limited to 5mA or so RMS so in bright sunlight at 100 klux, you might expect a short circuit current of 13 uA/100 lux * 100 klux = 13 mA.

To prevent this from flowing into the internal Analog port, they use an ESD-protection shunt diode to Vdd, but it is rated for only 5mA steady or so.

You can solve this in many ways to prevent Vin > 5V by PD cathode voltage drops (0.7V) from 5V or add an input series R to the Analog port from 1M shunt to 10k series.

"Shunt" means parallel or bypass.

Can you figure out my suggestions?

|improve this answer|||||
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.