Wednesday, September 17, 2025

How DCC Really Works

The most important thing to know about how DCC works is this: you don't need to know how DCC works. Just as you can drive a car without knowing how an engine works, and use the internet without knowing TCP/IP, the only things you really need to know are how to set up and use DCC - and that's covered in great detail elsewhere on the DCCwiki. 

Still here? OK, you really want to know how DCC works. There is a lot of misinformation and misunderstanding about DCC, so we'll take things step by step. If you know much about electronics, some of this will seem very basic. Please bear with it.

DCC is very different from DC. You may have heard the adage "with DC, you control the track; with DCC, you control the locomotives". And that's a very good way to look at it. 

With DC, you control the voltage across the two rails of the track - for HO, typically that's between 0V and 14V. The voltage powers the motor, which determines how fast the train runs. And that's it. If you put two trains on the same track they both run (although probably at different speeds depending on the gearing between the motor and the wheels). If you turn the voltage to zero, they both stop.  

With DCC, the voltage across the two rails is always 14V (again, assuming HO). Every locomotive on the track is always receiving 14V. The versatility of DCC comes from the fact that every locomotive on the track has a decoder chip - essentially, a tiny computer - inside it that controls the locomotive's speed and other functions such as lights and horn. How fast a locomotive runs is determined by sending a signal from your controller or cab along the rails to that locomotive - and only that locomotive - that is interpreted by the decoder, which in turn determines how much voltage out of the 14V available to it to pass to the motor. In this way, each locomotive can receive a different amount of the available 14V, and therefore each can run at its own speed. Similarly, a different signal instructs the decoder to switch on or off the lights, or sound the horn, and so on. 

So what does that signal look like, and how does it go only to the right locomotive? 

Since the signal is sent over the rails, it will be seen physically by every locomotive on the rails. (This is much the same as a computer network, such as WiFi.) The signal that is sent out by the controller consists of a sequence of information called a packet. A packet comprises an address and a command. Each decoder chip has it's own address, which is simply a unique identifying number. That number is stored in the Configuration Variables, or CVs, of the decoder, as described elsewhere in the wiki. The address is typically set to 3 at the factory, and normally you'll change it right away to something unique on your layout, such as the road number of the locomotive. Each decoder only responds to the commands that are addressed to it. (If you are familiar with computer networking, you will recognize that this is again very similar: each computer has a unique IP address, and only responds to packets intended for that address.) The command might be an instruction such as "set speed" (and direction, forward or reverse) plus a byte of data to specify the speed, for example "64" if you are using 128 speed steps and want 50% speed. It could also be a command to sound a horn or whistle, or to turn on or off lights, or anything else that particular locomotive is capable of. These commands correspond to the functions available on your decoder chip.

Simply put, this is how DCC can control several locomotives independently on the same track: each decoder only obeys commands that start with its particular address, and ignores commands addressed to other locomotives.

If you only want to know how DCC can control several locomotives on one track, you can stop reading here. But if you want to know more details about what those signals look like electrically, continue reading.  

Now comes the part that causes the most confusion about how DCC actually works. Like other computer networks, the DCC signal consists of a binary code, a series of 0s and 1s. On learning this, many people assume that means that the voltage turns off to indicate a 0 and on to indicate a 1.

This is completely incorrect and it's where many online attempts to explain DCC go wrong. The key concept to grasp is that there are lots of ways to indicate 0s and 1s electronically, and On or Off is only one of them. 

Probably the simplest scheme to send signals electronically is to have a high voltage for 1 and a low voltage for 0. For example, if you are familiar with Arduino microcontrollers, a voltage of 5V means HIGH, or 1, and a voltage of 0V means LOW, or 0. [Strictly speaking, because electronic circuits are never perfect, the Arduino treats anything above 3.0V as a HIGH and anything below 1.5V as LOW.] 

But this is far from the only way to encode 0s and 1s. For example, the memory inside your computer, smartphone, smartwatch, Oura ring, or anything else you own that has a processor inside it, probably uses a type of memory called CMOS. Inside that memory, each bit is represented by a pair of transistors. To store a 1, one of the transistors is On and the other Off. To store a 0, the states of the two transistors are reversed.

This is the key fact about digital signals: a 0 bit in a signal does not necessarily correspond to 0V in a circuit. And with DCC, it definitely doesn't. 

As we said earlier, using On and Off for 1 and 0 is a very simple scheme. However, this won't work for controlling our locomotives, for two important reasons. First, recall that the decoder powers the motor by taking 14V from the track, and then providing some fraction of that voltage to the motor according to the speed setting that was sent to it. If the voltage between the rails were set to zero to indicate a 0 bit, then no voltage would be available to the decoder, and the motor would lose power for an instant. If a signal is sent that requires a sequence of zeroes, the motor would lose power throughout that signal. Overall, the power available to the locomotives would drop depending on the number of 0s being transmitted. And obviously that's not good. We want the power to the locomotives to be constant, and therefore we need the voltage to be constant, not On/Off. 

Second, an On/Off signal is fine for reading something simple such as a single bit, like the setting of a switch, but it's much harder to use to send a rapid sequence of bits. Suppose the controller sends a signal that is a sequence of 1s, for example to set the speed of a locomotive to 256. It's very hard for a decoder to figure out where one 1 stops and the next one starts, because it would just see a constant 14V (HIGH) signal. In order to know how many 1s were received, it would require very precise timers that are synchronized between the controller and all the locomotives, and that's not practical in this case. 

So the designers of DCC used a clever trick for signalling 1s and 0s that solves both problems: it provides constant voltage to the track; and it makes it easy for decoders to detect where one bit ends and the next begins. Instead of signalling 1s and 0s by the level - high or low - of the voltage, DCC signals 1s and 0s by changing the level of the voltage. A change in voltage is much easier for a decoder to detect, and doesn't require synchronized clocks. The clever part is the voltage is always 14V - only the direction of the voltage changes. And the timing of the changes encodes the 1s and 0s.

Let's look at this in specific detail. Imagine you are the engineer in a model locomotive, looking at the track ahead of you. Suppose that the rail on your left is 14V, and the one on your right is 0V. Then, your decoder sees the voltage switch, so that the left rail becomes 0V and the right one 14V. The decoder recognizes this change in voltage direction as the beginning of a bit. A moment later, the voltage switches back again, and the decoder recognizes the end of that bit. That back-and-forth switch is called a pulse. Throughout this process, the voltage is always 14V; as noted above, only the direction changes. (If you like a physical picture, imagine two children playing on a teeter-totter or seesaw: when one end goes up, the other goes down, but the difference in height between the two children is the same either way.)

This is the key concept in understanding how DCC works: DCC indicates 1s and 0s by the length of each pulse. 

Specifically, if the pulse is 116 microseconds long, it represents a 0. If it is 58 microseconds long, it represents a 1. And to reiterate, the voltage between the rails is always 14V, never 0V; only the direction changes.

The picture below is widely reproduced, and shows this idea graphically. Unfortunately it can be a bit confusing to interpret. The way to understand it is that when the blue-ish line is above the center black line, the left rail is 14V higher than the right rail, so current flows from left rail to right right. When the blue-ish line is below the center black line, the left rail is 14V lower than the right rail, so current flows from right to left. 

DCC Diagnostic Tools — DCC-EX Model Railroading documentation 

[Some people like to think of this as the right rail always being 0V, while the left rail switches between 14V and -14V. In reality, this is exactly the same thing because "voltage" is not an absolute measure, like height above sea level; rather, voltage measures the relative difference between two points in a circuit, like the top and bottom of a waterfall. And the difference from -14 to 0 is the same as the difference from 0 to 14. In both descriptions, the right rail is 14V higher than the left rail, and that's what matters. So you can think of it whichever way works best for you, as long as you remember that there is always a difference of 14V in one direction or the other. If you prefer this viewpoint, the picture is much easier to read: the black line represents the right rail, always at 0V, and the blue-ish line represents the left rail, switching back and forth between 14V and -14V relative to the right rail.]

If you look closely at the picture, you will also notice that earlier I simplified the explanation of a pulse. In reality, a 0 is indicated by setting the voltage in one direction across the rails for a long time (116ms), then in the other direction for the same amount of time, before returning to the original direction, ready to send the next bit. Similarly, each 1 is indicated by a pair of short peaks (58us), one in each direction. (The technical reasons for this redundancy are too detailed to get into here.)

Now you might be wondering, if the voltage is continually switching back and forth, why don't the locomotives just stutter back and forth, instead of running smoothly in one direction? The solution is a component in the decoder called a rectifier, which takes current in either direction as input, and outputs it in a single constant direction. (The same component is what enables a USB adapter to take 110V AC or 220V AC and output 5V DC.) 

There are a lot more technical details to DCC signalling if you are interested, for example the precise formats of address and data bytes; and what happens when no commands are being sent. That information can readily be found online, but it isn't necessary to understanding how DCC works.  

And there we have it. In summary: DCC delivers a continuous voltage across the rails so that full power is always available to the locomotives. It sends signals by flipping the direction of the voltage. The 1s and 0s are encoded by the timing of the back-and-forth switching, or in other words, the length of the pulses. And those 1s and 0s are interpreted by the decoder chip into addresses and commands. 


No comments:

Taking my talents (?) to Patreon

I'm moving my blogging over to Patreon. You can find me at  Jacob Zelten | Patreon Not that I expect to make money, just that its an eas...