0

I am wondering why should I put a 10K resistor with an LDR.

If I put a "stronger" resistor with another resistor (in this case the LDR), I'd get a lower voltage, and then I'd, too, get a lower value in the analogRead(). I'd like to know in what I'm doing wrong. Can someone help me?

  • Can you draw a schematic of how you've connected everything? – CharlieHanson Oct 3 '15 at 14:40
  • 1
    LDR have a changing resistance, relative the the amount of light. The arduino can't measure resistance, only voltage. So one way is to create a voltage divider. One resistor will be the LDR, the other one will be a fixed value resistor. To value of that resistor depends on the typical resistance of the LDR, the light-level range you'd like, power consumption, and other factors. I don't see why you think you are doing something wrong. With a higher value resistor, you get more precision in dark conditions. (try swapping the resistor an LDR). – Gerben Oct 3 '15 at 19:34
1

LDRs themselves come in a considerable range of resistances. Search LDR specs and you will see what I mean. For example, from eBay I found one:

Bright Resistance(10Lux)(KΩ):20-230

Dark Resistance: 2 MΩ

This particular one, for example, seems to range from around 20k to 2M ohms. A reasonable series resistor would then seem to be somewhere in the middle of that range, otherwise all your readings would be skewed at one end of the scale.

For example, in this case if you used 10k and the LDR had 20 k resistance in very bright light, then the voltage would be 3.33 V

20000 / (20000 + 10000) * 5 = 3.33 V

Then if it got slightly darker and the LDR was 230 k, you would get:

230000 / (230000 + 10000) * 5 = 4.79 V

And if it was really dark you would get:

2000000 / (2000000 + 10000) * 5 = 4.98 V

You can see from those figures that you will never get a reading less than 3.33 V with this particular LDR and a 10k resistor. Thus a higher value resistor would give you a better range of readings.

However this totally depends on what resistance your particular LDR has.

  • Ok Nick, but I can't understand why a higher resistor gives a higher voltage than a weaker one. Like, if I put a 300 ohms resistor in the place of this 10k resistor I get a minor voltage, and wouldn't have to be the reverse? A higher resistor "returns" a minor voltage and a weaker resistor returns a higher voltage? – Nickolas Carlos Oct 4 '15 at 0:09
  • 1
    It depends on the order of the resistors, basically. If the LDR is R1, and the fixed resistor is R2, you will get an opposite effect than if they are the other way around. You are sampling in the middle, after all. – Nick Gammon Oct 4 '15 at 1:04
0

After you check the LDR specification you can use an online Ohm's Law calculator and calculate the resistance you need. Be sure the power rating of the resistor is greater then what is shown. Less it will smoke more is good but size is also important.

Gil

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.