AnalogRead from a photodiode circuit induces periodic error

Hi,

(First of all, sorry for the approximative english translation)

I have made a circuit in order to get the luminous value of a photodiode, the most basic circuit in that case : |500x261

The measure (Mesure analogique) is made by pin 11 on an Arduino MEGA board, I average the value on 10 measures done with a delay of 20ms between each, everything works fine, except that every 6 seconds (5.7s more precisely), there is an increase of the value read, and measuring the input with a voltmeter, that's actually the voltage that increases on the electronic board.

But I can't understand the origin of this instability. It is periodic and acurate, goiing smoothly from 0V to 0.1V then goes down, in about 2 seconds.

I search quit a bit on the internet, and I couldn't find any clue about it, does anybody have an idea what may be the origin of that ? I just checked, it's not due to an instability of the 5V supply nor from the ground.

Thanks in advance ! See you !

Baltazar

Actually, I may have found a similar post, I'll try first to check that.

Thanks to anybody who would have considered my pb ! =)

The answer were here indeed : :roll_eyes: http://forum.arduino.cc/index.php?topic=205799.0

So incase it may help anybody, the problem was probably due to the input resistor, of about 100MOhms, that once compared to my input resistor of 3.3MOhms, induced trouble in the measuring capacitor or so.

One possible solution i found was to measure MORE often, that induces an offset, but way more constant that the previous variation. I add on that a correction to set the black value to 0V.

I' m only wondering if it might be harmful for the eqquipment itself. If the board dies I'll say so here :smiling_imp:

See you guys !

A common "fix" is a capacitor from input pin to ground. Could slow things down a bit, so maybe not the best option if you want to measure fast light variations. Try 1n if speed is important. 10-100n if speed is not important.

Reading more often is not making any difference to the life of a micro. Leo..

The accuracy of your analogue to digital conversion depends on the stability of the voltage reference used by the MEGA but also by the power supply for the photodiode.

You can choose to use the internal or external voltage references (the EXTERNAL 3.3V is quite stable). Read this page.

If you use the 3.3 V (EXTERNAL), you must connect the 3.3 V pin to the AREF pin.

add "analogReference(EXTERNAL);" to setup

You must power the photodiode with a very stable voltage, as the photodiode will not draw much current you can also use the 3.3 V to power the photodiode.

Any variation of VCC (in your wiring diagram) will influence the measurement.

The biggest problem here is the 3.3Meg impedance seen by the A/D converter. The datasheet recommends 10k or less. A capacitor gives the A/D a more "solid" voltage to sample from. Leo..