# Limiting PWM rise and fall time

We're generating a PWM signal at about 2000 Hz whose rise and fall times we need to limit to about 40 us, so it can pass through ordinary audio stages without distortion / ringing.

The PWM signal is 0-5 V from a micro, and we'd be happy with at least a 2 Vp-p final output.

I'd like to do it with the simplest possible circuit that provides linear ramps. What's my best bet? Any example circuits out there? I'm not a real engineer, but I do have a copy of LTspice. (:

• Limit single pwm pulse (makes no sense since 40ms > 250us) or limit modulated signal?
– user208862
Commented Nov 15, 2021 at 0:00
• Please add details, such as the guaranteed input voltages voltages (high and low), and the required output voltages. Also, as mentioned in comment above, please determine a rise and fall time that makes sense for the frequency of your pulses. Finally, please add this information to your question, by editing it, rather than posting that information here in the comments. Commented Nov 15, 2021 at 0:16
• May be 40 microseconds, not mili. Commented Nov 15, 2021 at 0:36
• Indeed, 40uS, not 40 mS Commented Nov 15, 2021 at 2:25
• Limit with RC isn't sufficient?
– user208862
Commented Nov 15, 2021 at 2:40

One option is to implement an OPAMP-base slew rate limiting circuit

simulate this circuit – Schematic created using CircuitLab

• This looks ideal to me. Can you speak to the issue raised by @SimonFitch, if it applies to the output here? Commented Nov 15, 2021 at 16:22

You may use a resistor R is series to the PWM output. Pick R in the 10 to 1000 Ohm range.

Alternatively, you may use a resistor R in series to the PWM output and a capacitor C between R and GND. Take a look here:

http://sim.okawa-denshi.jp/en/CRlowkeisan.htm

Pick R in the 10 to 1000 Ohm and C in the range of 100 pF to 100 nF.

• If I am not mistaken, both solutions are basically RC filters, except the first one uses input capacitance of the target. Note, that RC filter does not entirely satisfy "linear ramp" requirement, although might be OK for "comes close" part of it Commented Nov 15, 2021 at 6:44
• Agree 100% to your note here. Commented Nov 15, 2021 at 8:17
• Thanks. I had modeled the circuit you suggest and... I know I said 'close' but I don't think a simple RC filter is it, since the ramps are logarithmic, not linear. Something with a constant-current characteristic? Commented Nov 15, 2021 at 13:18
• @JimMack You need to edit your question and define exactly what you mean by "even comes close". It is inconsiderate to ask for solutions after giving vague requirements, then saying "no, that's not good enough" when someone tries to help. Commented Nov 15, 2021 at 13:25
• @ElliotAlderson - You're right, sorry for being vague. Commented Nov 15, 2021 at 13:44

Linear ramps with sharp corners at the end of their transitions have equally strong higher harmonics as rectangular functions, and I really think you should consider a simple RC low pass filter:

simulate this circuit – Schematic created using CircuitLab

It's the simplest approach I can think of, and while it won't produce linear ramps like an active integrator, it will limit slew rate, and the rectangular waveform can still be recovered after its journey through the audio channel.

• "Linear ramps with sharp corners at the end of their transitions have equally strong higher harmonics as rectangular functions," I believe that is incorrect. With square wave, the harmonics fall off at 20 dB/decade, but with trapezoidal, they fall off at 40 dB/decade if I am not mistaken. Commented Nov 15, 2021 at 14:43
• There may be a difference I'm not aware of between 'linear ramps' and the sort of slew-rate limiting circuit proposed by @JonRB in his answer. Would you say that his results suffer from the issue you're describing? Commented Nov 15, 2021 at 16:19
• Yes, the sharp corner is rich in harmonics, which you stated you want to get rid of
– user16222
Commented Nov 15, 2021 at 16:20