# How do I calculate the required value for a pull-down resistor in a PWM circuit?

I'm using 74HC595 with SoftPWM to control some LED's.

When the 74HC595 is off, its outputting about 0.57v, enough to turn my LED's on somewhat.

How do I work out the value of the pull-down resistor (R1), so that the LED is completely off when meant to be, but also able to reach maximum brightness.

-
What's with C2? It's turning your PWM into a lot of heat in the transistor. – Connor Wolf Feb 27 '13 at 11:08
See Figure 11 in the CCR datasheet. – Dave Tweed Feb 27 '13 at 12:29
The LED driver boards are based on that circuit (and work well) I'm just trying to understand how I might use the same circuit with a shift register based controller. – davivid Feb 27 '13 at 12:48
The basic premise of the question, which is that R1 can solve the problem, is flawed. The OP is now just repeating himself and refusing to answer basic questions. There is nothing more we can do here except close this as not a real question. – Olin Lathrop Feb 27 '13 at 13:53
It seems like the desire is to have PWM switching, but have edges that aren't as fast as the switching device and and buffer could make them. Perhaps a productive direction would be to suggest how somewhat slower edges could be achieved without defeating the idea of PWM or wasting too much power in the switching device. – Chris Stratton Feb 27 '13 at 17:17

Your problem is that you have a circuit that must be driven by an output stage with particular properties, notably a very low voltage for a logic 0, because the capacitor must be discharged down to below the Vbe treshold of the transistor. (You probably should have mentioned your reason for this rather unusual LED driving circuit in the original question.)

You can solve your problem in (at least) two ways: change the driving circuit, or change the LED driver.

A simple (and low risk) way would be to insert a buffer between your driver circuit and the LED driver, that has the same output specs as the circuit te LED driver was originally designed for. This would keep the on/off timing intact.

You seem to prefer to improve the performance of the driver by adding a pull-down resistor. The problem here is that for this to be effective the pull-down must have a low value compared to the series resistor R2 (which is only 1k), and that it must be sufficiency high in order to not affect the voltage level for a logic 1. I don't think there is a value that satisfies both constraints. But I guess your current R2 value is way lower than it could be, so let's say swapping the values might be a good start. (better: calculate the maximum value for R2, choose R1 at 1/10, check if that does not affect the high level).

I would prefer a third approach: change the LED driver so that it can work with an input that does not reach down to 0V. A diode in the emitter lead might be sufficient: it raises the required base voltage by ~ 0.6V.

I don't know the voltage required by your LED, if it is not too high you might get by without the CCR with placing a suitable resistor in the emitter lead, thus turning the transistor into a constant current source. An extra resistor as Olin and Dave suggest might help if the LED needs more than 2 V.

-

In the circuit as you have drawn, R1 does nothing. The 74HC595 has totem-pole outputs.
As such, the output is actively driven either high or low. When QB is high, the output will source however much current is required to drive QB to ~5V. When QB is low, it will sink however much current is required to drive QB to ~0V.

I think you are not understanding how PWM actually works.
The whole idea with PWM is that you turn something on and off fast enough that the square-wave PWM signal is basically integrated by the system it is being fed into.

In the case of lighting, the integrator is your eyes.

As such, the proper value for R1 is infinite, and you need to get rid of C2 entirely.

-
R1 is used when driving the circuit from another controller, in this case it can be simply bridged. – davivid Feb 27 '13 at 11:34
As for C2, that is used to slow the rise time, and reduce EMI, as the rest of the circuit is very sensitive. – davivid Feb 27 '13 at 11:35
If you bridge R1, you'd short out whatever the "other controller" is. The only way it could ever do anything meaningful is if it somehow divides down from the source impedance, but you'd need a ridiculously high source impedance for that to be true. – Connor Wolf Feb 27 '13 at 11:36
Ad you still don't need it. Also, if C2 is just to reduce EMI, it can be much, much smaller. maybe ~1 nF. – Connor Wolf Feb 27 '13 at 11:36
Sorry misread that as r2! – davivid Feb 27 '13 at 11:36

There circuit you have makes no sense for several reasons. First, the pulldown is in the wrong place. Second, C2 will prevent the transistor from turning on and off sharply, thereby causing it to spend a significant portion of the time in-between and dissipating power. Third, what is that CCR2 thing? No, I'm not going to chase down a part number. It's your job to explain basically what it is and then provide a link to the datasheet if needed.

Here is a better way to drive a low side NPN switch from a 5V CMOS digital output:

R1 and R2 are a voltage divider, so the digital output needs to be about twice the B-E voltage in this example for the transistor to turn on. That should give you about 1 V noise immunity on the low end. The two resistors together also lower the impedance the base is being driven with, which in this example is 500 Ω. That should allow the transistor to turn on and off quickly.

Another issue is that the output of a HC gate shouldn't be hovering around 1/2 volt when low. These gates have CMOS outputs, so are rail-to-rail. The output voltage should be within a few mV of ground unless it is sinking significant current. In your case it's not sinking any current at all when low, so the output really should be effectively 0.

It might be possible to suggest better alternatives, but we need to know what you really want to accomplish. What PWM frequency? What is the max LED current? The example above is only good for about 150 mA or so.

-
The LED driver boards are made and work correctly - I'm not trying to re-design that circuit. C2 does exactly that and is needed to reduce EMI. CCR2 is the constant current regulation for the LED. – davivid Feb 27 '13 at 13:42
What I'm wondering is how I might interface it to a different controller board made using the shift registers? – davivid Feb 27 '13 at 13:43
@Daviv: You haven't answered any of the questions. If you refuse to cooperate, then all we can do is close the question. – Olin Lathrop Feb 27 '13 at 13:50
@davivid - The circuit Olin has given you is exactly the same as the circuit suggested in the datasheet. – Rocketmagnet Feb 27 '13 at 14:01
Whoever downvoted this, it would be useful to know what exactly you think is wrong, misleading, etc. As far as I can tell, everything I have said is correct. – Olin Lathrop Feb 27 '13 at 17:27