Tuesday, February 28, 2006

Feedback blocks

image

I’ve divided the layout up into blocks. The blocks feedback the position of trains to the software. The software can use this information to control the trains. For example if a train approaches an occupied block it can slow to a stop at a (currently theoretical) signal.

Each block is connected to a Lenz LB101 block detection module. Each LB101 can ‘sense’ two blocks. These are then wired to an LR101 feedback module - each LR101 handling four LB101s, ie eight blocks - which send signals to the computer via the command station.

Note that all the DCC system sends to the computer is an ‘occupied’ or ‘not occupied’ signal. It doesn’t tell the computer which train is actually in that block. With newer decoders such as the Lenz Gold Mini capable of two way communication this may become possible in the future, but for now, it is up to the software to remember which loco (or locos) is in each block.

The Software Side

So the software has to be told which train is in which block. It also needs to know which direction the train is heading. When a train enters a block it looks further up the line for the next block and, like a real signalman, asks the next block for permission for the train to enter. If the block is empty, the train proceeds.

However, if the block is already occupied, or the block has already given permission for a train from a different direction to enter the block, it denies access for the new train, and the first block stops the train until the next block becomes free.

But that’s a little too simple. Using that system trains would be stopping at the start of blocks, or even in the middle of blocks once they have decelerated.

The diagram above shows my solution. The diagram shows the anti-clockwise loop of the layout, with trains entering from the right. Blocks A, C and E are the standard blocks as described above. There will be signals just past the end of the blocks and just before each set of points. Block C is the station platform.

The diagram shows two extra blocks at B and D. These I refer to as ‘stop blocks’. Their sole purpose is to detect when a train is very close to the signal. Thus the software can detect when the train is at the signal, and make it stop at the correct position if the signal is at red.

So the full system will work as follows: When a train enters section A, the computer asks permission to enter block B. Block B is simply a short stop block, so it only allows a train to enter if both itself and block C are available[1]. If block C is free the train proceeds normally.

If block C is not available the train will decelerate whilst passing through block A (just as a real life train would after receiving a orange signal. As the train enters block B the state of block C will again be checked. If it is now available, the train will now accelerate again, as if passing a green signal.

If block C is still unavailable, the train will be stopped. Since the train has already slowed down while passing through block A it can slow to a gentle halt, rather than the emergency stop it would have to do if it where still travelling at full speed.

Once block C becomes available it will query it’s neighbouring blocks to ask if any of them have a train waiting to enter. If so one of them will be given permission to resume it’s journey.

The same set of actions will be repeated with sections C, D and E.

Well that’s the theory anyway. Most of that capability is built into my software now. I’ve even had a train successfully stop at a signal and resume it’s journey afterwards by placing and removing a resistor on the track, but the software has a habit of sometimes forgetting which train is where, especially when I tried having two trains running together. So I’d better get back and hunt some bugs. See ya next time.

[1] In a fully developed system blocks A and B should operate as one block when allowing a train to enter. Ie. a train can only enter block A if block B is already empty.

Posted by Mike on 02/28 at 03:17 PM
DCCSoftware • (1) Comments • (0) TrackbacksPermalink

Saturday, February 18, 2006

The Basics of DCC: The hardware

There are two major ways to control a layout: DC and DCC.

DC is the traditional method. When you operate the controller any locomotives which are in a ‘live’ section of track will be controlled. This means that if you want to, say, do some shunting in the goods yard while a train runs around the main line you will have to add a second controller and provide some switches to select which sections are operated by which controller. It can get complicated, especially on a large layout.

With DCC the entire layout is live all the time. Each loco has a decoder (or chip) inside with a unique ‘address’. In the handset you select the address of the loco you want to drive. Once you’ve started one loco moving you can select a second loco and drive that while the first one continues on it’s way. You can back a second loco onto the front of the train and easily create a ‘double header’ and it’s especially useful in a locomotive depot setting where many locos can be parked on the same section of track without the need for lots of separate sections.

If you have more than one operator they can each control a train without having to select sections in which to apply power. They can even both drive a train along the same section of track, they just have to be careful not to crash grin

It’s a simple system but many people are put off using it, probably due to complicated sounding terms such as ‘programming’ and also the process of fitting decoders to the locos.

In this series of articles I will describe the basics, which I hope will give you the courage to take the plunge into DCC.

What do I Need?

image
Lenz LH100 handset.

There are a wide range of DCC systems available, each with there own features, so what do they all do?

There are four parts to a DCC control system, but many systems combine various parts into a smaller number of boxes:

  • A transformer provides low power for the other parts of the system as well as powering accessories such as turnout motors.
  • A controller (or handset) is what you actually use to drive the trains. It can use either a traditional knob or a push button interface. Which one you choose will be a matter of personal taste. The controller will also have additional controls for selecting the loco to drive, for switching ‘functions’ on and off (eg for lighting) and for settings the decoders settings (commonly termed programming).
  • A command station interprets the commands from controller and turns them into a signal which will be sent to the track.
  • A power station amplifies the signals from the command station to sufficient strength to power the trains. You may need additional power stations if you have a large layout.

As I said earlier, most systems combine more than one of these items into one. The entry level systems may even combine all four elements into one box. If you buy a complete system from any of the manufacturers it will include everything you need to get you started.

How do I Choose a System?

The system that best suits you will vary depending on your needs. A basic system may only operate a small number of locos, a top of the range system will allow you to operate the whole layout from a computer.

The chief variations you will find are:

  • A simple system may only let you choose from a dozen locos, with each selected by a single button, a full system will let you select locos by number with almost 10,000 loco addresses available. In particular look at whether the system uses four digit loco addresses (loco numbers 1-9999) or two digit addresses (numbers 1-99).
  • Most decoders have one or more function outputs used for controlling features such as lights and sound modules. If you want to use functions you’ll need a controller that can control as many functions as you want to use.
  • Whichever system you choose must be able to provide enough power. As a rule of thumb an N gauge loco needs about 0.5 amp, an OO/HO loco about 1 amp. Add up the total for the number of locos you want to run at any one time to get the total power rating required. (If you need extra power you can add extra power stations - if your system supports this.
  • Can you add extra handsets? If you have friends over to help with running the layout a second (or third) handset will be essential.
  • All decoders have features that you can program (an ugly expression that simply means you are setting certain values on the decoder). You’ll want to be able to set the address that the decoder responds to, and all systems will let you do that, but more advanced systems will let you fine tune the performance of the locos motor control, set options for flashing lights, etc. If the advanced stuff interests you choose a system which can do it, and which also makes it easy to do.
  • Some systems will allow you to operate two or more locos together in a double header or, using the American expression, a multiple unit.
  • If you want to be able to switch turnouts through the controller, then make sure your system can handle it.
  • An advanced system will let you add feedback modules. These can report the state of the system to the handset or, via a computer interface, to a computer.
  • I mentioned using a computer interface in the above section, and if this is something that interests you, you’ll need a system which can be connected to such an interface.
  • Unless you’re very lucky you’ll also need a system which suits your budget. There’s little point buying an all-singing-all-dancing system if your needs can be easily satisfied by a starter system. On the other hand if you aren’t sure exactly what you want it may be worthwhile looking for a system that can be expanded as your experience and needs increase.

Note that any NMRA compatible systems can work together. So a controller from one manufacturer can seamlessly operate a loco using a decoder from a different manufacturer. This means you can easily expand your system and change manufacturers. However, this only applies between the controller and the decoders. You can’t always take, for example, a handset from one system and combine it with a command station from another.

Choosing Decoders

image
A Lenz Gold Mini decoder, suitable for N gauge.

You will find many people with highly polarised opinions in the DCC world. Some swear by a particular manufacturer and won’t touch anything else, others will try different decoders in a loco until they find the one that gives extra smooth control. In my view that’s a bit like the guy down the street who spends every Sunday afternoon tweaking his car: fiddling under the bonnet, putting on low profile tyres and changing the suspension. The rest of us are perfectly happy with our cars as they left the factory. And it’s the same with DCC, most decoders will provide good performance with most locos. If you want to be a ‘tweaker’ that’s up to you, but you should get on perfectly happily with what comes out of the box.

The chief buying factors for a decoder are:

  • The size. What space is available in your loco? A OO gauge diesel will have more space available than an N gauge shunter.
  • Make sure the decoder can provide enough power for your loco. Assume you’ll need 0.5 amps for N gauge and 1 amp for OO/HO.
  • How many functions can it control? If lighting is important to you you’ll want a decoder with enough outputs.
  • Some decoders only allow two digit addresses (addresses 1-99) others allow four digits (addresses 1-9999). Even if you don’t need 100 locos you may find that selecting a number appropriate to the loco is easier with four digit addressing.
  • Different decoders can use a different number of speeds. If you use a decoder with only 27 ‘speedsteps’ you may notice less smooth acceleration and deceleration than one which has 256 different speeds.
  • And finally price, the smaller a decoder and the more functions it has the more expensive it’s likely to be.

If you have an NMRA compatible control system then you can use any NMRA compatible decoder, whatever the manufacturer.

As ever, if you have any feedback on the above text feel free to click the ‘comments’ link below.

Next time I’ll look at how to wire the track up and how to get your first train running.

Posted by Mike on 02/18 at 03:47 PM
DCCArticles • (0) Comments • (0) TrackbacksPermalink

Thursday, February 09, 2006

Introduction to the Software

image

When I bought my DCC set I included a Lenz LI101F computer interface. As a computer buff, with a desire to automate things, I couldn’t resist the temptation to build a computer controlled layout.

I intended to buy software to do the control and people seemed to be recommending Friewalds TrainController. I downloaded a trial version. At the time the only layout I had was a small double track oval. No point motors. No feedback modules. All I could do was use a throttle to control the trains.

This was definitely overkill for such sophisticated and expensive software. And I also found that the trial version kept timing out after a very short period. (They, of course, don’t want people using the software for free, but I felt I needed longer playing time to decide whether I liked it or not). So for the time being I stayed with the hand controller.

But as a nosey sod, I couldn’t help but take a peek at the on-CD instructions that came with the PC interface. At eighty pages of techno talk they where enough to put any sane individual off writing his own software. But I’m a fairly good Delphi programmer. And I really wanted computer control.

So, one afternoon, like an alcoholic dramatically falling off the wagon, I started writing some code. Actually, once you get down to it and realise that the worst of the technical stuff is completely irrelevant stuff that only affects the communications between the PC module and the command station I realised it wasn’t so difficult at all.

It’s just a long list of commands and responses that need to be implemented: “Set loco speed and direction”, “Set loco functions”, etc. It was just a case of starting at one end and working my way to the other.

So after a couple of afternoons work I had a basic throttle available on the computer, and was enjoying a thrill from driving a train via the PC that, for some reason, isn’t present when using the hand controller. Maybe it’s just because I wrote the software, a bit like the way food tastes better when you’ve cooked it yourself.

Feedback

So it was Christmas, and I was making plans to start on the proper layout. I needed to work out how to do feedback and turnout control from the PC in order to know how to build such things into the layout from the start rather than having to modify it later.

So I wired up some block sensors and a feedback module to a small test track and made a start on adding feedback code to the computer. All fairly simple - if you know how.  big surprise

I’d pretty much decided that adding a nice layout plan to the software with the ability to switch points and plan routes would be great but probably best left to a proper piece of software. But I fell of the wagon a second time and found myself writing code for a pretty layout designer, to which I added my feedback modules.

The Present

Which brings things to the current date. With the outside loop of the layout laid and wired I was soon bored with running a single train around at a time. I wanted my computer driving the trains. Which, with the current layout, basically means I want a passenger train which stops at the station with every loop and a goods train which slowly follows. The fast passenger train being checked at the signals when it catches up with the goods. The goods waiting outside the station while the passenger stops to pick up and set down passengers.

And from there a want the computer to select a road into the fiddle yard for me and to choose which train to run so I can sit back and just watch trains go by.

Posted by Mike on 02/09 at 08:51 PM
Software • (0) Comments • (0) TrackbacksPermalink

Thursday, February 02, 2006

First Train

image

A useful tip on Steve Jones‘ site is to install the DCC components on a drop board. This is a plank of wood attached between (in my case) the baseboard legs. The DCC modules are attached to the board which can be disconnected and removed as a whole when any work on it is necessary.

So I’ve wired up the first board to control the left hand (western) end of the layout - or at least the trackwork laid so far. I attached the dropper wires for a section of track, switched on the controller, popped a loco on the track and started my first loco moving.

Or not. Nothing happened. Ten minutes with a test meter left me looking at the wiring of the dropper board. Had I missed out a connection to the K wire from the command centre? A swift look at the manuals on the PC showed I had. (Why are the manuals supplied with the Lenz modules all in German? At least they have English versions on the website, an essential download).

So the missing wires where added and everything switched on again. Short circuit. Switching off and poking around with the test meter again showed that all the wiring was correct. It had to be something shorting on the track itself. There weren’t any tools or bits of bare wire left across the track. The dropper wires where all connected the right way around.

Then I switched one of the points. No short circuit. A quick drawing on a piece of paper showed why.

Now I knew that when you where wiring points you had to put an insulating joiner for each of the frog rails for a cross over, but I didn’t realise this also applied to passing loops. When the points at each end are set the same way (i.e. both for the same route) there’s no problem, but when the points are set for differing routes - BAM! Short circuit. If I’d have bothered to read the instructions with the points I’d have known this but I’m a man so, of course, I don’t do things like that.

Actually if I’d read the instructions I’d have also made lots of unnecessary breaks. They tell you that the outer rails of a passing loop also need to be broken, though for the life of me I can’t see why - at least for DCC. For DC they may indeed need that if you are using more than one controller, say one at each end of the loop, and you need to stop the controllers shorting each other out. But for a single controller setup it definitely feels like overkill.

But that’s enough digression. I’ve added the extra insulating joiners, connected a few more block sections and I can now run trains, at least on that end of the layout.

And now on to the other end of the layout. Or I will when I get more wire. In my mind ten metres of wire was a huge amount for such tiny trains. But it’s not hard to realise that that doesn’t go far when you’re running wires to and fro along an eight foot long board. So I’ll try again, this time with a hundred metre reel.

Posted by Mike on 02/02 at 08:40 PM
The Layout • (0) Comments • (0) TrackbacksPermalink