Voltage controlled PWM for LEDs

Thread Starter

garch

Joined Aug 23, 2008
24
Hi,

I am interested in putting together a PWM to dim a 10M strip of LED lights. I want to control this via X10 / ZWave remote mains dimmer. This X10 / ZWave is a device that just varies the volatge e.g. 0 to 240v on the input side to a 12V switched power supply - resulting in output side that varies from 0 - 12V. What I thought of doing was using a voltage controlled PWM oscillator 555 type circuit. What I would like to do is increase the duty cycle based upon the 0 - 12V input reference voltage so that I can drive the array of LEDs ie as the input reference voltage increases the duty cycle increases, resulting in brightening LED array.

I have found many 555 based PWM circuits, but they rely upon a pot. How can I convert this so that I can inject my own external ref voltage to modify the PWM duty cycle?

Thanks
 
Last edited:

SgtWookie

Joined Jul 17, 2007
22,230
See the attached.

Replace R5 with your control voltage. If you need to scale it down, then you'll have to use a resistor divider network. But, it works in a simulation.

An LM339 is a quad comparator. You could use a single comparator.
 

Attachments

Thread Starter

garch

Joined Aug 23, 2008
24
Many thanks,

If I want to drive 2A worth of LEDs should I add a driver? Where should it be added in the circuit?

Thanks,
 

hgmjr

Joined Jan 28, 2005
9,027
See the attached.

Replace R5 with your control voltage. If you need to scale it down, then you'll have to use a resistor divider network. But, it works in a simulation.

An LM339 is a quad comparator. You could use a single comparator.
sgtwookie,

Shouldn't the two comparator inputs be swapped. I am used to seeing the feedback into the positive input rather than the negative input.

hgmjr
 

SgtWookie

Joined Jul 17, 2007
22,230
Garch,
Yes, you could use something like an IRFZ14 power MOSFET, source connected to ground, gate to the output of the comparator, drain connected to the cathode side of the LED array. See the attached. The schematic shows an IRF530 power MOSFET, which would also be quite suitable.

Note the simulated O-scope display at the bottom. V2 is simply a voltage ramped from 0V to 12v, to demonstrate how the output PWM changes (green trace) The cyan trace shows the hysteresis on the noninverting (+) comparator input, developed across the R4/R6 voltage divider. Note that as the charge across C1 increases or decreases to the level of the inverting (-) comparator input (yellow trace), the comparator toggles the output state. C1 has been reduced to 10nF to increase the frequency, which is roughly 280Hz.

Decreasing R4 will decrease hysterisis, but will allow for a wider PWM range. Increasing R6 will also decrease hysteresis, but noise will also increase.

Not shown is a 0.1uF bypass capacitor across the supply pins of the comparator. This is necessary for reliable operation.

[eta]
The values of C1/R7 were selected to clearly show the PWM effect in the simulation; the resulting PWM frequency is 150Hz. For use in an actual circuit, R7 should be reduced from 220k Ohms to 180k Ohms. This will cause the PWM frequency to be around 200Hz; the flickering of the LEDs should not be visible due to persistence of vision.

The LEDs in the schematic, D1 and D2, could represent an array of LEDs. You will need to calculate the values of the current limiting resistors (R1, R2) for the particular LEDs that you are using. If the application is automotive, plan on Vcc=14v.
The general formula for calculating current limiting resistors is:
Rlimit >= (Vcc - Vf_LED) / Desired_Current
where:
Vcc is your voltage supply; auto is 14v.
Vf_LED is the total forward voltage of the LEDs to be used at the desired current; typically 25mA-30mA.
Desired_Current is the current rating of the LED, or the maximum desired current.
So, if you were using white LEDs with a typical Vf of 3.8v @ 30mA in a car, you might calculate:
Rlimit >= (14v - 3.8v) / 30mA
Rlimit >= 10.2/0.03
Rlimit >= 340 Ohms
Then you need to calculate power dissipation in Rlimit.
10.2 x 30mA = 306mW; doubled for reliability = 612mW. You would need to use 1W resistors.

However, you can run more than 1 in series, and just use a single resistor.
Let's try two.
Rlimit >= (14v - (3.8v x 2)) / 30mA
Rlimit >= (14 - 7.6) / 0.03
Rlimit >= 6.4/0.03
Rlimit >= 213.333... Ohms
The closest standard value to 213.333 Ohms is 220 Ohms.
Table of standard resistor values is here; use the E24 values: http://www.logwell.com/tech/components/resistor_values.html
6.4v/220 Ohms = 29.1mA
Now we need to calculate what Wattage resistor is needed.
6.4v x 29.1mA = .186W, doubled is .372W. You would need to use 1/2 Watt resistors.

[/eta]

hgmjr,
There is feedback on the positive side via R6. This displaces the + input reference voltage to give it hysteresis, necessary to prevent uncontrolled high frequency oscillation. C1 is charged/discharged via R7. When the voltage on C1 crosses the reference voltage on the noninverting input, the output state toggles.
 

Attachments

Last edited:

hgmjr

Joined Jan 28, 2005
9,027
I see what you are saying. The trace shows that the comparator is producing the PWM squarewave as expect. I was thinking of a different topology than the one you are using.

hgmjr
 

TardyBob

Joined Sep 5, 2008
2
SgtWookie, in your attached pic I was curious what voltage you had going to your VCC I assume 5v but am not entirely sure. I am not a total noob to electronics but I don't have a lot of experience messing with circuits like this one. Any help is appreciated because I have an application this would be perfect for... and I already have all the components laying around.:D
 

SgtWookie

Joined Jul 17, 2007
22,230
SgtWookie, in your attached pic I was curious what voltage you had going to your VCC.
Good question; I should have been more clear in my schematic.
Vcc is actually 12v. For this circuit, 5v would not work properly.

A standard power MOSFET generally requires Vgs to be about 10v in order to be fully turned on. There are logic level MOSFETs which could be used such as an IRLIZ24; then the Vcc could be lowered.
 
Hey sorry to resurrect an old topic but did you ever get this working for real not just on paper? looking at how to drive LEDs for a vehicle that has dimming lights 0-12v but also has 12 always on at the source
 

TardyBob

Joined Sep 5, 2008
2
Well Tech, I actually was working on almost the exact same thing and I too have been unsuccessful in building a working circuit. Problem is I been really busy until lately and had to push this project back. I have an older car (84 Monte Carlo SS) that the dash lighting is pitiful in. My ideal circuit would allow me to use the 1MΩ dimmer that is already there to control 5v mini leds. I only need about 6 leds to light everything. So, the source would be ≈12v, variable voltage 0-≈12v and my output would need to be 5v with pwm. I imagine others would be able to adapt a version of this circuit for similar automotive apps. I could really use some help in developing this circuit as my skills in this area are limited. Any and all help is appreciated!
 

SgtWookie

Joined Jul 17, 2007
22,230
Well Tech, I actually was working on almost the exact same thing and I too have been unsuccessful in building a working circuit. Problem is I been really busy until lately and had to push this project back. I have an older car (84 Monte Carlo SS) that the dash lighting is pitiful in. My ideal circuit would allow me to use the 1MΩ dimmer that is already there to control 5v mini leds. I only need about 6 leds to light everything. So, the source would be ≈12v, variable voltage 0-≈12v and my output would need to be 5v with pwm. I imagine others would be able to adapt a version of this circuit for similar automotive apps. I could really use some help in developing this circuit as my skills in this area are limited. Any and all help is appreciated!
This is a really late reply; I missed this when you originally posted.

You would not be able to control the circuit I posted with a 1 MEG pot.

A voltage follower circuit would have to be added between the pot and the 20k resistor. This could be an opamp that had rail-rail inputs and outputs, your input going to the noninverting (+) input, and the output wired to the noninverting (-) input and the 20k resistor.
 
Top