Silicon ChipDCC: Digital Command Control For Model Railways - February 2012 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Loud television commercials will continue to be annoying
  4. Feature: Converting The F&P SmartDrive for Use As A . . . Motor by Nenad Stojadinovic
  5. Project: A Really Bright 10W LED Floodlight by Branko Justic & Ross Tester
  6. Project: Crystal DAC: A High-Performance Upgrade by Nicholas VInen
  7. Feature: DCC: Digital Command Control For Model Railways by Leo SImpson
  8. Project: SemTest: A Discrete Semiconductor Test Set; Pt.1 by Jim Rowe
  9. Project: Simple 1.2-20V 1.5A Switching Regulator by Nicholas Vinen
  10. Feature: Homebrew PCBs Via Toner Transfer by Alex Sum
  11. Vintage Radio: The 1930s Palmavox 5-valve superhet; Pt.1 by Maurie Findlay
  12. Summer Showcase
  13. PartShop
  14. Advertising Index
  15. Outer Back Cover

This is only a preview of the February 2012 issue of Silicon Chip.

You can view 24 of the 104 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "Crystal DAC: A High-Performance Upgrade":
  • Crystal DAC PCB [01102121] (AUD $15.00)
  • ATmega48 programmed for the Crystal DAC [0120212A.HEX] (Programmed Microcontroller, AUD $15.00)
  • Firmware and C source code for the Crystal DAC [0120212A] (Software, Free)
  • Crystal DAC PCB pattern (PDF download) [01102121] (Free)
Items relevant to "SemTest: A Discrete Semiconductor Test Set; Pt.1":
  • SemTest Upper PCB [04103122] (AUD $20.00)
  • SemTest Lower PCB [04103121] (AUD $20.00)
  • High Voltage Crowbar PCB [04105121] (AUD $7.50)
  • PIC16F877A-I/P programmed for the SemTest semiconductor test set [0410312B.HEX] (Programmed Microcontroller, AUD $20.00)
  • SemTest front panel [04103123] (PCB, AUD $50.00)
  • Firmware (ASM and HEX) files for the SemTest semiconductor test set [1410312B] (Software, Free)
  • High Voltage Crowbar PCB pattern (PDF download) [04105121] (Free)
  • SemTest Lower PCB pattern (PDF download) [04103121] (Free)
  • SemTest Upper PCB pattern (PDF download) [04103122] (Free)
  • SemTest front panel artwork and drilling template (PDF download) [04103123] (Free)
Articles in this series:
  • SemTest: A Discrete Semiconductor Test Set; Pt.1 (February 2012)
  • SemTest: A Discrete Semiconductor Test Set; Pt.1 (February 2012)
  • SemTest: A Discrete Semiconductor Test Set; Pt.2 (March 2012)
  • SemTest: A Discrete Semiconductor Test Set; Pt.2 (March 2012)
  • SemTest Discrete Semiconductor Test Set; Pt.3 (May 2012)
  • SemTest Discrete Semiconductor Test Set; Pt.3 (May 2012)
Items relevant to "Simple 1.2-20V 1.5A Switching Regulator":
  • MiniSwitcher PCB [18102121] (AUD $5.00)
  • MiniSwitcher PCB pattern (PDF download) [18102121] (Free)

Purchase a printed copy of this issue for $10.00.

DCC: Digital Command Control For Model Railways By LEO SIMPSON While it has been around for some years now, Digital Command Control or DCC is now becoming increasingly popular as more and more manufacturers incorporate it into their new models, along with various accessories such as complete locomotive sound systems. S O WHAT IS DCC? Well, at one time it stood for “Digital Compact Cassette” but the march of technology has consigned that to a technical curiosity. For model railways, DCC is a “packet switching” system whereby multiple locomotives on a model railway layout can be simultaneously controlled. Each locomotive has its own digital address and its speed, direction and a bunch of other parameters such as inbuilt sound and lighting can all be adjusted remotely. If you are familiar with the Ethernet protocol, one of the original “packet switching” systems, you are well on the way to understanding how DCC works. Of course, a major difference between an Ethernet system and a DCC model railway system is that Ethernet signals are transmitted over Cat.5 cable while DCC signals are broadcast over the rails in the model railway layout. 36  Silicon Chip But we’re getting ahead of ourselves. Let’s backtrack a little. Originally, it was only possible to run one locomotive on a model railway layout. You connected a variable DC power supply to the rails and you varied the track voltage to control the speed of the loco. This is the way it’s been done ever since electric model locomotives became available, back in the 1930s. On early model railways, the speed controllers were really quite crude but with the availability of silicon power transistors from the 1960s onward, model railway speed controllers greatly improved, offering much more realistic operation with simulated inertia (also known as “momentum”) and braking. In the late 1970s and early 1980s, the advent of switchmode and pulse-width modulation enabled very realistic low-speed operation of locomotives. The pulsed track voltage was better able to overcome track/ wheel contact resistance and motor “stiction”. As well, these electronic controllers were able to monitor the back-EMF voltage from the locomotive motor and thereby provide very good speed regulation, regardless of the load or track gradient. SILICON CHIP has described a number of very good speed controllers incorporating all these features and more. But as good as these electronic speed controllers are, there is still the limitation that you can only control one locomotive or train at a time. That might be satisfactory if you only have a small circle of track but it rapidly palls if your modelling is more ambitious. Inevitably, all railway modellers have many locomotives and they want to run more than one at the same time. siliconchip.com.au A selection of digital decoders which are designed to fit inside model locomotives. Each has a unique address to “pick off” its own packets of data while ignoring all the other packets. If the locomotive includes sound, it will have a sound decoder as well. In addition, the decoder uses the track voltage to produce a PWM waveform to drive the locomotive. Of course, you can run two locomotives if you have two track loops on the one layout board but immediately you want to connect those two loops in any way, you run into serious problems. On larger layouts, to make operation more realistic, enthusiasts took to dividing them up into blocks (or “cabs” in US parlance), each with a separate speed controller, so you could have an operating locomotive in each block. That meant you could have trains running in different directions on a large layout, as well as shunting operations and so on. However, that method still only allows one locomotive to operate on the tracks within a block. So if you want to run more locos, you need more blocks and more speed controllers. That rapidly becomes expensive and the necessary wiring and switching to all those blocks becomes very complex and a nightmare when you have to troubleshoot faults. Then about 30 years ago, a number of model railway companies came up with the concept of “command control” to enable multiple locos to run on a model railway without any need for block switching. The systems included Hornby Zero-One, Dynatrol and CTC-80. A DIY system called the CTC-16 was devised by Keith Gutierrez and the details were published by Model Railroader magazine in the early 1980s. Command control worked by superimposing a serial data stream on the DC supply voltage fed to the tracks. Typically, this would consist of a 5V serial signal added to the 11V or 12V siliconchip.com.au DC to give a total track voltage of 16V or more. The serial data was quite similar to the serial data transmitted to radio-controlled model aircraft, cars and boats to control servos and speed, the major difference being that typically, up to 16 or more locomotives could be controlled simultaneously. In fact, SILICON CHIP published a Command Control system for Model Railways in 1998 but it and all other Command Control systems are now well and truly obsolete, having been superseded by Digital Command Control, or DCC. The precursor for DCC was developed by the German company Lenz Electronik GmBH in 1989 and it was incorporated into models made by Marklin and Arnold. Subsequently, other companies produced similar systems but the American modellers’ association, the National Model Railroad Association (NMRA) recognised that the lack of standardisation would prevent industry-wide adoption of these systems. Ultimately, the NMRA adopted and extended the system developed by Lenz in 1993. It promulgated two standards: S-9.1 specifies the electrical standard and S-9.2 specifies the communications standard. For more information on the standards, go to http://www.nmra.org/ DCC has several big advantages over earlier Command Control systems. First, it can control lots more locomotives on the one model railway layout; up to 99 or more. As well as controlling the speed and direction of each locomotive, a DCC system can also control the locomotive’s lights, its smoke generation (if it is a steam loco) and on-board locomotive sound systems which can be very realistic. An advanced sound system on a steam locomotive may include not only the steam pulses as the locomotive moves, in line with the number of cylinders and the locomotive’s speed, but it may also include the sound of the steam-driven air-compressor, bells and steam whistles. To top it off, such sound systems will usually have been sampled from the real (full-scale) locomotives that the models are based on. Similarly, for a diesel locomotive, the sound system will provide realistic diesel engine and transmission Another typical digital decoder, shown here slightly larger than life-size. The decoders are designed to fit inside the model locomotive but can also be hidden inside the tender in the case of steam locos. February 2012  37 This photo shows a typical DCC base station with its accompanying hand-held controller. As well as independently controlling the speed and direction of many individual locomotives, a DCC system can also control a locomotive’s lights, its smoke generation (if it is a steam loco) and any on-board sound systems. sounds where the apparent engine speed matches the loco speed, and may include the over-run sound of turbochargers, bells, air-compressors, air-brake release and 5-chime airhorns. Again, such systems are based on real locomotives and the effects can be startlingly realistic; certainly not as loud but realistic all the same. As well as controlling the locomotives themselves, the DCC system can control points (turnouts in US parlance), signalling systems, track lighting and so on. Furthermore, some enthusiasts go the whole hog and link the DCC system to a computer and use it to provide CTC (centralised traffic control) on large layouts. It is possible to run a complicated schedule of train movements over a period of several hours and incorporate a “fast clock” to simulate a much longer period of operation. Naturally, DCC provides very realistic low-speed operation of locomotives 38  Silicon Chip as it incorporates all the features of earlier electronic speed controls such as PWM, simulated inertia and braking. Furthermore, to enhance low speed operation, the locomotive’s response to increasing track voltage can be programmed to be more progressive. By way of explanation, typical model locomotive motors do not start to rotate until the applied DC voltage voltage goes above about 5V or 6V. Once this is programmed out, the speed of the locomotive will appear much more linear with respect to what is dialled in on the throttle control. DCC track voltage We have already mentioned that DCC is similar to the Ethernet protocol and that it employs a “packet switching system” to send control data via the model railway tracks to the various locomotives. So DCC uses a microcontroller to generate all the necessary serial data. Each locomotive is sent its own “packets” of serial data and as you can imagine, in a system which can handle of lot of locomotives, there will be a large number of packets being broadcast in the serial data on the railway tracks. In a typical DCC installation, you will have one base station which is essentially a big power supply controlled by the microcontroller mentioned above. The user will have a hand-held remote controller which can individually select every locomotive and all the accessories on the layout. So each packet of serial data is under the control of the user and all packets remain the same until he (or she) dials in a new value to vary a loco speed, switch points, turn on lights or whatever. Each locomotive has its own inbuilt digital decoder with a unique address to “pick off” its own packets of data while ignoring all the other packets. If the locomotive includes sound, it siliconchip.com.au Q1 FROM TRACK MICRO RAM EEPROM Q3 MOTOR 'H' BRIDGE Silicon Chip Binders Q2 REAL VALUE AT $14.95 PLUS P & Q4 P 44V Pk-Pk LAMP DRIVER Fig.1: block diagram of a typical locomotive decoder. It picks up power and data from the rails of the model layout via a bridge rectifier and includes a microcontroller which drives an H-bridge circuit (Q1-Q4). This drives the loco’s motor in forward or reverse using a pulse-width modulated voltage that’s unrelated in frequency or pulse width to the track voltage. +22V These binders will protect your copies of S ILICON CHIP. They feature heavy-board covers & are made from a dis­ tinctive 2-tone green vinyl. They hold 12 issues & will look great on your bookshelf. H 80mm internal width 0V --22V Fig.2: the track signal is typically somewhere between ±15V or ±22V peak (or 30 to 44V peak-to-peak). Each data packet is preceded by two large width pulse transitions, followed by the data. will have a sound decoder as well. The user does not have to worry about controlling the sound features as they automatically change whenever one of the loco’s speed settings is changed. Having said that, the user can sound the loco’s whistle, horns or flashing lights whenever that is desired. As its name suggests, the decoder decodes the packets of data and the same PCB uses the track voltage to drive the locomotive. The bipolar pulse track voltage is rectified to provide a DC rail which is fed to an H-bridge circuit to drive the motor with its own pulse width modulated voltage. And as mentioned previously, it also drives the lighting and other locomotive functions. Fig.1 shows the block diagram of a typical locomotive decoder. Essentially, it draws power and data from the rails of the model layout. As you can see, the micro drives an H-bridge circuit which is more or less identical to those used in any SILICON CHIP Railpower model train controller. The H-bridge drives the loco’s motor in siliconchip.com.au forward or reverse and with a pulsewidth modulated voltage which is completely unrelated in frequency or pulse width to the track voltage. That makes sense but it is a little mind-boggling that you could have 20 locomotives simultaneously operating on a large layout, all with different speed and direction settings and all unrelated to the track signals. Fig.2 shows the track signal and it is typically somewhere between ±15V or ±22V peak (or 30 to 44V peak-to-peak). Each data packet is preceded by two large width pulse transitions, followed by the data. Two scope grabs of an actual DCC track signal are included in this article. If you look closely, you will see that the nominal track voltage is close to ±15V peak or 30V peak-topeak. However, there is about 7V of overshoot on each pulse transition. Notice that the signal waveform is exactly bipolar and there is no DC component. The signal frequency is around 4.7kHz. (Some DCC base stations have a feature whereby they can control H SILICON CHIP logo printed in gold-coloured lettering on spine & cover H Buy five and get them postage free! Price: $A14.95 plus $A10.00 p&p per order. Available only in Aust. Silicon Chip Publications PO Box 139 Collaroy Beach 2097 Or call (02) 9939 3295; or fax (02) 9939 2648 & quote your credit card number. Use this handy form Enclosed is my cheque/money order for $________ or please debit my  Visa    Mastercard Card No: _________________________________ Card Expiry Date ____/____ Signature ________________________ Name ____________________________ Address__________________________ __________________ P/code_______ February 2012  39 Fig.3: this scope grab shows the bi-phase encoded signals used to control DCCequipped locomotives. The decoders also rectify and filter this AC waveform to power the motors and any accessories such as lights and sound-effect circuitry. FROM TRACK 44V Pk-Pk MICRO RAM EEPROM AMPLIFIER SPEAKER Fig.4: the block diagram of a typical locomotive sound decoder. It has a bridge rectifier and microcontroller which drives a small amplifier and loudspeaker. non-DCC locomotives. The method involves deliberately changing the duty cycle of the DCC waveform so that it does have a varying DC component to drive the motor. However, this practice cannot be recommended since it applies a high AC voltage to the loco motor which can cause considerable heating, especially with coreless motors). Fig.4 shows the block diagram of a typical locomotive sound decoder. Again, it has a bridge rectifier and a microcontroller, the latter driving a small amplifier and loudspeaker. Naturally, depending on the scale of the locomotive, the speaker is quite tiny and is housed with the loco’s body or the decoder and loudspeaker may 40  Silicon Chip in the tender, in the case of a steam locomotive. While the block diagrams of Fig.1 & Fig.4 are quite simple, the actual decoders are surprisingly complex. What makes it all possible is that they use surface-mount parts; it just would not be possible if conventional thoughhole parts were all that were available. Other accessory decoders are similar in principle to that shown in Fig.1, as all use a bridge rectifier and microcontroller. However, they may have solenoid or motor drivers in the case of points (turnouts) or lamp drivers in case of track signalling or lighting. Adopting DCC So if you are a keen railway modeller and you are contemplating changing over from a conventional model layout with block wiring, what do you need to do? Can you run DCC and non-DCC models on the same layout? The answer is “yes but”. There are two approaches you could take. First, you could continue to employ the conventional block wiring system and your existing train controllers together with a DCC base station and one or more DCC-equipped locomotives. Then you could switch control of DCC locos through the various blocks as you would in a non-DCC system with conventional train controllers. What if your layout has no block switching? Then you are rather stymied unless you have a DCC base station which can be set up to drive non-DCC locomotives, as mentioned above. But as noted, the process is definitely not recommended. Which leaves you with biting the bullet and just going straight to the DCC approach: buy a DCC base station and as many DCC decoders as you need; one for each locomotive. Points, signalling and lighting decoders can come later. Your main expense will be the DCC base station and controller. Since all decoders are compatible with all base stations, you can shop around for decoders and they can be picked up very cheaply. Fitting the DCC decoder to each locomotive is matter of pulling it apart and first finding the space to install it. Then you have to disconnect the loco’s motor from the track collectors and connect those wires to the power input on the DCC decoder. Then you take the two output wires from the DCC decoder and connect them to the motor. Connecting the loco’s lights can be trickier but is essentially straightforward. It is then simply a matter of securing the decoder and re-assembling the loco. Making your own decoders is really not practical since they are so tiny and densely packed with surface-mount devices. And they are really quite cheap – shop around on the internet. Similarly, in view of their complexity, building DCC base stations and controllers is also not practical. However, we would not rule out DCC projects from appearing in future issues of SILICON CHIP. The most obvious one is a DCC booster, to increase the current output of any DCC base station, SC to cater for large layouts. siliconchip.com.au