Help: Sandbox

DCCWiki, a community DCC encyclopedia.
Jump to: navigation, search
Welcome to the DCCWiki Sandbox! This page allows you to carry out experiments. To edit, click here or edit this page above (or the views section for obscure browsers), make your changes and click the Save page button when finished. Content will not stay permanently.

Please do not place copyrighted, offensive or libelous content in the sandbox(es). Thanks!

Rewrite of DCC Power

This content will be merged with Tutorial contents

DCC Power

This article is part
of the DCC Tutorial
Tutorial pages...

DCC compared to Computers
Basic System
Power
Starter Sets

Summary: DCC power may seem very complex, but armed with the proper knowledge, you will soon understand what makes model trains operate with DCC power.

The Digital Command Control Waveform

Overview of NMRA Digital Command Control – Power

You don't need to fully understand the technical details of how DCC works to use DCC on your railroad. If you don't understand everything, don't worry.

NMRA Digital Command Control uses a high frequency digital waveform to provide power and transmit data.

NMRA Digital Command Control, unlike other analog and digital Command Control systems, puts a 100% digital signal on the rails delivering power and data in the same digital signal.

The digital data is not superimposed on a DC or AC waveform, nor does it use a high frequency carrier in addition to the power applied to the track, unlike past and current command control systems. Since the rails are alternately energized or held to zero, there are no issues with polarity. The digital information is encoded in the time domain by pulse width, not by amplitude.

Since the signal is completely digital, the NMRA Digital Command Control waveform is a square wave. The nature of a square wave results in more demanding requirements for wiring to avoid voltage losses and signal distortion compared to analog control methods.

Too Long Didn't Read (TLDR)

There are many myths surrounding the DCC signal. Most of those myths are the result of applying analog ideas to a digital concept. Some come from a literal interpretation of the NMRA DCC Standards. Others have been promoted over the years due to misunderstandings or dislike for the DCC technology. Another source of confusion is the application of incorrect terminology.

  1. The booster creates a binary ON/OFF signal which is applied to the power bus, which is sent to the track, then the train.
  2. The binary value is determined by the period from one ON state to the next: 106µs (58 + 58) has a value of 1, 200µS is a 0.
  3. There is full power on the rails at all times while the booster output is turned on. Voltage does not determine locomotive speed.
  4. There is the signal phase present on the rails, where one rail is energized (ON) while the other is OFF. One rail will always be in the opposite (inverted) state compared to the other.
  5. There is no polarity as there are only two possible states: On or Off. There are no negative voltages present.
  6. Current flows from ON to OFF.
  7. The rails are identified as A and B, whose phase can be handled by auto reversers when A meets B, so you don't need to flip toggle switches.
  8. The phase of the rails does NOT control the direction of the locomotive.
  9. The DCC Signal is in the audio range. There are no high frequency carriers in the MegaHertz region nor does "rise time" of the pulse carry data.

The DCC Signal

The Booster

Bridge sklop

The booster is a digital amplifier. It receives a logic level waveform from the command station. Logic level signals have two states: On or Off. The data is contained within the period of the on/off sequence. This logic level voltage is amplified to the necessary track voltage determined by the Scale of your model trains.

The amplification is performed by two pairs of transistors functioning as switches. When the digital input is low, one pair is switched on to create a path for current to flow though the power bus. When the digital signal changes to the high state, this pair turns off and the other pair turns on. For example, when the digital signal is HIGH or ON, pair A is switched on, delivering power to Rail A and facilitating its return to the power supply. When the inout goes low or OFF, the booster's circuitry connects Rail B to the power supply via pair B. This switching sequence creates the pulses on the rails which deliver both data and power to the multifunction decoders on the track. Most boosters are constructed to prevent any output in the absence of a digital input signal.

The booster's power supply determines the total power available, and must be selected accordingly. Refer to the instruction manuals for details on selecting the correct voltage and current capacity of the power supply for your DCC system, as many are not delivered with a power supply.

Volts

The voltage output of the booster is dependant on your scale. N and Z Scales require much less voltage than O or Large Scales. Where N Scale may require 12V, a large scale locomotive may require up to 24V for proper operation.

Amps

The amount of current deceived by the booster is determined by two parameters: The maximum amount of current the booster itself can deliver before overheating, and the current the power supply can deliver.

Of those two parameters, the booster decides how large a current can be delivered to the track. The booster will also have the capacity to disconnect its output from the power bus should a short circuit occur, to protect itself from damage from excessive heat.

Power

Power is a measure of energy. Energy is required by the multifunction decoder to operate the motor and lighting functions, as well as any other features it has. This power is delivered to the track by the booster.

The amount of power a DCC system can deliver is determined by the capacity of the both the booster and the power supply. An undersized power supply will limit the amount of power available. For N scale, the amount of power needed is low, from 36 to 60 Watts. For HO it can range from 50 to 80W. With larger current boosters, HO can reach 125W, and with larger scales, 240W.

This is one of the great differences between analog direct current operation and DCC. Analog control systems rely on multiple small power supplies delivering low power to the track, such as 12 to 15W. The potential for damage when a short circuit occurs is limited, unlike a DCC booster which can deliver 5 or more amps into a short. For proper operation DCC requires more robust wiring (the power bus) than analog direct current, both for delivery of energy to the decoder, and quick reaction to a short circuit condition.

Signals on the Power Bus

ScopeTraces-1.png

Oscilloscopes display signals as vectors, as they have both amplitude and direction.

The oscilloscope traces on the left show (in Purple) the sum in Volts DC of both Rail A and Rail B. Rail A is the trace in Yellow, Rail B is in Blue. The yellow and blue pulses show the booster's output transistors switching states as the follow the signal from the command station. The numbers 1 and 2 at the left represent Zero VDC present on the rail. Both output channels connect to a common point (labelled "ground") while the probes are connected to the Rail outputs. The Purple trace is twice the amplitude, as it is the sum of both signals. The purple trace represents a Differential Signal with no Ground, as per the NMRA Standards. (Note 1)

Track Polarity

Digital Command Control has no concept of polarity. In DCC phase is important, one rail is always the inverse of the other. DCC is a digital technology, one rail will be connected to the positive voltage (HIGH) while the other is held LOW (0V). To send the data, the state of the rail will be changing constantly from HIGH to LOW. This signalling technique also reduces the space charge around the rails and the electrostatic attraction of contaminants.

Phase becomes an issue with reverse loops and crossovers. A short circuit occurs when a phase mismatch occurs, as current can now directly return to the power source. As mentioned above, the booster output has two pairs of transistors, each pair consists of a transistor (switch) which connects the load to the power source, the other allows the current to return from the load to the power source, completing the circuit.

Unlike analog where polarity of the track controls the direction of the train, with DCC the direction of the train is controlled by the multifunction decoder in the locomotive. The decoder receives instructions from the throttle via the command station and controls the speed and direction thereof of the locomotive's motor accordingly.

Does DCC use Alternating Current?

No, it is strictly a binary pulse train. What confuses many and leads to misunderstanding is the scope traces showing a single, combined trace. The scope trace is misleading, as there is no reference point. The single trace includes an imaginary component on the Y Axis. As shown in the traces above when there is a reference point the switching action of the booster output can be seen.

The voltage on each rail alternates from a positive voltage (High or ON) to 0 volts (OFF). The booster Energizes Rail A for a period of time while holding Rail B to 0 volts. Then it connects Rail A to 0V and energizes Rail B for a period of time. The On/Off cycle of the track is controlled by the command station's data signal. As shown above, one rail is always the opposite phase (inverted).

Digital signals do not have the concept of negative. A negative voltage would be considered an Undefined Value. In DCC the presence of only positive voltages on the rails is important: The decoder needs to see the pulses to work. Physically re-orienting the locomotive has no effect on the decoder. It still sees the On/Off pulses that provide the data. The period of time during voltage changes provides a method for encoding binary data. To represent a one, the time is short (nominally 106µs for a complete cycle). A zero is represented by a longer period (nominally 200µs). A period is defined as the time between the first pulse and the next pulse, with equal On and Off times. This results in a signal between 5 and 9.5kHz.

There are those who will claim it has positive and negative values, this would only be possible if:

  • The power supply, with two wires, has an output voltage of at least twice that of the track voltage
  • The power supply has three wires supplying both positive and negative voltages with a common return/reference point

On an oscilloscope using a single channel the track voltage displayed appears to indicate the presence of a plus/minus signal. It "sees" a negative voltage when the booster flips the rails, as the reference point is floating. There is no ground being held to a zero potential. Another way to look at this is how the current is flowing: It will flow from A to B, then B to A. The scope trace will display this.

Oscilloscope trace of a Digital Command Control waveform as seen on the track.(Probe is connected to one rail and ground clip to the other.)

Advanced DCC Power Topics

Why Measuring DC Volts Fails

Mathematically the DCC signal would be written as: (0+j14) + (0-j14), where the 0 is time on the X axis, the j operator indicates a voltage on the Y axis. These values show 14V at 90° and 14V at 270° on the oscilloscope display. Measuring this with a DMM set for direct current voltage results in the equation which sums the two values: (0+j14) + (0-j14) reducing to j14 - j14 = 0 DC Volts. Time is not important to this calculation as a meter measures amplitude only.

Since the signal changes at a high frequency, a typical Digital MultiMeter (DMM) on ACVolts cannot sample the signal accurately. They do not sample at a high enough frequency to calculate the value accurately, as they are typically designed to measure AC in the 50-60 Hertz range. The instantaneous voltages it samples result in an erroneous value due to aliasing. Digital multimeters are also designed to calculate and display the RMS value of a pure sine wave. There are DMMs which can measure higher frequencies and other waveforms, this feature comes at a cost in both accuracy and price.

Using a DCV function will not give accurate readings, due to the changing nature of the signal. It will see an average of zero volts. There are meters available that will accurately measure DCC signal, such as the RRampMeter, which was designed specifically for measuring DCC voltages and currents.

RRampmeter, for measuring voltages and currents on a model railroad.

Converting the DCC signal to Direct Current in the Decoder

Diode Matrix routes incoming digital pulses to provide a smooth DC voltage

In order for the motor to use the DCC power, the power must be converted to Direct Current. Multifunction decoders use a Diode Matrix (see image) routing the digital signals from both rails to provide power for the decoder. A diode matrix consists of four diodes (a device that lets electricity flow in only one direction) connected in a specific way. In this example, when Rail A is energized the current will flow through one pair of diodes, returning to the booster via Rail B, until Rail B becomes positive and the other pair of diodes conduct. There will be an additional diode in the matrix circuit (not shown) which provides the digital signal to the microcontroller's input.

Without the diode matrix, only the pulses on one rail would be used for power, resulting in lower average voltages available to drive the motor and operate the microcontroller and its peripheral circuits. While the voltage on one rail may be enough for the digital circuit, it would vary in average levels, and may cause the microcontroller to reset at times. The matrix allows current to flow from either rail without causing a short circuit.

You can also use a diode matrix connected between the track and your DMM to measure the DCC voltage on the track using the DCV range. This is called a rectified DC Voltmeter. Remember: You typically lose 0.7V (700 millivolts) through a diode. Factor a loss of 1.4V due to the two diodes completing the matrix circuit.

When used for rectification (converting Alternating Current to Direct Current) this circuit is called a bridge rectifier.

Speed Control

Okay, so we've explained how we get DC, but if we applied this directly to the motor, it would go in one direction really fast. To account for this, the output of the diode matrix does not connect directly to the motor.

Motor Control

H-Bridge Animation

Between the onboard DC power source (the matrix) and the motor is a series of transistors. Since transistors function as a valve, where a small current can be used to control a large one, they can be switched rapidly on and off, making control of a motor or other device possible. With a special arrangement of power transistors (meant to control large amounts of power) called an H-Bridge, the decoder can make the train go in either direction.

Remember, because there is full voltage on the rails at all times, there is also full voltage available at the power transistors at all times. If the transistors are turned on to pass all the available voltage, the loco will go at full speed. Unlike an analog DC train system, transistors are designed to pass full voltage, or no voltage, much like a switch. You either have full power, or no power. To control the speed, the decoder turns on and off the transistors hundreds, or thousands of times per second. This is like setting your ceiling fan to high, but to control the speed, you are constantly turning on and off the switch several times a second to maintain the speed you want of the fan blades. Please see High-Frequency Decoders for more details regarding the speed at which decoders control the transistors.

The reason this works in both our model trains, and our fan, is that the the transistors are turned on and off hundreds, or thousands, of times per second - so fast that the motor can't respond instantaneously to each pulse. The motor has so much mass to it (including flywheels, or blades) that a single pulse can't budge it. But, a whole lot of pulses can make it go. Since there is full power to the wheels, and ultimately to the engine, this helps the locomotive run so much better on DCC than with DC.

Phase Relationships

Reverse Sections

Main article: Reverse sections

Although there is no electrical polarity, you still have to deal with reverse sections on your layout. The phase of the rails is important in DCC. Rail A is aways the inverse of Rail B. If the track turns around back onto itself, the right rail (A) will come in contact with the left rail (B), creating a short circuit by connecting one phase to the other; the same as placing a metal object across the rails.

If the rails are out of phase across a gap, there is a potential difference between them, which can be measured. Should a metal wheel bridge that gap, current can flow from the energized section into the unenergized section, causing a short circuit. An auto reverser will maintain the correct phase relationships between a reversing loop and the approach track.

The same issue can happen if the frog in a turnout is incorrectly phased, or if a wheel bridges across the point rails at the heel of the frog.

Standards

The DCC protocol is the subject of two standards published by the NMRA: S-9.1 specifies the electrical standard, and S-9.2 specifies the communications standard. Several recommended practices documents are also made available.

Measuring Track Voltage

Main article: DCC Power/Measuring Track Voltage

Additional Notes

Digital Multimeter Notes

For additional information about Digital Multimeters, see Wiring Tools

Trying to measure the DCC voltage on your track will introduce new problems and additional confusion. First problem: They are designed for 50/60Hz AC. Outside of that frequency, the results get interesting, as the sample rate is not fast enough for signals such as the DCC waveform. Which introduces a huge amount of error and uncertainty.

Most digital multimeters display AC as the Average Value. This assumes a pure Sinusoidal waveform. Unless stated as a "true RMS" meter. RMS performance is sometimes claimed for meters which report accurate RMS readings only at certain frequencies (usually low) and certain waveforms (essentially always sine waves). Some manufacturers, such as Fluke, have a True RMS feature, which is really accurate compared to other brands, and especially compared to really cheap DMMs. Better DMMs (such as those by Fluke and other quality instrument makers) use additional calculations to arrive at the RMS value. Cheaper DMMs will use simpler, lower cost circuits to determine the voltage. The factory will simply adjust the meter to read the RMS value. Then there are the accuracy of the calibration standards used at the factory as a reference to calibrate the DMM.

Do not rely on the meter as being 100% accurate. For comparative measurements, it is acceptable.

Nyquist Theorem

For an analog signal to be accurately digitized, it must be sampled at a rate at least twice that of the highest frequency present. In other words, the highest frequency should only be no more than half the sampling frequency for accurate sampling and digitization. This underpins many everyday things, like digital audio on Compact Discs.

The maximum signal frequency is called the Nyquist Frequency, and the rule is the Nyquist Theorem.

Aliasing

When a signal is sampled too slowly (there are frequency components above the Nyquist frequency) the resulting digitized waveform is distorted. This distortion is called aliasing. It results from the mixing (or beating) between the signal frequency (in this case, the DCC signal frequency) and the sampling frequency. Low frequency harmonics are recorded instead of the actual signal.

In general, the sampling frequency should be more than twice the highest frequency to be measured. A value of 5 times would be a good choice. Many analog to digital conversion circuits also contain an anti-aliasing filter to eliminate any signal frequencies above the Nyquist frequency.

What does Aliasing Mean?

A cheap DMM may only sample at 120 or 180 Hertz, as it is designed for a 60 Hz Sine Wave. A better one may use 300 or 360Hz for more accurate measurements. It may also have a filter to cut off any signals above 70Hz. DCC signals are 8 to 10 KiloHertz in frequency. Sampling will result in a lot of aliasing, making your readings inaccurate and misleading. The DCC signal is a square wave, so getting an accurate measurement becomes a problem.

High quality instruments may be able to sample frequencies up to 2kHz accurately, but that comes at a cost.

Measurements

DCC waveform, note the voltages shown. This is for HO, the peak is 14.8V, and peak to peak is 29.2V. A DMM or voltmeter cannot measure accurately a signal like this.

If you were to use an oscilloscope to measure the line voltage in your house (nominally 120 V AC (RMS)) you would see that the sine wave measures about 340V peak to peak. One half cycle peaks at approximately 170V. The RMS value, which is displayed by measuring instruments, is 70.7% of the peak value. In this case, 120VAC. You should see a nice, pure sine wave, unless you have a lot of distortion, caused by harmonics. A common source of harmonic distortion is a switching power supply.

The same scope would display your DCC waveform as a square wave. It would accurately display the peak to peak value of the waveform. A square wave is actually the sum of sine waves at multiple frequencies, called harmonics. As more frequencies enter the equation, the waveform becomes more square in shape. The frequencies are harmonics of the fundamental frequency. You can calculate a sine wave and plot the result on graph paper, and as harmonics are added, the waveform becomes more and more distorted, until it forms a square wave. (This is how your kids burn out the tweeters in your stereo's speakers.) This is also important in your power bus, as excessive impedance causes distortion, as some frequencies will travel faster than others on the wire.

One solution is to use a rectifier circuit between the track and the DMM and measure the DC output of the rectifier. For more accurate results, you should characterize how the combination of DMM and rectifier works with high frequency complex waveform. Another solution is the RRampmeter mentioned above.

Notes:

1: https://www.nmra.org/sites/default/files/standards/sandrp/pdf/s-9.1_electrical_standards_2020.pdf

Read the entire document and any notes. The standard is deliberately not specific, as it only describes what the result should look like, not the exact construction. Also note it does not define polarity, as that is a quality wherein the direction the locomotive defines the positive rail.

See Also

  • DCC Tutorial (Power) - The tutorial version of this document.
  • Power supply - Details, requirements, and recommendations for power supplies.
  • Root Mean Square - Root Mean Square or RMS, additional information (lots of math).
  • DCC Ammeter: What you need to build an ammeter that can measure DCC current. Plus other electronics projects for DCC.

Square Waves and Fournier Series

Fournier Series on wikipedia All about how you can create square waves from a sine wave and its harmonics.