Soldering
Turnouts
Track
Parts
Locomotives
Q&A Forum
Turnout Control
Sound
Booster Network
Decoder Installations
Block Detection
Wire Resistance
Site Map / Index
DCC for Beginners
DCC in the Garden
HO RR Photos
Home
Manufacturers
DCC Topics
Garden Rwy Photos
Block Detection
Signaling
     

Computer-aided Model Railroading

Please be sure to see Do It Yourself  for others interested in developing computer control systems. See the Manufacturers page for software that you can buy or get free to operate your model railroad.

What Should You Display On Your Computer?

When you first consider signalling and block detection, you probably envision displaying the signals on your computer display. Yes, red, yellow, and green in both directions. But after acting as dispatcher for a friend's layout, I think this is unnecessary.

As dispatcher, all I really care about is block occupancy and mainline turnout position. JMRI color codes the locomotive icons so I know what direction they intend to go. A final note on turnout position: Turnouts do not have to be DCC controlled to display their position on your dispatcher panel. (Dispatchers often control mainline turnouts, but this is not required for position indication.) Note that I'm suggesting that block detection without signals is very useful and may be all you need; meaning install block detection and signals later as time and money allow.

Why not display display all the aspects? After all, that would look really cool, wouldn't it? The display would be uncluttered, you could make the layout map smaller, and most importantly, you could use fewer monitors. I had envisioned using three monitors for my layout, but with this new thought, two should do it; maybe even one! If you do opt for displaying signals, consider using the searchlight type on your computer display to minimize the clutter on your display.

How many blocks should you use between towns? See my section on block detection.

After having acted as dispatcher on several railroads, road crews are not as disciplined as a real road crew would be. After all, this is supposed to be fun and no one is operating under the threat of losing their job. So no matter how hard you try to get road crews to tell the dispatcher what they are doing, they will do something they shouldn't. For example, they will proceed to the next town without checking with the dispatcher. This leads to "cornfield meets" (collisions). So even if you don't have block detection, consider putting in at least red and green signals on your layout and then try to get your operators not to blow past red signals. So while you don't need every aspect displayed on your control panel, a simple control and indication would be appropriate for this type of layout.

INFORMATION #15-1:  For Information DCC Control of Turnouts, Go To the Section On Turnout Control.

INFORMATION#15-2:  Manufacturers and Non-Programmers:  An Argument For Ladder Logic.

Non-Programmers:  Read this.  If you like it, let your favorite manufacturer know!
Manufacturers:  Consider this alternate method for programming your computer control systems.
 

I've programmed in just about every high level and assembly language there is.  Like many programmers, I thought ladder logic was a joke.  It's no joke.  For some applications like controlling machines (read model trains), it's ideal!  It's worth a serious look.

Most PLCs program using a graphical interface that shows relay contacts.  This method of programming is even easier to learn than procedural language programming like C or BASIC.  Many people who wouldn't dream of trying to learn to program a computer, do ladder logic and do it well.  This is because that for the most part, ladder logic could really be implemented using relays.  This is a visualization process that is easier to grasp than bytes, memory pointers and for-next loops.  This makes it very popular.

Here is the above as it might be written in a computer language. With the exercise you just did, you should be able to make sense of this below.

If B_Occupied or T1_Thrown Then Red
If Not(B_Occupied) and C_Occupied and Not(T1_Thrown) Then Yellow
If Not(B_Occupied) and Not(C_Occupied) and Not(T1_Thrown) Then Green

Which approach agreed with you more?  If you thought you understood it, but now you don't, don't feel bad.  Now you appreciate ladder logic!

Below is an example of what you might see if the T1 turnout is thrown.  In this simple example, T1 being thrown is all it takes to cause the red signal to light.  It shows that blocks "B" and "C" are not occupied. Any input that is active is highlighted.  Then the power is highlighted from left to right as far as it can go.  Only the first rung makes it all the way across.

Troubleshooting is a breeze, too.   I have been called to assist repair of machines that were totally unfamiliar to me.  All I had to do was ask, what is the next thing this machine should be doing if it was working right?  I'd search for the output that controlled that function. Inputs on the screen that were active would be highlighted.  Just look at the rung from left to right, looking for inputs that weren't active, but should be.  Then the sensor for that input was bad, needed adjusting, or a wire had broken or come loose.  Total time to identify problem: under 15 minutes.   In a model railroad, look for the block that has a train on it, but its input wasn't highlighted.

What makes ladder logic so successful as a troubleshooting tool is the graphical user interface.

So manufacturers, please give this some serious thought.   I realize is a simple example.  I'll be glad to discuss with you how ladder logic deals with timing, latching, comparing, counting, and more complex issues like math, dealing with data files and communicating on a network.   I made those PLCs justify their cost every day!

A-B, I believe, now has their PLC-5 series being emulated on a PC.  They are proud of their products and charge accordingly.  I have a few good contacts at A-B and might be able to get to someone in A-B who might be in a position to licensing some bit of their technology at a reasonable price.

FAQ'S

FAQ #15-3:  Can I Use A PLC?

A programmable logic controller is an industrial control computer. It should not be confused with a PC — the personal computer you are using right now.

PLCs use something called ladder logic.  When graphically displayed, it looks like rungs on a ladder.  See above.

Many have logic elements that light up as a particular input is made.   Allen-Bradley's progressively lit rungs make troubleshooting easy.

Until I actually worked with PLCs, I looked down at them as most programmers do.  I was a hard sell.  In the old days, they simply mimic'ed relay logic — which was the use of relays to control things.  How smart could a cabinet full of relays be?  Not very!

The modern PLC is sophisticated.  It is ideally suited for controlling many things at once — like several model trains!

They typically have LEDs on their inputs and outputs.  So looking at the front of the PLC, you can get a good idea what inputs the system is getting and what outputs it is controlling.  In a factory, this is a big plus.  Many technicians can troubleshoot a machine without hooking up a terminal to the PLC and looking at the program.  If programming isn't your bag, this is very nice.

Of A-B, GE, and Siemens — the three biggest PLC manufacturers — A-B was by far the best.  Easiest to use, reliable, system software that was bug free, operated just like the manuals said, and never crashed.  Don't you wish your PC and its system software could be like this???

The systems that have lots of inputs and outputs are quite expensive.  They do offer scaled down versions that are ideal for running things like candy machines.  These units have limited expandability and typically have more inputs than outputs - since the typical machine needs more inputs than outputs.

Anyone thinking a PLC for model railroading is probably thinking signals.  Here you need a lot of outputs compared to inputs.  So these low cost models are not usually adequate for our needs.

Another thing to watch out for is that many inputs on these industrial machines are looking for 16-24V for an input signal — since 24V is what is typically used to run machine controls.  Some DCC block sensors only put out about 5V.  Typical PLC inputs would not detect this.

The way to look at PLCs is to see if you can do what you want to do for less than $14 per function.  That's what a function, like a crossing signal, costs on a DS54.  The DS54 can operate rail switches, crossing signals, and a few other things for the creative modeler.  And you can network it, too!

While I feel that ladder logic is ideal for programming your DCC computer control system, the lack of low cost PLCs with lots of outputs makes them an uneconomical choice.

The one place a PLC may be the right thing is turntable control.  You still have the problem of it not talking to your DCC network.  Using DCC products on the market today, I haven't worked out how this might be done.  In about a year, I will face that challenge.  So stay tuned.

FAQ #15-4:  DO I Need A Computer for DCC?

Absolutely, positively not!  Unless you buy a super low cost DCC system that says "uses your computer to save you money," the answer is definitely no. The mainstream systems on the market today do not require a computer.

FAQ #15-5:  Would A Computer Help Make DCC Easier to Use?

Except for loading speed tables, the answer is no. For one thing, the current DCC systems are not that hard to use. For another thing, a computer is hardly a walk around throttle!  Lastly, setting up a computer to display your layout, indicate block detectors, and turnout positions is a good bit of tedious work.  If you are brand new to DCC, trying to start out with a computer is a good bit of additional complexity you don't need.  As I noted above, most DCC systems will work just fine without them.

Adding a computer later won't obsolete anything you buy now.  So take two small steps — buy a DCC system, add a computer later — rather than a quantum leap to the computer.

IF YOU WANT TO GET SERIOUS ABOUT USING SPEED TABLES, then yes, a computer will make it much easier.   Setting up speed tables without a computer is tedious.  Fortunately, using a computer to set up speed tables doesn't require you to be a computer programmer.

Computer Control Software Suppliers

Please see the Manufacturers section for suppliers of DCC computer control software.

Roundhouse Track Power Control When Using a Walthers Turntable Advanced Control Module

Using Walthers ACM and 24 relays to control roundhouse stall tracks.
Relay cards (blue, left), Breakout Board (BOB - white, center) and ACM (green, right).

The Walthers ACM (Advanced Control Module) is capable of automatically driving relays that apply power to up to 24 roundhouse tracks when used with low cost relay cards.

You will need to be using the current generation of Walthers turntable wih the blue controller and the numerical display in the middle. You will not be able to use a turntable with the older gray controller that doesn't have the numerical display in the middle. You will need to buy a new turntaable if you have the gray controller as this older model is not upgradeable.

The Walthers Advanced Control Module for their turntables. Note the three jumpers in the upper right portion of the photo. In normal operation, you will be using them just as shown. You will using the relay connector in the lower left of the ACM. More on the ACM and how to hook it up to your turntable is covered in the "DCC Currents" column in the July 2021 issue of Model Railroader.

Conceptually,relay control of your roundhouse tracks is simple. You just connect the output of the ACM to the relay card. If you would have had a switch for each roundhouse track, a relay on a relay card replaces that switch. Daisy chain ACM +5V, Relay card ground, add a +5V to drive the relay (DO NOT connect ACM +5V aka VCC and the relay +5V aka JD-VCC!). If you are careful, it will work just fine like mine.

There are a couple of ways to approach doing this and some ways are a little cheaper than the approach I used. Before I describe how we did it, I'll briefly describe some of the alternate ways.

#1: Direct wiring - You can use a wire wrap tool, if you can find one, to run wires from the ACM to the relay cards as well as daisy chain the ground and supply voltages. The disadvantages are: One, you will have a rats nests of wires that will be hard to trace. Two, if you have to replace a relay card, or worse, the ACM, you will have a real nightmare on your hands.

#2: Home brew break out board - Using a perf board, you can make your own break out board. No a bad way to go, but it will take you several hours to make.

#3: Custom-designed break out board (BOB) - Can be soldered up in a matter of minutes and there is no chance of making a wiring error as could be done in #2.

Break Out Board (BOB)

I will now describe how Jim Grossen and I chose to do it.

I have a lot of roundhouse tracks, so I used all possible 24 tracks that the ACM supports. Below is a simplified wiring diagram.

I used six relay cards that each have four relays. I bought these at All Electronics for $8 each. So for $48, I was in business. I think you can also buy the same card from eBay. I found relay cards sold by others, but they cost about six times as much. Ouch!

To keep things from looking complicated, I only show one relay card below. On the wiring diagram, I only show connection for the BOB and one relay card. Look at the photo of the BOB for support of all six relay cards.

I suspect few people will have 24 round house tracks. So only buy as many relay cards as you need. On the BOB, you can leave out the 7-pin headers you don't need. Each header only costs about a quarter.

Again, to keep things simple and uncluttered, I only show one roundhouse track wired below. There are four sets of three terminals for the relays. The center terminal of each relay goes to your DCC track bus "A" wire. You can daisy chain each of the center screws together. Then the right screw goes to one of your roundhouse track rails. The DCC track bus "B" wire goes to the other rail of your roundhouse tracks.

Note: The BOB only supports what is known as "active low" relay cards. This is the most common. We didn't want to overly complicate BOB for active high boards; especially when they cost a lot more and modelers probably would not want to get them.

This was the prototype BOB. BOB is easy to assemble and can only be assembled one way. You can't screw up! It has no delicate electronic components. Note that on the newer boards (green), we rearranged the pins a bit. We discovered after we received the white ones that the relay card as sold does not match its schematic. By rearrangeing the pins, it is easier to wire up and matches the header on the relay cards.

This is the final BOB. It has the pins rearranged to better mate to the relay board below. Like the prototype, there is only one way to assemble it, so you can't screw up.

I do not sell the BOB with any parts. I will sell you one BOB for $6 using Paypal, including shipping within the United States. Just email me at: bigboy@WiringForDCC.com. If this project is popular, I will order more and may set up a eBay store.

The relay card. Note that the labeling on the relay card's 6 pin header matches the arrangement on the green BOB. Remove the jumper from the JD-VCC pin and place it so that it only covers the VCC pin next to it.

At the moment, you can get it from All Electronics (https://www.allelectronics.com) or eBay. If you find another relay card that is different than this one, you will be on your own for figuring out how to hook it up. If you use my BOB, you will need to use a relay card that uses active low inputs. While the ACM supports active high, the BOB does not - I didn't want to make the BOB too complicated.

The parts you need don't cost a lot. The bummer is that no one place sells everything you need. Below is your shopping list and suggest places to get them.

eBay is a popular place to get parts inexpensively. You never know what you are going to find at any given time. Because if this, there is only one part you need to buy from eBay that I couldn't find at a normal distributor.

Your shopping list:
Supplier Description Part Number Qty Comment
All Electronics 4 relay card, active low RLM-4   Buy in groups of 4 as needed.
All Electronics 26 pin ribbon cable with connectors on each end CBLR-26 1  
All Electronics 2x40 male header DHS-40 1  
All Electronics 1x40 male header SHS-40 1 or 2 Break off groups of 7 as needed. You will only need 1 if you are using 5 or less relay cards. Order 2 if using 6 relay cards.
All Electronics 2.1mm power jack DCJ-1 1  
All Electronics 40 conductor female to female cables

JFF-20 (7.25")
JFF-30 (11.25")

  They come in 7.25" and 11.25" lengths. If you need longer, you can get male to female ones to make extensions. The colors repeat on the 40 conductor cables. I suggest you use the same seven as you go from your BOB board to the relay boards.
Jameco 5VDC, 750mA, wall transformer 2230408 1  

Note: The pandemic has made some things hard to get. I have heard that Mouser is out, too. Here is a source on eBay that not only has the connector, but they provide an assembled cable for you.

26-Pin (2x13) Female to Female 2.54mm-Pitch 26-wire IDC Flat Ribbon Cable | eBay

 

Preparation:

1. Assemble your BOB. It only goes together one way.

2. Install your ACM by hooking up the cable to your turntable's controller.

3. If you are controlling your turntable with DCC, hook up the ACM to your DCC track bus. You will need to assign DCC accessory addresses to your roundhouse tracks. See the July 2021 "DCC Currents" in Model Railroader.

4. Prepare the 26 pin ribbon cable and connector. Make it look like in my photo. This doesn't need to be any longer than you need. Assemble the cable and connector by laying the ribbon cable in the connector, then use a channel lock pliers to close the back of the connector onto the insulation-piercing tines. Don't adjust too tight and crush the connector! As long as the back is all the way on the connector and the ears on the back can mate with the connector body, you are good. You will likely need to crimp each back three times - left, middle, and right.

With an ohm meter, check that pin 1 of the connector at each end has continuity. Check pin 2. Check a few other pins at the opposite end as well.

5. Remove JD-VCC/VCC jumper on relay card. Place the jumper over the VCC pin leaving the JD-VCC pin exposed. You will be hooking up the JD-VCC pin in a moment.

Installation:

Install a little bit at a time and test as you go. Follow what I tell you carefully and your installation should be as successful as mine was.

1. Connect your 26 wire cable between the ACM and the BOB. I noticed that my 26 pin connectors had not crimped on the cable completely square. Electrically, it was good. So if you don't get yours perfectly square, it is not a big deal. The key thing is that when you screw down your BOB, make sure there is no strain in the cable. This could present a problem over time.

2. Mount your first relay card. Prepare a seven conductor cable of Dupont connectors. Carefully connect the seven wires to the BOB for the first relay card. Then connect the other ends to the relay card. Make sure the connections and colors on the BOB match with the relay card. Note that white and gray are next to each other and are nearly the same color. Make sure that you don't have any crossed connections.

You will notice that the BOB has 7 positions and the relay card has 6 side-by-side. The seventh wire on the relay card goes to the JD-VCC pin.

3. At this point, you can run some initial tests of the relay card. Move your turntable to the first four positions. A LED on the relay card should light corresponding to the first four tracks as you go through them. When all four LEDs light for the four tracks, you can pat yourself on your back. You did good.

4. Connect your wall transformer on the BOB. Now test your four tracks again. This time, you should hear relays clicking. Time for another pat on the back.

5. Now connect the "A" track bus wire to the center screw for the first relay and connect the right screw of each of the three screw groups to your "A" rail round house track number one. Connect the "B" track bus wire to your "B" rail fo the same round house track.

Command your turntable to track number one. A loco should be able to roll off the turntable and onto the first track. Make sure your loco goes completely off the turntable so that you are sure it is getting power from the first track.

6. Repeat step 5 for the three remaining relays on the first card.

7. Install your next relay card and repeat steps 2 through 6.

You are done! Time for the beverage of your choice!


 
GENERAL
FAQ's
Walthers Turntable
ACM Relay Control
 
 

Copyright by Allan Gartner 1996 - 2022 © All rights reserved. You may print this for your own, personal, non-commercial use. Non-commercial, non-personal reproduction may be requested by visiting www.WiringForDCC.com/writeme.htm . All users, commercial and non-commercial, may link only to this site at www.WiringForDCC.com.

Thanks to all who contribute to this site and the Q&A forum!