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.


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.

Friday, June 8, 2012

More Progress

Lately, I've taken the opportunity to write several articles for the various magazines and so far one, and I hope more, will be published.  In the meantime I have been making some small progress on the railroad.

The Cheat River Grade backdrop has been painted a sky blue while I decide on a photo backdrop for this location.  I've also spray and brush painted the rails on the grade as you can see from the following photos.

I spray painted the entire flex track, rails and all , with Floquil Rail Tie Brown to kill the unnatural chocolate-brown color of the Atlas O flex track..  The rail tie brown has good adhesion to the nickle silver rails and prepares then for the next step.  After a couple of days for through drying, I went back and brush painted the rail using the technique that I have described previously in this blog see Weathering Track.

I think that the rail looks great with its tops painted in this realistic rust color, but the trains will not run on it in this condition.  Rather than sand the tops of the rails clean as I have done in the past, I wrapped a towel around a piece of 2x3 and wetted it with a product called "Goof Off".  Goof Off is a remover for dried-on paint.  I then rubbed the tops of the rail with this pad to remove the paint from the tops of the rail. 

The advantage of this technique over sanding is less dust and the rail is not scored by the sandpaper, thereby keeping it smoother and less likely to pick up dirt.