# The right way? - Photoresistors

I'm helping out some first-year engineering students with a project. They need some falling cans counted. The idea is to use 3 photoresistors (1 for each type of can, in different sections) that have a red laser shining on them.

My question conerns proper wiring.

So far, my design has 3 wires tied to the 5V output pin. These three wires each lead to their own current-limiting resistor, and then to their own photoresistor. Then, each is tied to its own analog pin.

Details: - 5V to each photoresistor/resistor. - Photoresistor claims to vary from approx. 1kOhm - 10kOhm - Photoresistor claims to have a max power rating of 100mW, or 0.100W

Progress: - Assuming 5V on the photoresistor, I calculated a max of 20mA across it (10mA to be safe?)

Questions:

• Is it right to have a current-limiting resistor?
• Is my wiring correct? (5V -> Current-limit-resistor -> photoresistor -> Analog pin)
• Does anyone know the max current that an analog input can take?

I seem to recall something said about inputs being in a high-impedance state. In view of this, a current limiting resistor would not be needed, correct?

I feel like I'm forgetting to involve ground somehow. Actually I'm not sure on the wiring at all :(

Can anyone help with this? Much thanks!

Note: I am actually new to this. I still do not have an Arduino in my hands though! Soon enough.

-Nic

Is my wiring correct? (5V → Current-limit-resistor → photoresistor → Analog pin)

No
5V → Current-limit-resistor → analogue pin → photoresistor → ground.

Is it right to have a current-limiting resistor?

Yes but it is mainly to act as a potential divider not a current limiting resistor.

Does anyone know the max current that an analog input can take?

Silly question, you don’t feed current into the analogue input it is a very high impedance, a current limit for the input doesn’t make sense.

No. 5V -> Current-limit-resistor -> analogue pin -> photoresistor -> ground.

Hmm, okay. I see how this makes sense now, thank you! I suppose the other resistor is not even needed then?

Yes but it is mainly to act as a potential divider not a current limiting resistor.

Makes perfect sense given the above layout. Even so, can it be eliminated? It does not make sense to me to keep it there.

Silly question, you don't feed current into the analogue input it is a very high impedance, a current limit for the input doesn't make sense.

I realize this with more clarity now (cleared up my question about if inputs have high impedance)

If you meant LDR (light dependent resistor), it's not a diode, just heavily doped semiconductor (not doped oppositely on two ends, just unifoumly doped like a thermistor).

Here is how to hook it up just like a thermistor:

http://liudr.wordpress.com/2011/02/10/measure-temperature/

Just warning you, the photo resistor is not very fast. An infrared reflective photo gate with photo transistor is possibly the best way since the cans will be highly reflective and you don't need to adjust the laser or connect separate wires to power them.

Just warning you, the photo resistor is not very fast. An infrared reflective photo gate with photo transistor is possibly the best way since the cans will be highly reflective and you don't need to adjust the laser or connect separate wires to power them.

Thanks for that article! Cleared things up a bit - I usually stop understanding things once semiconductors are involved.

That's the way I originally wanted to go, but one team member decided to blow most of the budget on overpriced parts... Although, if you know any cheap, similar (or exactly the same) solutions, I'm open to recommendations!

I've worked with these... LDR's I suppose? before. They -should- respond fast enough, I'm hoping. If nothing else, I'll see if I can get them to somehow slow the cans as they pass through the beam. I have some IR photogates, but they're a solid unit that I do not wish to cut apart (I may use them in a different project). The gap is a bit small to be reliablt usable, even if the cans are crushed.

I'm aware they aren't diodes, but to be honest I did not know what they were called :)

Could you explain to be why the 10kOhm resistor (in the article) is needed?

Thanks very much!

The resolution of the voltage divider reading throught the analog to digital converter is best if you have your resistive sensor matched (same value) to the fixed resistor. In my example, my students were using 10KOhm thermistors, which is 10KOhm at room temperatures. The temperatures they measure are around 25 DegC, or room temp. So to maximize accuracy I chose 10KOhm for them. For LDR, it's not an issue since you just want block-unblock instead of exact analog values.

With this sensor: http://www.sparkfun.com/products/9088

It will be around 1KOhm for light and more than 10Kohm for dark so I might just choose 3K3 or 3Kohm in series, 10^0=1, 10^0.5=3.2, 10^1=10. I was just shooting in the middle.

liudr: With this sensor: http://www.sparkfun.com/products/9088

It will be around 1KOhm for light and more than 10Kohm for dark so I might just choose 3K3 or 3Kohm in series, 10^0=1, 10^0.5=3.2, 10^1=10. I was just shooting in the middle.

Curiosity strikes.

I see for a halfway value, you used a logarithmic scale (not logarithmic technically, but let's run with it?). Why is that? My first instinct was to just pick around 5kOhm with that sensor. Feel free to use a very technical, mathematical explanation if needed.

Thank you for that nugget of information.

From a derivation I did sometime ago, the error bar of the resistance value from such a voltage divider is proportional to (algebraic average resistance/ geometric average resistance)^2.

If the range of variable resistor is 10K to 1K depending on light, then I just want my error bars to be similar around 1K and 10K. If I do 5K fixed resistor then:

(1K+5K)^2/(1K*5K)=7200 large error bar near 1K (10K+5K)^2/(10K*5K)=4500 smaller error bar near 10K

If I do 3.2K

(1K+3.2K)^2/(1K*3.2K)=5500 small error bar near 1K (10K+3.2K)^2/(10K*3.2K)=5400 same small error bar near 10K

I was trying to do something not very necessary.

Here if you are in for a math headache :)

http://liudr.files.wordpress.com/2011/03/resistor-sorter-theoretical-error.pdf