# Electronic – n ideal PWM frequency for DC brush motors

dc motorh-bridgemicrocontrollermosfetpwm

I'll be using a microcontroller to create a PWM signal for motor control. I understand how PWM and duty cycle works, however I am unsure about an ideal frequency. I do not have my motor in yet, so I can't just test it and find out.

The picture depicts a graph of RPM vs Voltage. It's linear from 50 RPM @ 8 V to 150 RPM @ 24 V.

I will not be varying voltage, just the time it receives a given voltage. So can I assume a linear response? At a 10% duty and 24 V supply it would run at a speed of 15 RPM?

If it makes a difference, I'll include the setup. I am running 24 V directly to an H-bridge that controls the motor. Obviously I have two PWM pins going from the MCU to the gates of the two enable MOSFETS.

In short:

You have linear control of the 'speed' by applying a PWM signal, now the frequency of that signal has to be high enough so that your DC Motor only passes the DC component of the PWM signal, which is just the average. Think of the motor as a low pass filter. If you look the transfer function or relationship angular speed to voltage, this is what you have:

$$\frac{\omega(s)}{V(s)}=\frac{K}{\tau s+1}$$ This is the first order model of a DC motor or simply a low pass filter with cutoff frequency $$f_c=\frac{1}{2\pi\tau}$$

Where $$\\tau\$$ is the motor's time constant. So as long as your frequency is beyond the cutoff, your motor will only see the DC part or the average of the PWM signal and you will have a speed in concordance with the PWM duty cycle. Of course, there are some tradeoffs you should consider if you go with a high frequency.

Long story:

Theoretically, you would need to know the motor's time constant in order to choose the 'right' PWM frequency. As you probably know, the time it takes the motor to reach almost 100 % its final value is $$t_{\text{final}}\approx 5\tau$$

Your PWM frequency has to be high enough so that the motor (essentially a low pass filter) averages out your input voltage, which is a square wave. Example, let's say you have a motor with a time constant $$\\tau=10\text{ ms}\$$. I am going to use a first order model to simulate its response to several PWM periods. This is the DC motor model: $$\frac{\omega(s)}{V(s)}=\frac{K}{10^{-3} s+1}$$

Let's let $$\k=1\$$ for simplicity.

But more importantly here are the responses we're looking at. For this first example, PWM period is $$\ 3\tau\$$ and the duty cycle is 50 %. Here is the response from the motor:

The yellow graph is the PWM signal (50 % duty cycle and period $$\ 3\tau=30 ms\$$) and the purple one is the speed of the motor. As you can see, the speed of the motor swings widely because the frequency of the PWM is not high enough.

Now let's increase the PWM frequency. The PWM period is now $$\ 0.1\tau=1\text{ ms}\$$ and duty cycle is still 50 %.

As you can see, now the speed is pretty much constant because the high frequencies components of the PWM signal are being filtered out. In conclusion, I would pick a frequency that is at least $$f_s\geq \frac{5}{2\pi\tau}$$

This is just a very theoretical explanation on how to choose the PWM frequency. Hope it helps!