# PWM regulated by a LDR , the darker it is outside, the darker are the LEDs

I'm doing a hobby project with an electronic panel. The panel is going to have some white LEDs under switches names. Since im going to use the panel at all times of the day I want the LEDs to be regulated, but i dont want to regulate the brightness by hand with a potentiometer. I have been thinking that a LDR will be a perfect solution for me, but unfortunetely the LDR is working in the oposite way, than i actually need it to work. Can you guys please tell me if the circuit in the topic bellow is going to work for me, or can you advice me a solution for my problem. Please help me, i have spend on this problem like a day and only what i found are arduino solutions or on/off ne555 switches.

Sumarry, I need a circuit like a PWM steered by a LDR, The darker it is outside the lower the brightness of the LEDs is. Aditionally the panel is going to be powered by a battery so energy afficency is also important.

How to adjust LEDs brightness with photoresistor?

• Please post the schematic into your question. Use the image upload button. Commented Jun 5, 2021 at 16:46

The part of the circuit which controls the duty cycle in the referenced circuit is this potentiometer:

Moving the wiper higher increases the resistance of the lower leg of the voltage divider and increases the voltage at the CTRL pin. This has the effect of increasing the duty cycle.

You can replace that potentiometer with one of the following two schemes:

simulate this circuit – Schematic created using CircuitLab

In the left LDR arrangement, decreasing light will increase the resistance of the LDR and thus increase the voltage of the CTRL pin.

In the right LDR arrangement, decreasing light will increase the resistance of the LDR and thus decrease the voltage of the CTRL pin.

So you'll want to substitute the potentiometer in the 555 circuit with the left LDR arrangement pictured above.

For the resistor, I would measure the resistance of the LDR in bright light. Then use 10 times that value for the upper leg as a starting value. You'll have to do some experimentation to find a suitable resistor value.

Note that LDRs are very non-linear devices so I think you'll find it very difficult to achieve the kind of response you want. Most LDRs are used simply to detect if there is sunlight or not (like in PIR outdoor motion lights).

I would recommend the solution given by another answer in that thread -- just use a microcontroller:

https://electronics.stackexchange.com/a/196275/95488

You can program the response to be exactly the way you want it including a minimal amount of darkness before the lights are turned on.

• Thank you very much, I will go along with your advice and make it with an arduino nano, since they are really cheap, and as you wrote I will be able to control the output as I wish. Commented Jun 5, 2021 at 18:12