# Low-pass filter LC for PWM

In the following application I want to control a DC motor powered in 24 V and about 50 W. For that I use a microcontroller of the STM32 range which will be able to provide me a PWM signal of 200 kHz. To filter this signal I would like to use a LC filter, except that I do not really know at what frequency I must filter and also what value of my L and C would be the most appropriate. Would you be able to provide me some help on this subject?

Here is the schematic of my H-bridge.

• You want to get dc from pwm by using a filter? If so, you need to filter frequencies bellow of 200KHz. If you pick lower frequencies, you will get smaller ripple but longer rise time and vice versa May 25, 2021 at 13:46
• Yes, that's right, I want to get direct current. So if we refer to the values that I have previously chosen for this filter, for the inductance 220uH and for the capacitor 22uF, which gives me as a result about 2KHz, are they good choices? May 25, 2021 at 13:53
• It depends on your requirements on output voltage ripple and to a lesser degree on step response. Start with a crossover frequency of 1/20:th of your switch frequency or lower and an output voltage ripple of 1 % or less and see if you end up with reasonably sized inductor and capacitor (and ESR). May 25, 2021 at 14:40

What you need is a filter in the time domain. Since that is used to drive a motor, you're interested in a fast transient response, since it looks like you're in open loop. As Rohat Kılıç mentions, the lower the corner frequency, the better, but because of the fast response requirement you can't go too low. The quality factor should be, ideally, critically damped. You could also get a Bessel (slightly underdamped), or Gaussian (same), but going for Butterworth and above (even transitional) will mean overshoot. The downside will be that Bessel or lower filters will not attenuate higher frequencies as well as the others. As for the frequency, you'll have to decide on how fast you want the response time to be, and the amount of filtering.

Going for the critically damped solution, you will have the normalized transfer function, $$\H(s)\$$ and the desired t.f., $$\G(s)\$$:

\begin{align} H(s)&=\dfrac{1}{s^2+2s+1}\tag{1} \\ G(s)&=\dfrac{\dfrac{1}{LC}}{s^2+\dfrac{1}{RC}s+\dfrac{1}{LC}}\tag{2} \end{align}

Where R is the load and, since you say it's a 24 V and 50 W, then it's a 11.52 Ω. With this, we get a system of equations from which L and C can be calculated:

\left\{\begin{aligned} \dfrac{1}{11.52C}&=2 \\ \dfrac{1}{LC}&=1 \end{aligned}\right. $$\Rightarrow L=23.04,\;C=0.0434 \tag{3}$$

For the corner frequency let's choose the geometric mean between the switching frequency and DC, which means $$\f_c=\sqrt{200000}\approx 14.14\;\mathrm{kHz}\$$. Let's consider $$\f_c=10\;\mathrm{kHz}\$$, which means:

$$L=\dfrac{23.04}{2\pi f_c}=367\,\mu\mathrm{H}\;,\qquad C=\dfrac{0.0434}{2\pi f_c}=690\;\mathrm{nF}\tag{4}$$

To test the effect of various corner frequencies has on the response time and the amount of DC filtering, run a simulation:

Don't mind the input source, it's just some random PWM of 200 kHz, the results will be scaled with the input. Given the values previously calculated, the tests start with half those values (black trace), and end up with 3 times those values (pink trace). The red trace is the one with no multiplier. As you can see, the compromise is between a fast response time but not so great filtering, and a slow response time but better filtering.

But there is a problem. One additional factor include the load, which is calculated for the maximum power, but since you will have a PWM driving it, that means the load will be less and less as the duty cycle gets lower. Its value may get several times 11.52 Ω. If the load is 50 Ω, for example, here is how the response will look like:

This is the danger of having an LC filter in open loop. Adding one will not necessarilly cure it, because the loop will add its own baggage of problems, but this is to let you know that an LC filter is passive, which means once calculated they stay that way. And that's not all: a motor is an inductive load, and that will add a very unwanted zero, which means the system will oscillate. Here is a quick test with a very basic motor model:

Notice that k=100, that means the filter is now at 100 Hz (see the time scale) in order to dominate the zero of the motor -- the pole must be much lower in frequency, otherwise the oscillations would have been much worse. Of course, this is just a crude, basic motor model, and I have no idea what values would be fine for this case, but it gives you a hint of what could be. This is why, in such cases, a controlling loop is usually added. It will add complexity, it won't make the response perfect, but it will help a lot. Therefore nobody says you can't use one, just that if you do you may have different results than expected.