# Not sure how to name what this resistor is doing?

I have a basic circuit that uses a photoresistor powered by a five volt source. I had made this project to show my son about various sensors and had used a circuit I had found online. It looks something like this:

5V --- PHOTOCELL -----------------  ANALOG INPUT
|
RESISTOR
|
GROUND


The only way I could explain this, is that the resistor would provide a safe path to ground so that current would not flow in to and hurt the analog sensor (leaving just "voltage" to read from the photoresistor)

I am not sure its point is to protect it. I've looked at examples of pullup/pulldown resistors however that seems to be for preventing a logic input from "floating". It appears that it would not do so in this circuit as it is a continuous variable voltage supply.

How do I name its purpose?

-

It's not for protection, it's to form a voltage divider with the photocell.

For a typical photocell, the resistance may vary between say, 5k (light) and 50k (dark)
Note that the actual values may be quite different for your sensor (you'll need to check the datasheet for those)

If we leave the resistor out, the analog input will see 5V either way (assuming an analog input of a high enough impedance not to affect things significantly)
This is because there is nothing to sink the current and drop voltage.

No Resistor

Let's assume the sensor is connected to an opamp with an input resistance of 1 Megaohm (pretty low as opamps go, can be 100's of Megaohms)

When there is no light shining on the photocell and it's resistance is at 50k, we get:

5V * (1Mohm / (1Mohm + 50k)) = ~4.76V

When there is light shining on the photocell and it's resistance is at 5k, we get:

5V * (1Mohm / (1Mohm + 5k)) = ~4.98V

So you can see it's not much use like this - it only swings ~200mV between light/dark. If the opamps input resistance was higher as it often will be, you could be talking a few microvolts.

With Resistor

Now if we add the other resistor to ground it changes things, say we use a 20k resistor. We are assuming any load resistance is high enough (and source resistance low enough) not to make any significant difference so we don't include it in the calculations (if we did it would look like the bottom diagram in Russell's answer)

When there is no light shining on the photocell and it's resistance is at 50k, we get:

5V * (20k / (20k + 50k)) = 1.428V

With there is light shining on the photocell and it's resistance is 5k we get:

5V * (20k / (20k + 5k)) = 4V

So you can hopefully see why the resistor is needed in order to translate the change of resistance into a voltage.

Just for thoroughness let's say you wanted to include the 1 Megaohm load resistance in the calculations from the last example:

To make the formula easier to see, lets simplify things. The 20k resistor will now be in parallel with the load resistance, so we can combine these both into one effective resistance:

(20k * 1000k) / (20k + 1000k) = ~19.6k

Now we simply replace the 20k in the previous example with this value.

Without light:

5V * (19.6k / (19.6k + 50k)) = 1.408V

With light:

5V * (19.6k / (19.6k + 5k)) = 3.98V

As expected, not much difference, but you can see how these things may need to be accounted for in certain situations (e.g. with a low load resistance - try running the calculation with a load of 10k to see a big difference)

-
This is exactly what I was looking for. I was confused in that the resistor would be mainly for the current not the voltage. This is quite neat. – Transient Dec 22 '11 at 4:18
In the first set of calculations, it seems you meant to say a 200mV difference. – Mark C Dec 22 '11 at 5:30
@MarkC - Yes you're right, thanks. 5:50 in the morning here, my brain probably went to bed a while ago.. :-) – Oli Glaser Dec 22 '11 at 5:51
Some analog inputs, such as ADC pins in some uC's, have input resistances as low as 10kΩ. – tyblu Dec 22 '11 at 17:43

(1) This adds to what Oli says.

This applies if an output load is absent or is much much higher in resistance than R1 or R2 and so can be ignored.

Ohms law tells us that Voltage drop across a resistor is proportional to current I and Resistance R, so that

• V = I x R

The current Iin flows through R1 and then through R2 to ground.
As the current is common to both and is also the same as Iin we don't need to refer to I_in, I_R1 and I_R2 - we can just refer to any current as "I" as all are the same current.

So

• The voltage across R1, V_R1 = I x R1

• The voltage across R2, V_R2 = I x R2.

Rearranging these equations we can write

• I = V_R1/R1 and

I = V_R2/R2

As it is the same I the two lines are equal to each other so

• V_R1/R1 = V_R2/R2

or - V_R1 / V_r2 = R1 / R2

That is, the voltage drops across the resistors in an unloaded voltage divider are proportional to the resistors'values.

So ie eg we have 12V across a 30k + 10k divider then as the resistor values are 3:1 the voltages will also be 3:1. So the voltage across the 30k will be 9 Volts and the voltage across the 10k will be 3 volts.

This is fairly obvious once you use it enough for it to become faitly on=bvious, but is still very powerful and useful.

If Vin has internal resistance and if there is a load resistor the equations become more complicated. NOT complex and no especially hard - just more complicated. To help you while you learn, this onine calculator allows you to calculate values for this circuit:

http://www.vk2zay.net/calculators/simpleDivider.php

-
 A slight addendum to your comment about the load resistor being larger than R2: If the load resistor is large relative to R2, even relatively large changes in the load resistance will not appreciably affect measurements. For example, if R2 is 10k precisely, but the load resistance could vary anywhere from 1M to 1,000M, the load resistance would only contribute about 1% uncertainty to the net result. If one does calculations assuming a load resistance of 2M, the result will be within 0.5% for actual values anywhere from 1M to infinity. – supercat Dec 22 '11 at 16:08