Color Mixing Lamp Voltage Divider

So I have a book called "Arduino Projects Book" that contains a project called the Love-O-Meter. The project has three photoresistors on the breadboard that are in series with a 10-kilohm resistor that's connected to the ground. Now the analog read is placed between the two resistors. The book states "the voltage at the point where they meet is proportional to the ratio of their resistances, according to ohms law". Now if I have the the analog reading that voltage, wouldn't the voltage be really low? So when I get a number between 0-1024 wont the numbers be really low and therefore, when dividing the analogRead by 4 to get a PWM value, wont that value be super low and therefore the PMW be really messed up? wouldn't the LED be very close to 0 therefore almost impossible to hit 127 (it being set at "HIGH" half the time). it just seems unreasonable to even have a voltage divider there. Can't we just read the voltage of the resistor between 0-5V rather than lower that voltage? I don't see the point.

Hi and welcome,

blairSharpe:
The project has three photoresistors on the breadboard that are in series with a 10-kilohm resistor that’s connected to the ground. Now the analog read is placed between the two resistors.

Which two? You just mentioned four (3 photoresistors and a 10K). Are the 3 photoresistors (LDRs) in series with each other or in parallel?

blairSharpe:
The book states “the voltage at the point where they meet is proportional to the ratio of their resistances, according to ohms law”. Now if I have the the analog reading that voltage, wouldn’t the voltage be really low?

Assuming for the moment we have only one LDR and the 10K, if the light level was such that that the LDR’s resistance was also 10K, you would get 2.5V at the analog pin, and a reading of 512.

If the light level was brighter, so that the LDR’s resistance was only 5K, then you would get a voltage of 5 x 10/(10+5) = 3.3V and a reading of 682.

If the light was less bright, so that the LDR’s resistance was 50K, then you would get a voltage of 5* 10/(10+50) = 0.8V and a reading of 170.

blairSharpe:
wouldn’t the LED be very close to 0 therefore almost impossible to hit 127 (it being set at “HIGH” half the time).

Don’t understand, try re-phrasing that.

blairSharpe:
Can’t we just read the voltage of the resistor between 0-5V rather than lower that voltage?

We are reading the voltage across the 10K resistor, and it will be between 0 and 5V. What lower voltage do you mean?

Paul

Apologies Paul,

I just realized the amount of details that were confusing and weren’t clear, so I will try to restart this explanation. So what I will do is attach a picture of what my project looks like. First of all, the project is not called Love-O-Meter it is called Color Mixing Lamp, again apologies. I think I need to go back to the basics of electricity.

Assuming for the moment we have only one LDR and the 10K, if the light level was such that that the LDR’s resistance was also 10K, you would get 2.5V at the analog pin, and a reading of 512.

If the light level was brighter, so that the LDR’s resistance was only 5K, then you would get a voltage of 5 x 10/(10+5) = 3.3V and a reading of 682.

If the light was less bright, so that the LDR’s resistance was 50K, then you would get a voltage of 5* 10/(10+50) = 0.8V and a reading of 170.

This reply here is where I think we should focus on because that is where i’m a little confused. I think we should go back to basic electricity. When assuming that both the LDR and resistor was 10k ohms, why would it be 2.5V. I’m more confused on how that second resistor is affecting anything. Going back to ohms law V=I*R, how is the second resistor apart of the “R” wouldn’t just the first resistor affect the voltage coming out? Also, when doing the calculations

5 x 10/(10+5) = 3.3V

I’m confused on what your numbers are referring to. What is the “5 x 10” representing? and (10 + 5)? I’m looking at that voltage calculation in terms of ohms law, V=IR, a multiplication not division. A little confused maybe on how a voltage divider actually works. Apologies, i’m very new to this and I am very grateful for your help.

I see! Three separate voltage dividers each with one ldr with a coloured filter, feeding three analog inputs.

With a voltage divider, you can use ohms law, but there is a short cut. The voltage at the analog pin is simply the input voltage multiplied by the ratio of resistance of the ground resistor to the total resistance. The analog reading is 1023 multiplied by that same ratio.

In my example where the ldr resistance is 5K, the total resistance is 10+5 = 15, and the ratio is 10 / 15 = 2 / 3 = 0.67. So the output voltage is 5 x 0.67 and the reading is 1023 x 0.67.

If you want to use ohm's law, remember that the same current flows through both resistors (a negligeably small current flows into the analog input - is that the missing piece of the jigsaw?). You will see that the current cancels out, hence the "short cut".

wouldn't just the first resistor affect the voltage coming out

A single resistor dose not reduce voltage at all.
Ohms law tells you that you only get a voltage developed accross a resistor when current flows through it. With a single resistor the voltage across it is always the voltage across it, there is no change.

With two resistors the voltage across one of them is proportional to the ratio of the two resistors.

Okay that makes sense. but,

n my example where the ldr resistance is 5K, the total resistance is 10+5 = 15, and the ratio is 10 / 15 = 2 / 3 = 0.67. So the output voltage is 5 x 0.67 and the reading is 1023 x 0.67.

Wouldn't the ratio be 5000 ohms/(5000+10000) = 0.33 and then therefore 5 * 0.33 = 1.65 V? I do understand though. Thank-you for showing me that neat trick. I will derive that equation you showed me from Ohms law and see if that will help to see the cancellation of current.

A single resistor dose not reduce voltage at all.

I'm sorry I'm a little confused on this idea. How does the resistance not change the voltage? Ohms law V = I * R, the voltage is affected by the resistance there is? Again, I'm sorry I only have background of grade 11 physics electricity.

Btw, both of your help I am very grateful for. How do I give karma?

blairSharpe:
Wouldn't the ratio be 5000 ohms/(5000+10000) = 0.33 and then therefore 5 * 0.33 = 1.65 V?

You generally/conventionally measure voltage versus ground. The Arduino's analog inputs measure the input voltage versus ground. It is the 10K that is connected from the analog input to ground (looking at your pics), so its the voltage drop across the 10K that gets measured. If you connected the 10K from +5V to the analog input and the ldr from the analog input to ground, then you would be right.

blairSharpe:

A single resistor dose not reduce voltage at all.

How does the resistance not change the voltage? Ohms law V = I * R, the voltage is affected by the resistance there is?

With a single resistor connected from +5V to the analog input, and nothing between the analog input and ground, then (almost) no current will flow. Therefore the voltage drop across the resistor will be (almost) zero and the analog pin will see a voltage of (almost) 5V.

blairSharpe:
Btw, both of your help I am very grateful for. How do I give karma?

Don't think you can until you reach a certain number of posts. Not sure how many. Once you have, you will see little green "+" icons next to member's names.

Tell you what, I'll give you one karma now (you have been a good student). Maybe that will enable you to do it.

How does the resistance not change the voltage? Ohms law V = I * R, the voltage is affected by the resistance there is?

If you have a resistor and you connect one end to a voltage source, the voltage on the other end of the resistor is always the same as that source, irrespective of what the value of the resistor is. This is because no current is flowing through it because there is no voltage (potential difference) across it.

If you take the other end of the resistor to ground then it will have a current flowing through it, but the voltage across it will be the same voltage as your source. If you change the resistor value then you will change the current through the resistor but the voltage across it will still be the same so V is still = I * R, but I changes with R not V.

Okay so I looked up the voltage divider equation being derived on this Arduino site and I completely get it now. So I want to thank all of you for your input.

Have fun Arduinoing all. :slight_smile: