# LED dimming and modulating with two PWM signals

I have a need for an LED, driven by a constant current source, that can be smoothly dimmed and also semi-rapidly (say 2.5kHz) modulated for later bandpass filtering. I've designed a possible circuit, given below. The constant current source and PWM-dimming were already familiar to me but I seem to have found the switching solution through beginner's luck.

The circuit seems to work well in Spice and on a breadboard. Is there a compelling reason to edit or reject this circuit for the given purpose? Also, could someone help me understand how the switching via Q2 works?

Thanks

Your circuit works because Q2 is injecting a current that is uncontrollable by means of U2 (your error amplifier).

When Q2 switches on, the emitter voltage of Q1 rises (limiting its drive current). As the feedback voltage across R4 rises due to Q2 being switched on, the differential error signal as seen by U2 becomes negative. U2 drives its output low trying to lower the voltage across R4. But, since Q1 can't sink current out of that node, U2 loses linear regulation and its output sits railed at ground. When Q2 switches off, U2 comes back into regulation.

There isn't much benefit to this topology, as U2 has to recover every switching cycle.

You could equivalently just chop the input reference level going to the positive input of U2.

Or, you could also bypass D1 with a PNP transistor.

• I think it's helpful to also point out that Q1's BE junction is a diode, so current will never flow that direction, forcing $${{3.3V} \over {49.9\Omega}} \approx 66mA$$ through R4. Since U2 is set up as a current sensing amplifier, it cuts off because it sees too much current going through R4. – Daniel Jan 31 '18 at 23:01
• Chopping the input reference level by e.g. shorting out C1, will cause a slow ramp when turning back on, which is not compatible with 2.5kHz modulation. You could throw more components in to get around this problem, but shorting out D1 with a transistor is likely to be a better solution. This way the servo loop maintains its set point when the LED is off. A PNP driven with logic will saturate, however: a PMOS is likely a better option. – user49628 Jan 31 '18 at 23:01
• Thank you all for the answer and the comments. I had originally tried chopping (only in Spice) and indeed noticed the slow ramp issue. Since I can't find a PNP at the moment I simply moved Q2 (with V5) to between V2 and D1 which is working well in Spice and on the breadboard. If there isn't a good reason to avoid this I'll go with it. – iamchriskelley Jan 31 '18 at 23:10