Go Down

Topic: Question about reading analog value from photo resistor. (Read 449 times) previous topic - next topic


Why can I not put one end of the photo resistor in the 5v pin and the other in A0 and use analogRead(A0) to detect a change of light intensity? From where I have looked online, there are always a 1k Ohm resistor between 5v and the photoresistor and a wire going to A0 from between the resistor and the photo resistor.


This is because the analogue inputs only measure voltage not current. You have to turn the resistance change into a voltage change so it can be measured by passing current down it and turning the current into a voltage by passing it through a current sensing resistor. That is what the 1K resistor is.



Any resistor with current passing through it will develop a voltage across it. It is called ohms law. The voltage produced can be found by multiplying the current in amps by the resistance in ohms to give the voltage in volts. It is fundamentally how electricity works.


Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter


Voltage Divider

The 1K is one resistor and the LDR is the other resistor.  As the LDR changes resistance in different lighting the voltage between them changes. 
Ad hoc, ad loc, and quid pro quo.  So little time - so much to know!  ~Jeremy Hillary Boob Ph.D


I think the OP is falling for the classic beginners error in thinking that a resistor when connected to a power supply at one end and nothing at the other end produces a voltage drop, it does not.

Take your multi meter (and if you haven't got one then you should not be doing electronics) and connect a resistor to 5V. Then measure the voltage between the other end of the resistor and ground. You will see it measures 5V no matter what the value of the resistor is.



E = I x R | E = Voltage (V), I = current (A) and R = resistance (ohms)

There can be no voltage drop across the resistor if there is no current.
There can be no current if there is no return to ground.
If 5V is connected to one side of the resistor and ground to the other side, there is a return path to ground resulting in current flow based on the Electromotive Force "E" , known as "Voltage" to you. No return path, no current.
Google "Ohm's Law"
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131