Continuing my investigation, I had need to look into the way decoders drive motors. In particular I wanted to determine the duty cycle of the Pulse Width Modulation (PWM) used by several decoders.
*** WARNING - GEEK ALERT ***
If the paragraph above is causing you discomfort, you may want to stop reading now. This post is going to go a lot deeper into electronic esoterica than the series I am writing about practical electronics projects for model railroaders. So if you are feeling queasy, stop reading now before your head hurts or explodes :-). However, if you are interested in electronics or are an intrepid adventurer, read on. I will explain all of this as best that I can and there will be pictures along the way and a video to help explain the concepts.
Ever since the introduction of the transistor throttle, model trains have not been run on pure DC. In fact, the cheap "train set" power packs of my youth used a half-wave rectifier to run the trains which is a crude and ineffective form of pulse power.
The early transistor throttles each had its own way of applying pulses to the train to improve performance; and some brands, like MRC, introduced different techniques into their products as time went on. These techniques are not at issue here except to mention some of them. Pulses could be introduced on top of the steady DC to help break the motor's inertia. Eventually throttles were introduced that produced only pulses that increased in frequency as the throttle was advanced. This technique is called Pulse Frequency Modulation (PFM) or Pulse Space Modulation (PSM). Another technique used pulse at a fixed frequency and varied the width of the pulses with the throttle setting. This is called Pulse Width Modulation (PWM). And, if memory serves me, at least one power pack combined the two techniques using both PSM and PWM. You can look up all of these techniques on the Internet to find fuller descriptions.
Today, almost all decoders utilize PWM to control the motor speed. This is, in part, because the popular lines of microcontrollers used in decoders have built-in PWM generators and partly because many decoders are following published circuits for motor control which also use PWM.
The next series of photos shows how PWM works. These pictures are the output of an NCE D13SRJ decoder shown on an oscilloscope.
In the photo above, the decoder has just begun to drive the motor. The decoder is being controlled by a Lenz Compact DCC system which has a knob throttle. A Lenz LH-100 throttle might have been better as the push button throttle would allow for increasing/decreasing speed in discrete units of a single speed step.
As the oscilloscope is set-up for this measurement, the two pulses shown on the screen rise from zero (the horizontal line at the center of the screen), up to the full voltage (about 12V). From the edge of one pulse to the similar edge of the other pulse (either left edge to left edge or right edge to right edge) is 56 micro-seconds which is (I'll do the math for you) about 17,900 Hz.
The motor connected to the decoder is running slowly at this setting because each pulse is only 5-6 micro-seconds wide. 17,900 pulses at 5 micro-seconds each means that the motor sees only 89,500 micro-seconds out of every 1 second (1,000,000 micro-sceonds). And, doing the math again, it's only powered about 9% of the time - that's the duty cycle, the time that the motor is on versus the time that the motor is off. The only reason that the motor runs at all at this low duty cycle is that each pulse is a full 12V and gives the motor a short "kick" to get it turning.
Several steps of the throttle later, the waveform looks like this. The edge-to-edge measurement is still 56 micro-seconds and the height of the pulses is still 12V; but, as you can see, the width of the pulses have increased. The duty cycle has increased. Now the motor connected to the decoder is running faster becasue the power is on for a longer time.
Increase the throttle some more and the pulses continue to widen. They will eventually merge into a single waveform and, essentially, become almost pure DC. The next video shows the progression from minimum to max throttle and back again so you can see how the waveform varies.
Now I had my information about the duty cycle and how it increases from minimum to maximum throttle; and now you know too.