LDR voltage divider - not working as expected

As part of my first proper Arduino project (a bed-side clock) I need the brightness of the LEDs to vary with the ambient light, so that when it is bright in the room the LEDs are bright, and they reduce in intensity in the dark. So, I thought a simple voltage divider would suffice (as opposed to any PWM or transistor-based solution). So, I have a circuit like this as my testbed:

Without knowing the exact characteristics of the LDR, I think the range will go from something like a few hundred Ohms in bright light to a few million in the dark. So, I expected that placing a 47 MO resistor in the voltage divider would supply plenty of voltage (>50% of Vin) to my test LED. However, in the dark the LED goes out, and I really don’t understand why.

Any pointers greatly appreciated!

Many thanks!

You really need to get the characteristics of the LDR. Is there no data sheet for it?

When the LDR is a few hundred ohms, and using ohms law E=I*R or a variant I = E/R, I = 5/200 = 0.025 (25 mA) current which enough to drive the LED(s).

As the resistance goes up, the current goes down to the point where enough current is not present.

You could get the LDR into the Arduino and scale it such that 200 ohms = PWM 100% duty cycle and anything over, say 600 ohms = 50% duty cycle.

Or, you could use a transistor based system.

What you have will clearly not work given that the LDR rises to over many several K ohms and up.

This circuit is unlikely to work as you would like, but to characterize the LDR, use your multimeter to measure the LDR resistance as a function of light intensity.

If you don’t have a multimeter, now is the time to get one.

Many thanks for taking the time to reply, both of you. I was of course getting hung up on voltage without even considering current - newbie oversight :S

The LDR came as part of a kit, and there was no data sheet for it, nor any kind of part number. I have got a multimeter but the maximum range is 2 MO, and in darkness the LDR exceeeds that.

I will now probably go down the PWM route.

Thanks again!

Now that I think about it, a variation of your idea might work. The problem is that the dark resistance is so high that the LED won’t light, but you can reduce the effect by putting another resistor in parallel with the LDR. Try the attached circuit, adjusting R1 so that the LED is just bright enough at night.

This would probably work a lot better as a constant current circuit. A single transistor with the LED at the collector and a current feedback resistor at the emitter using the LDR and a fixed resistor in a divider at the base. I can draw a diagram if I can’t find one online.

Just wanted to let people know that I have successfully gone down the resistors-in-parallel route and it is behaving exactly as I want. Currently using a 10K resistor which gives me about 13mA in daylight and 0.5mA in total darkness - but I am happy to play around with the 2nd resistor now I’ve got (R1xR2)/(R1+R2) firmly in my head :slight_smile: I might use a variable resistor in version 2…

Thanks for all you help, guys!