Go Down

Topic: my photodiode doesn't seem to detect anything (Read 2 times) previous topic - next topic

Folderol

#5
Nov 15, 2010, 11:34 pm Last Edit: Nov 15, 2010, 11:36 pm by zaphil Reason: 1
Junction of photo diode and resistor should go to A1.
Free end (now) of resistor should go to ground.

Can't see from the picture what this resistor value is. A good starting value would be 100k.

Everything else looks OK.

You might need to play about with this value, and also the switching value obtained from the analog read.

Folderol


Jogi

Dear iridium, (and others with similar problems)

first you should know a little bit about the basics !

1.) When you connect an IRED or LED (or whatever) to an output pin of the Arduino (ATmega), you should be aware, that the current, that might flow, is within the bounds, of what the ATmega could handle !

The absolute maximum rating for the DC current of an ATmega output is 40mA (and when watching the graphs for some output characteristics, you will notice, that they all stop at 20mA !). So be aware, not to go any further.

To calculate the current (YES, you should do some calculations to prolong the life of your Arduino) through the IRED, you have to know the voltage over the IRED, when a current will go through (Sorry for my English; I'm German ...).
You will find this in the datasheet of the IRED => typ. 1.5V at 100mA.

Now you can take a look in the ATmega datasheet and you can find out, that the output voltage at 20mA will be around 0.5V at LOW and about 4.5V at HIGH.

That's all what you need: 4,5V output going to the resistor going to the IRED (which looses 1,5V here), which is connected on the other side to ground (=0V).

The current is I=U/R  - For "U" you should calculate, which voltage will be over the resistor. That is 4.5V - 1.5V = 3.0V

When looking at your picture, it seems, that you are using 8.2 Ohm resistors all over, right ? (color code: grey/red/golden/golden => grey=8, red=2 gold=multiplier 1/10 and last gold for the tolerance of the resistor (here ±5%; but don't care)).

Let's calculate the current => I=3V/8.2 Ohm = 0,366A = 366mA (uuups)

You can easily see: that's much to much for the ATmega and for your IRED (max. current=100mA continuous)  !!!
(By the way: If your Arduino would be strong enough to handle such currents, your IRED and also your LEDs will be gone - and they might be !). Your LEDs can take about 20mA; even 10mA will be enough to see them shining.

To calculate the correct resistor for the IRED you use "R=U/I"

 => R=3V/20mA = 3V/0.02A => R= 150 Ohm = brown/green/brown/gold or silver

If you want to push more current through the IRED, you should use a driver like the ULN2803 or other things to amplify the current. For your first experiments, 20mA will be a enough.


2.) To connect a photo diode or a photo transistor to the Arduino, you should know, that the input resistance of an input pin of the ATmega is quiete big (and anyway not inevitably the same at each ATmega type and might fluctuate with the temperatur and and and ...).

When connecting the photo diode directly from 5V to an input pin, this input pin will probably just go up to 5V (or whatever), as there is nearly no current flowing into the input. To get a reliable reading out of the photo diode, you have to get a little but noticable and reproducible current (for bigger currents use a photo transistor) flow through the photo diode and use the ATmega to measure this current. But: The ATmega is only able to measure a voltage, so you better let the current flow through a resistor (same what Folderol said already). That mean, that you have to connect the photo diode and a resistor in a row from 5V to 0V and put the input pin of the ATmega just to the middle (=to the connection point of photo diode and resistor). For the resistor, you have to choose a pretty big one to keep the current low enough. I don't know, what the photo diode can take or deliver, but start with less than 0,01mA. So the 100,000 Ohm or even more for the resistor are the choice to take (a lttle bit "Try and Error" is the way to go here), but never 8.2 Ohm !


3.) Take into consideration, that
a) your Arduino might be completely dead  - or -
b) might be dead on just the output pins you used  - and/or -
c) your IRED is dead - and/or -
d) your LEDs are dead.

Before you try any other things, you should clarify, which of your "toys" is still alive. If you are lucky, all parts survived, because the Arduino was very gentle to you - but don't count on that ...


Best Regards  Jogi
_______________
You haven't failed, until you've given up.

Go Up