# How can I understand the circuit diagram for Arduino Starter Kit Project 4? I have acquired the arduino starter kit project book, and the explanations seem at times confusing and difficult to understand.

Concerning the above circuit diagram, the book states (I am translating from French): "The resistor and the photoresistor are in series and together they divide up the voltage. The voltage at the point where they meet is proportional to the ratio of their resistances, according to Ohm's Law."

1. What does "the voltage at the point where they meet" mean? The voltage/ p.d. is always supposed to be across something, e.g. a certain component. This statement makes no sense to me at all.

2. The above misunderstanding leads on to me not understanding what the input pins A0-A2 actually receive. I understand that they receive a voltage, but don't know across what. Also, if the voltage inputs from these pins are used later on, are they digital? (these pins have an analogue-digital converter).

The important thing to remember, which will help you understand everything else, is that voltage is measured with respect to another point.

In this (and almost every) case it is measured with respect to ground. So when you say the voltage at point X is Y volts you are actually saying that the difference in voltage between point X and GND is Y volts.

So on your schematic A0 measures the difference in voltage between it's IO pin (the junction between the 10KΩ resistor and the LDR) and ground. And looking at it, what is between its IO pin and ground? The 10KΩ resistor. So it is actually the voltage across that resistor that you are measuring.

Doing the sums:

Assume there is enough light falling on the LDR to make it have a resistance of 5KΩ. Current flows through both the LDR and the 10KΩ resistor in series, so it has a total resistance of (10,000 + 5,000) 15KΩ. With 5V across the whole lot (5V -> LDR -> 10KΩ -> GND) you get:

``````I = V/R = 5/15,000 = 0.000333... or 333µA.
``````

333µA flowing through 10KΩ drops how much voltage?

``````V=RI = 10,000 × 0.000333... = 3.333...V
``````

So A0 would be measuring 3.333V at that point.

Now, you turn out the lights, and the resistance of the LDR rises to, say, 50KΩ. What happens to those sums now? Well, let's look:

``````Total resistance = 50,000 + 10,000 = 60,000Ω
I=V/R = 5/60,000 = 0.00008333...
V=RI = 10,000 × 0.00008333... = 0.8333...V
``````

The formulae can be simplified into just the ratio of the two resistances:

``````           R2
Vout = --------- × Vin
R1 + R2
``````

So that is, with the lights on:

``````        10,000
Vout = --------- × 5 = 0.666... × 5 = 3.333...
15,000
``````

And with the lights on:

``````        10,000
Vout = --------- × 5 = 0.1666... × 5 = 0.8333...
60,000
``````

From that measured voltage, of course, you can then calculate what the resistance of the LDR must have been at the time. Rearranged the formula looks like:

``````      R2 × Vin
R1 = ---------- - R2
Vout
``````

Plug in the numbers for the voltage with the lights on:

``````      10,000 × 5              50,000
R1 = ------------ - 10,000 = -------- - 10,000 = 5,000Ω
3.333...              3.333...
``````

The kind of circuit is known as a Voltage Divider or Potential Divider and you can read more about them here: https://en.wikipedia.org/wiki/Voltage_divider

1. I think what it means is that A0 = (5V / (Photo Resistor + 10K)). Since the Photo Resistor will vary the voltage you get at A0 will be proportional to the light. So by rearranging the formula above (I'm no good at doing that so you are on your own) you can convert the number received by A0 into the resistance that the photo resistor as applying and presumably turn that into Lux (?).

2. The analog pins report a number between 0 and 1023. I can never remember if this equates to receiving a voltage of 0 - 5V or 0 - 2.5v. Either way it is a linear conversion, so you can use (5V/1024)*reading to work out what the voltage at the pin is (or (2.5C/1024)*Reading).

Hope that helps.

The analog inputs of the arduino can't read resistances. They read voltages and compare them with a reference voltage. They give you a number between 0 and 1023 so the read voltage is 1/1024 of the reference voltage.

The configuration of the LDR and the resistor is called a voltage divider. It is needed to get a voltage that the analog pin can read.

The intersection of the LDR and the resistor is where you can measure that voltage (or connect it to the analog pin of the arduino).