Using PWM for DC Motor Control

Get Started with Altium Upverter, Sign Up Now

Upverter Expert - Using PWM for DC Motor Control

Average DC value for different duty cycle

DC motors convert electrical energy to mechanical energy, and the speed of a DC motor is directly proportional to the value of the input DC voltage. The direction of rotation depends on the polarity of the input voltage. In many applications, you may want to control the speed or direction of rotation, and you can use pulse-width modulation (PWM) with an H-bridge as an easy technique for controlling speed and direction. In this article, we will examine what is PWM and how to use PWM for DC motor control.

What is PWM?

There are many types of modulation schemes that can be used to periodically change some aspect of a digital or analog signal (frequency modulation, amplitude modulation, phase modulation, etc.). As the name suggests, PWM is a type of modulation in which the width of the pulse is changed without changing the frequency (i.e., the repetition rate) of the signal. The amount of time the signal is in the HIGH state is called the duty cycle. As we will see, this quantity is fundamental in using PWM for DC motor control.

Using PWM causes the average DC value of the signal to change when passed through a low pass filter. If such a signal is fed to a DC motor, we can change the speed of the motor by changing the duty cycle of the PWM signal. The change in pulse width is created by increasing the on-time (HIGH value) of the pulse while reducing the off-time (LOW value) by the same amount so that the frequency of the signal is constant. Increasing the on-time increases the average DC voltage value of the signal, and vice versa. The following figure shows the variation in the average DC value with duty cycle.

Average DC value for different duty cyclesAverage DC value of a PWM signal for various duty cycle values.

A simple relation to calculate the average DC value is


where, V(REF) is the value of logic high. This allows analog control of a DC motor via digital signal, making it possible to use microcontrollers to drive DC motors. A microcontroller can change the pulse-width dynamically, providing an instant or steady change in the corresponding DC motor speed. We can see how output voltage changes dynamically with duty cycle:

pwm2DC motor speed vs. duty cycle

Amplifying the PWM output

Unfortunately, it is not possible to use the microcontroller output to drive a DC motor directly as the current is typically too low to drive the motor. In addition, all DC motors have a start voltage that guarantees the motor will begin moving in any orientation. In many cases, the output from a microcontroller might not be strong enough to start the motor.

Usually, a PWM signal is used to drive a BJT or FET switch that connects the DC motor to a high supply voltage. The voltage reaching the DC motor supply in this case becomes


The circuit for making this connection between the PWM output and the DC motor is shown below:

Schematic for a MOSFET driver circuit for using PWM for DC motor controlSchematic for a MOSFET driver circuit for a DC motor. Image source.

Using an H-bridge to Control Direction

If we need to control the direction of the motor, we need to reverse the current through it and the most common way to do it is using an H-bridge. The H-bridge contains four switches in a bridge type configuration with motor in the center.

PWM4An H-bridge for motor control

By selectively turning on different switches, we can change the direction of the current and hence the direction of motor rotation. This can also be used to put a sudden brake to the motor or let the motor freely run until it stops due to friction. Closing switches S1 and S4 will rotate the motor one direction, and vice versa when S2 and S3 are closed. The motor will break when you close switches S2 and S4 with the other switches open, or when you close S1 and S3.

If you like, you can digitally control the direction of the motor by placing transistors in the above H-bridge circuit in place of mechanical switches. For example, when transistors at S1 and S4 output HIGH, the motor will conduct in the same way as if mechanical switches were closed. The same can be said for the remaining switch configurations.

Using PWM for DC Motor Control in Your Next Project

Now that you have a fairly good idea of how to use PWM to drive a DC motor and construct an H-bridge for an additional degree of freedom, you can easily build a digital circuit for directional control and to amplify the input voltage to start the motor. This requires a PWM source and 5 discrete transistors. You can also use a microcontroller (such as those built into an Arduino) to generate a PWM signal and numerically control the duty cycle. If you don’t want to build the directional control circuit yourself, you can use a 298N dual H-bridge DC motor driver. An example of this project can be found here.

You can sign up for free and get access to the best browser-based PCB editor, schematic editor, and component database. Visit Upverter today to learn more.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: