1

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

featherbits
  • 201
  • 1
  • 2
  • 8

4 Answers4

5

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.

  • 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. – John Cortex Jun 06 '21 at 12:53
1

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.

Icy
  • 2,253
  • 9
  • 16
1

@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.

john
  • 117
  • 1
  • 5
0

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).

MadHatter
  • 3,506
  • 1
  • 19
  • 45