M&K Junction Railroad

M&K Junction Railroad
Another train of eastbound coal crosses the Cheat River

Friday, June 29, 2012

Stuff You Might Not Need to Know

For some time now, I have been working on a way to adapt typical HO decoders to run large and power-hungry O scale locomotives.  Recently, I abandoned my original approach and have adopted a simpler, more obvious technique and the results so far are very promising. The payoff in this is the ability to adapt HO sound decoders to run in O Scale locos. I have written up part of this work into an article for "O Scale Trains" that will be published in the March/April 2013 issue, so look for it.

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.









1 comment:

  1. Hi Terry, wish I had found your blog a lot sooner, but anyhew....regarding power hungry O-scale locomotives, I have taken a different approach to the problem, by building a high-efficiency gearbox (I am a mechanical engineer/CAD draughtsman) to allow much smaller motors to be used which only need an amp or two rather than four or more. Ordinary worm drives are about 25% efficient at best, and many don't even reach that figure. Poor surface finish or badly designed gears, lack of lube, poor alignment, all drag that figure down. I designed a gearbox to use a contrate gear to get the drive axis pointed in the right direction, then two stages of spur gears, all enclosed in a rapid-prototyped casing (Shapeways WSF). Mk1 version had issues with gear mesh, but you could still drive the motor by turning the loco wheel with a 30:1 reduction, so I think the efficiency must be somewhere above 60% i.e. you will only need a motor half the size to do the same job because it's not wasting three-quarters of its effort fighting friction, and starting will be much smoother too. Watch out for Delhi Belly! Regards, Paul.

    ReplyDelete