1
\$\begingroup\$

It's a BJT circuit driving LEDs with a constant current and I adjust the brightness of it by sending PWM into the base of BJT.

The problem is that I can see huge overshoot of LED current right after the base voltage is turned on.

Could you help me find a solution?

Where is the capacitor supposed to be placed? Vce? Vbe?

enter image description here

\$\endgroup\$
3
  • 4
    \$\begingroup\$ can you show the huge overshoot of current and how you measured it? \$\endgroup\$ Commented Mar 3, 2023 at 13:51
  • \$\begingroup\$ You should probably try low-pass filtering the PWM to avoid massive current peaks. \$\endgroup\$
    – Andy aka
    Commented Mar 3, 2023 at 14:47
  • \$\begingroup\$ A capacitor parallel to the LED can help. \$\endgroup\$
    – Jens
    Commented Mar 3, 2023 at 20:51

1 Answer 1

1
\$\begingroup\$

The circuit you show works as shown, and it draws roughly the LED current the formulas imply. But it wastes potentially quite a lot energy unnecessarily.

To convert PWM into a roughly constant current, use an inductor in series with the load, and a second switch - eg. a diode - to keep the inductor conducting at all times. The PWM frequency scales the current ripple amplitude when the inductance is held constant: the higher the frequency, the lower the ripple. For a fixed PWM frequency, the larger the inductor, the smaller the ripple.

A minimally wasteful PWM LED driver circuit would look as follows:

schematic

simulate this circuit – Schematic created using CircuitLab

Q1 is a saturating switch. Q2 desaturates Q1 on turn-off, and improves performance when the duty cycles are small.

The current loop D1-L1-D2 should be kept small. C2 limits Q2's dV/dt and dI/dt on turn-on, and should be connected directly between the collector and emitter.

R1 and R2 are chosen to keep Q1 saturated, while consuming a reasonable current from the PWM GPIO pin.

The average LED current, given a PWM duty cycle between 0 (0%) and 1 (100%), is:

$$ I_{avg} = D.\!C. \frac{V^+ - V_{Df}}{R_L},$$

where \$V_{Df}\$ is the LED forward voltage - usually 1.5-2V, and \$R_L\$ is the DC resistance of the inductor. The inductor resistance is a trade-off between the reasonable duty cycle and losses.

A small 1mH inductor in a through-hole package that resembles a resistor would have about 10Ω series resistance.

For the 20% example, the average current would be a bit below 200mA.

\$\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.