Sensor – Photodiode

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:

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.

  • 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).


Ps. On a scope you can see that TL lightling is very pulluted, you might add a capacitro to smoothe things out: