1
\$\begingroup\$

My goal is to reduce LEDs brightness dynamically with LDR. Power supply is 12V car battery. LEDs are about 3V. LDR will vary from 10k to 100k.

I found out that I can use LM317 to adjust voltage. Now I do not know how to decrease voltage even more when it's dark out side (LDR resistance increases). I cannot use LDR as resistor for adjustments, because it will increase voltage when there is little or no light. I need just opposite.

I found circuits that use Pulse Width Modulation to adjust voltage with LM317, so that gives me an idea, that I can use op-amp with LDR to achieve what I want? But I am not sure how to wire this circuit correctly then.

This circuit might be right direction Problems controlling an LM317 with an op-amp

\$\endgroup\$
3
  • \$\begingroup\$ Microcontroller based solution would be the easiest. Especially if you want variable brightness instead of on/off darkness detection. \$\endgroup\$
    – Passerby
    Commented Oct 20, 2015 at 12:10
  • \$\begingroup\$ Can you share some ICs for this? \$\endgroup\$ Commented Oct 20, 2015 at 12:21
  • \$\begingroup\$ Any common micro controller will do. Good starter ones are MSP430s or Arduinos. \$\endgroup\$
    – Passerby
    Commented Oct 20, 2015 at 12:47

4 Answers 4

1
\$\begingroup\$

Find a micro-controller with A2D and PWM features - one of the PIC-12 series should do.

wire up the LDR in a voltage divider configuration to the A2D input

wire up the LED to the PWM output

Create a power supply for the micro, using the LM317 or similar to reduce the 12V to the PIC supply voltage (5V or 3.3V)

Write a program to read the LDR resistance as a voltage, and output an LED brightness as a PWM percentage

Program your micro, test and debug.

\$\endgroup\$
5
\$\begingroup\$

Possibly a little late in the day but can I introduce you to the concept of a voltage controlled current source to vary the LED's current which will be dependent on the amount of light falling on the LDR.

Current Source

In the real world, the dimming of the LEDs doesn't need to be perfectly linear with falling light levels. To get a practical and effective dimming effect with falling ambient light levels the current source method is very usable and I have actually seen this technique put to good service in a viable design.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks for using a more " true electronics" approach to this question, I too a fan of MCUs but solving all the problems with an MCU is less desirable in my opinion. \$\endgroup\$ Commented Jun 6, 2021 at 12:53
1
\$\begingroup\$

@Icy's answer is correct. The relationship between LDR resistance and LED apparent brightness is complex, nonlinear, so you'll need a microcontroller to generate the function. You'll need a second LDR to sense ambient light and feed its resistance, too, to the microcontroller.

The purchase tolerance on LDRs is wide enough that you'll need to tailor your microcontroller program for the actual parts you intend to use.

If your saying the power supply will be an automobile battery means that you intend to install your circuit in a car, think carefully about temperature. Unless you live some place with moderate year-round temperatures, the extremes go from below 0 degrees F to over 120 degrees F. LDR specifications are usually 25 degrees C, 77 degrees F.

\$\endgroup\$
0
0
\$\begingroup\$

You could use 2 555 timers or a 556 to achieve variable duty cycle based on the photo-resistor. It really could be easier to use something like an Arduino, but if you are fine with an old fashioned analog solution, try something like this:

enter image description here

If you Google 555 PWM, you will find a lot of results on this topic. Essentially the VR1 in the schematic above would be replaced with your photo-resistor. Depending on the resistance range of your photo-resistor you may need to modify some of the supporting resistors and capacitors for the Monostable stage (Left IC Circuit).

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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