Pulse Width Modulation
Summary: Pulse Width Modulation is a method for controlling an analog motor with digital circuits.
Pulse Width Modulation (PWM) allows better control of the motor. Rather than applying pure direct current to the motor, a series of pulses is used instead. They can be at the maximum power, but only for a fraction of a second. Doing this repetitively will cause the motor to begin to turn, producing torque. This allows slow speed operation in a more controlled manner. Simply applying a low voltage DC signal will not overcome the friction of the motor and gears, resulting in a jerky start, and poor low speed operation.
By varying (modulating) the pulse width and the frequency, slow speed operations are possible, and allow realistic operations in a yard.
The DCC multifunction decoder creates this signal to drive the motor.
This is the same process used in Switch Mode Power Supplies to control and regulate their output.
- 1 Technical Details
- 2 How Does it Work?
- 3 Additional Reading
Why Not Use Direct Current?
While Direct Current is the most efficient mode of driving a motor designed for it, this technique is not well suited for DCC decoder technology. It is also much more efficient to use PWM, as other methods would waste a lot of power and create excessive heat in the process. It is also very simple to implement PWM with a microcontroller and a few transistors.
So, despite the advantages of direct current, the disadvantages are much greater.
Pulse Width Modulation allows the DCC decoder to overcome issues inherent to the design of a DC Motor. See CV 9 (most decoders).
Torque Versus Voltage
There is a tradeoff between voltage and torque. At low speeds, the torque/voltage curve is poor, resulting in a locomotive which will not run smoothly. Using a motor which is designed for lower voltage is one solution, at the expense of tractive effort.
To overcome that limitation, PWM is employed. By application of almost full voltage to the motor in the form of pulses, the slow speed operation of the locomotive was improved. The downside to this method was increased motor chatter and vibration. Most decoder manufacturers use a high frequency PWM signal to drive the motor. This overcomes the noise and vibration issues. There is some loss of torque, but most decoders employ a form of torque compensation to overcome that.
Benefits of Pulse Width Modulation
- Simplicity: The motor drive circuit is much simpler with PWM, with fewer parts needed to interface with the decoder's microcontroller.
- Power Efficiency: The induction of the rotor's windings will average the current flow (Inductors resist the change of current.) The transistors have low impedance with a low voltage drop and power dissipation. A resistor dissipates a lot of power (I2R) as heat.
- Speed Control: The motor sees a low impedance current source, even as the source constantly switches between high and low voltage. The result is a motor which has higher torque. A series resistance will cause the motor to experience a very poor current source and it will easily stall.
- Control Circuit: For digital electronics (such as a microcontroller) it is very easy to switch voltages on or off using transistors or FETs. An analog output (either electronically or mechanically controlled) requires more components and increases power dissipation, wasted as heat. It will be more expensive in terms of electronics and power requirements.
The voltage available to the motor is a function of the track voltage.
Since the DCC signal combines both the power and the digital signal, it stays at a fixed level. For example, when set to HO a command station will put about 14V RMS onto the track. Now the decoder consumes energy, and a couple of volts are lost when the DCC signal is rectified for use with the motor controller.
If the track voltage is low, the motor will not get as much voltage, limiting top speed. It will also increase current consumption by the decoder. If you want to limit the top speed of the motor, use the V High CV.
The voltage applied to the motor is also of constant amplitude. Speed is controlled by the pulse width, which is adjusted using the V High to limit the maximum average voltage.
How Does it Work?
PWM is implemented by the decoder by switching the output to the motor on and off rapidly. This technique is very efficient with little power loss.
At a slow speed, full voltage may be applied to the motor for 20% of the time. The other 80%, it is off. This switching might be happening 1000 times a second. So for one millisecond, the power is on for 200 microseconds (uS), and off for 800 uS. The effective voltage being applied to the motor averages 20% of Vmax. If Vmax is 13V, the average would be 2.6V.
At mid speed, the voltage might be on for 500uS. At full speed, it might be 1mS on and 100uS off. Using Vmax at 13V, the motor would see a Vaverage of 6.5V.
Despite some CVs being named VStart, VMid, and VHigh there is no way to change the voltage output. Their names are not descriptive of what they really do. They allow you to set the output to start the then motor turning at step one, adjust the maximum speed, and tweak mid-range operation. This is done by adjusting the duty cycle of the output pulses. Which controls the current flow through the motor, not the voltage applied.
Back EMF and Sound
The PWM output is related to the BEMF, as the frequency will be altered by the BEMF values. This will also impact sound, as the decoder can use these values to create appropriate loading sounds for a steam or diesel engine.
Heat and Demagnetization
While it allows the decoder to run cooler, the motor will run a little hotter. It also may not have as much torque.
This was an issue when Pulse Power appeared many years ago. There were also concerns that the high frequency high voltage pulses would demagnetize the motor's field magnets. This was of particular concern in the early days of carrier control when there was concern about the high frequency carriers having the same effect. Modern alloys seem to have conquered that fear.
At certain frequencies or speeds, the motor and chassis may begin to resonate, making an annoying buzz. Increased noise can also be caused while in operation, changing in amplitude and frequency with the speed.
Modern decoders minimize this by offering variable frequencies, and many now use supersonic frequencies above what a human can hear. (Your dog may get very annoyed.) Higher frequencies plus the ability to modify them can also be used to tune the PWM to minimize any resonance. Much like the tone controls on your hi-fi let you adjust the sound to your room and your preferences.
Some decoders may even use a dynamically changing frequency to minimize any resonance and improve torque response.
Other than the previously mentioned heat issues, you get Back EMF!
When the power is disconnected from the motor, the decoder can then measure the voltage generated by the motor. By monitoring the BEMF, it can make adjustments to control the speed accurately. This allows the decoder to change the modulation as needed.