Go Down

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

#### owentroe

##### Feb 08, 2015, 10:31 pm
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.

#### Grumpy_Mike

#1
##### Feb 08, 2015, 11:02 pm
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.

#### owentroe

#2
##### Feb 08, 2015, 11:32 pm
How exactly does the 1k resistor do that?

#### Grumpy_Mike

#3
##### Feb 08, 2015, 11:36 pm
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.

#### raschemmel

#4
##### Feb 09, 2015, 12:46 am
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

#### Delta_G

#5
##### Feb 09, 2015, 08:15 am
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.
If at first you don't succeed, up - home - sudo - enter.

#### Grumpy_Mike

#6
##### Feb 09, 2015, 08:21 am
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.

#### Paul__B

#7
##### Feb 09, 2015, 09:58 am
Almost 5V.

Best keep that in mind.

#### raschemmel

#8
##### Feb 09, 2015, 04:13 pm
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.