This article covers unidirectional Pulse Width Modulation (PWM) and how it can be used to control the power applied to a DC motor or the current in a stepper motor winding, for instance. While we eventually want to talk about doing bidirectional PWM with an h-bridge, we’ll start with a simple, one-direction control circuit.
In this circuit, the motor has one lead hard-wired to the positive supply. The other lead is connected through a switch to ground instead of a resistor. Obviously when the switch is off, the motor is off and when the switch it on, the motor will run at full speed. What happens if we rapidly flick the switch on and off, say, thousands of times a second? You can imagine that if the on time and the off time of the switch are about equal, the average voltage applied to the motor will effectively be half of the supply voltage and the motor will run at about half speed. During the off time, no current is being drawn from the power supply, so no energy is being wasted. You can also imagine that the ratio of the on time to the off time will determine the effective voltage that the motor sees. This relationship is sometimes called the “duty cycle” and is often expressed as a percentage of on time versus the total cycle time.
Up to this point, we’ve purposely left out something important, and now is the time to tackle it. A motor is an inductive load and current through an inductor can not change instantaneously.
In a mechanical analogy, think of inductance as mass or inertia. Current flow is speed and voltage is force. It take force and time to build up speed or slow the mass to a stop. To stop quickly, it takes more force. A heavy mass that runs into a solid stop will result in a lot of force.
In the circuit above, when the switch is opened, the current flowing through the motor has no where to go. In reality, the voltage across the switch would quickly rise until it was high enough to arc across the switch contacts or, in a solid state switch, cause voltage break down. We need to provide a safe path for the current to continue flowing.
Fortunately, this can be achieved by simply adding a diode. When the switch is on, current through the motor increases. When the switch opens, the motor current simply redirects through the diode and recirculates through the motor, gradually decaying.
The diode works fine, but it does have an inherent 0.6 volt drop across it that can start to waste significant power at high current levels. What if we add another switch in parallel with the diode? When the bottom switch is off, we can turn the high side switch on, bypassing the diode with a nice efficient switch. This technique is known as synchronous rectification.
Unfortunately, we can’t eliminate the diode entirely, because there always must be a brief time period after turning one switch fully off before the other switch begins to turn on and the diode must be there to conduct during that time. Every switching event takes place in three steps. First, the lower switch opens. Current then flows through the diode for a short period. When the upper switch closes, current flows through it and current through the diode stops. Next, moving back from right to left, the upper switch opens and current again flows through the diode until the lower switch closes.
There are some conditions which we’ll discuss in a later article which dictate that we should add a diode across the lower switch as well. By the way, did you notice that our circuit is starting to look like half of an h-bridge? Let’s mirror the switches and diodes to the other side.
In the next article, we’ll take this circuit and explore some methods of implementing bidirectional PWM.