Computer Automation


Note that the smaller pictures can be enlarged by clicking on the images.



The loft layout has not moved forward for a number of months due to the ongoing locomotive and rolling stock projects listed in the Model Rail index page.  However, this has enabled me to do a bit of thinking about the possibilities of applying computer automation to train operations.

This ongoing webpage will be used to describe how the project progresses..............


The options:

I have to replace my Bachmann Dynamis DCC controller as even if I added the Pro-Box, there is no computer interface. So lots to think about!

The Hornby Railmaster system (using the Elite DCC controller) offers the prospect of pre-programmed automation sequences that could e.g. handle the sound and lights sequence at station stops. But it doesn't currently have any feedback capability to provide real time train position information. Without this, it can't protect the layout against collisions.

Going to the other extreme, Railroad & Co have a train control package called "TrainController", which in its most sophisticated "Gold" version, will not only protect against collisions, but can auto route the trains around the layout to make best use of the tracks available. I'm hoping the slightly less expensive Silver option will do most of what I'm looking for.  A DCC system that includes active feedback detectors is required. e.g. Lenz 100 starter system with block occupancy detectors, DCC points control with feedback....and of course a USB PC interface.

The Lenz system has all the building blocks I need although some items are a bit on the pricey side.



The Lenz System Block Schematic:




LDT Occupancy detector feedback module within the Lenz System

This provides a lower cost, but sound technical solution to block occupancy detection compared to the equivalent Lenz modules.



Getting up to speed:

The TrainController software manual takes you through a quick start sequence, using a simple 4 block track arrangement with two sets of points. So I've decided to make up a test track in this configuration to start getting to grips with the system.



       A revised view on points operation:



Another look at points operation:

My earlier manually operated points system can be somewhat simplified by modifying the Peco points. The problem I had used a second relay to overcome, can more simply be dealt with by removing the electrical connection between the electrofrog and the moving point blades. Peco make this operation an easy job by fitting a couple of welded wire links on the underside of the point, which can easily be removed. I also added some new wire links between the outer fixed rails and the adjacent inner tracks, to reduce dependence on the blade contacts. Details are shown below:


Points underside before modification


Modified points underside


Peco motor and switch fitted

Top view of the modified points


Peco point motors (low current type) and the Peco change-over switch were used to avoid the need for careful alignment of the alternative Seep motors.


The TrainController software provides a track layout diagram on the PC screen, illustrating the points routing. However, points switching will be controlled automatically by the PC, based on the route data specified in the programme inputs. This removes the need for a traditional manually operated mimic switching panel. The software can even provide auto-routing if preferred.  The wiring arrangements for the points is shown in the diagram below.


The revised points circuit, with interfaces to the Lenz LS100 accessory decoder, which incorporates feedback of the point setting.

A relay is used to provide two independent switches. One for frog supply and the other to provide the feedback input to the decoder.


Points system fitted to the test track


The test track

Finally found a use for the last remaining piece of unused plinth front left over from our recent kitchen improvements!  As you can see below, its purely functional, with no attempts at scenery etc. The 4 blocks are marked 1,2,3 and 4. Each block is fed via the LDT block occupancy module (on the left). The points have an independent DCC feed. The two points are connected to a Lenz points decoder with feedback monitoring (on the right). The two pole change-over relay for each point is glued to the board adjacent to the points. (All the electronics would be hidden under the board on a real layout of course.)


Test track from the side

The LDT Block occupancy detector board


The Lenz Controller and PC Interface module have now arrived. I've got the hang of basic train operation and CV reading / programming while completing the latest Voyager update, so time to read up about getting the DCC controlled points connected, addressed and if necessary, programmed.  Then the track occupancy detectors and eventually the PC interface.......and of course, the software!    


The DCC Controlled points:

After reading the instruction manuals, the first change involved extracting the RS feedback bus wires and converting these to twisted pairs with a hand drill. Then re-connecting with the RS wire routing away from the original wiring harness. The points decoder was then wired up to the system, and to an independent 15V AC supply. The unit comes with default addresses 1,2,3 and 4 and with the output providing optimum drive for twin solenoid point motors of the type I am using..... so no programming required this time. The 12 V DC power for the relays that both switch the electro-frogs and provide the points feedback signal, was also connected. ............. With some trepidation, switch the controller on .............. select points control and magic!  points 1 and 2 work correctly and provide the points position feedback correctly ........  Looking good!


The LDT Track occupancy detector module:

This unit was also connected up to the track, the controller and the same 15V AC supply as the points decoder.  The default feedback device address is set at 65 so again, no programming is required for the first module. Once again, switch on ........... and more magic!  The block occupied by a test Bachmann Class 66 is correctly identified and the location of the loco can be tracked as it is driven around the test track.  Only one surprise:  As soon as the loco wheels make contact with either of the two points, its position becomes unknown until all the wheels have traversed the point and occupy the following block.

I'll try attaching the points via the detector module, using track feeds 5 and 6.  (I may need to re-think this approach when I get to the PC software, but lets see how it behaves).......    Well it certainly fixes the issue, indicating all blocks supplying motor current (As the loco passes over the break between blocks, both blocks indicate occupancy..... In fact for a split second, the loco is long enough to completely bridge the point, giving occupancy detection in three adjacent zones!) 

Next its time to read the software manual starters guide and the manual for the PC interfacing unit.


Connecting to the Computer:

The Lenz computer interface unit is an expensive piece of kit (due I guess to the integral web server which I don't currently expect to make use off) but its an essential building block, so here we go:

I'm running with Windows 7 on the PC, so the drivers apparently need to be sourced via the web.  The sequence is I understand as follows:   1) PC switched on with web connection functioning.  2) Power up the train control system with the interface module ONLY connected initially to the train controller (NOT to the PC). 3) Check that the interface red LED is on. 4) Disc ready, but not in the drive yet as I don't want to pull in the disc's Windows XP drivers by mistake.  5) Connect the USB line from the interface to the PC. 6) Follow the on screen "New Hardware" instructions to obtain the Windows 7 drivers via the web. When done...... 7) Install applications SW from the disc.   Fingers crossed.... lets give it a go.

Well that was a bit of a disaster!   If you plan to do this at home....... Don't do it as above!  The Windows 7 drivers couldn't be found on the web.... and are in fact on the disc although just to reduce confidence further, they are unsigned (ie not Microsoft approved).  In the end I had to find the relevant hardware in the devices and printers section of the Hardware and Sound area in the control panel, and manually load the driver from the Lenz disc. Then I downloaded the application SW from the disc. The on-screen train controller seems to work OK (See below)  so I guess we're there....... but I have a nagging doubt that all may not be completely as it should be!

Lenz On-Screen Throttle


Railroad & Co (AKA Freiwald SW) Traincontroller software:

I've downloaded the demo version of Traincontroller Bronze. Its free to use but can only be run connected to the train controller for 15 minutes at a time.  First problem was a failure to connect, but I eventually realised that the Lenz application software was still active in background mode. Once this had been switched off, the Traincontroller software connected to the Lenz system with no further difficulty. 

I've worked my way through the Quick Start process described in the manual, culminating in successfully running a shuttle train between each end of the test track, using alternating central tracks and performing a brief station stop in the centre of each central track block...... all under computer control.

Next challenge is to find out how to set up a schedule to perform the above sequence of moves without having to initiate and run immediately.

....... Not entirely intuitive, but after a few hours, we're just about up to speed..... this time with two locos running simultaneously!


The Switchboard is used to generate the track description and to specify the block properties. The pink areas indicate the presence of a train or loco in the block. The dispatcher window is used to create the schedules and once stored, they can be called up by a mouse click. In the example described below, two schedules are running at once, one controlling a GBRF Class 66 and the other, a Freightliner Class 70. The two speedo windows provide manual control of the locos if required and indicate scale speed and direction in both manual and computer controlled operation.  (The background is Grasmere in the Lake District, but this is not mandatory :-)


Close up of the Dispatcher Window track plan

Close up of the throttle control

(Function keys are on the bottom row)


Two Loco shuttle operation:

The photos below illustrate a pair of shuttle schedules with interacting routes controlled entirely by the computer. Locos moving from left to right always take the straight central section track, while loco movements from right to left always take the curved central track. The locos always pause for a simulated station stop in the middle of the central track sections, before continuing their journey. They reverse direction when they get near to the end of the outside tracks. The entire sequence will run for as many cycles as have been specified. (3 seemed enough to prove the point.)


The starting positions



Class 66 takes the curve while

Class 70 takes the straight


Both locos make a station stop


The locos continue to the end tracks


Stop at opposite ends......

Then change direction for a repeat


I would have struggled to reliably control the points switching required in this sequence without an occasional disaster, so I think it demonstrates the potential for Computer controlled sections of a layout quite well.

After today's exploration of Traincontroller Bronze, on the test layout, there are two essential areas that seem to be lacking for my requirements:

1) I haven't found any way to incorporate loco function changes within a schedule (e.g. the sound and hazard lights sequence at a station stop).

2) There doesn't seem to be any way to adjust loco speed for different parts of the layout, or to make stopping and breaking points within the blocks, loco specific.



So the next priority is to study the Traincontroller Silver/Gold manual, in search of such features..............



Traincontroller Gold:

I decided to go directly to the Gold version of Traincontroller as advice from Dr Freiwald indicated that running sound sequences at station stops is much easier to set up in Gold than Silver.......   


Sound & hazard light control at station stops:

Once I eventually found out how the delay in schedule actions was added and quantified (after a couple of hours of fiddling!).... making the sounds and lights switch at a station stop proved to be quite straight forward.   ("Delay" was conspicuous by its absence from the help topics list.)


"Delay" hiding in "System Operations"

Hidden button used to open the adjustment window


I used the power car from my Northern Rail 150/2 set as the test train. The delay timing to get sounds and lights properly synchronised took a bit of iterative adjustment to get right....... but thanks to the PC & software, its now spot on every time!  Very impressive!

Hazard lights on, just waiting for the station supervisor whistle, then the door closing warning tones. The hazards go off when the doors finally close, then the guard-driver buzzer and just as the motor revs build, a two tone horn and we pull away............


Using Macros to reduce the need for repetitive inputs:

Although the process for entering sound sequences is straightforward, its going to get a bit boring if I have to keep re-entering the same information for each schedule. I've now used the macro facility to copy the routine used immediately before the train pulls away from a station stop. The schedule uses the list entry on the way from block 1 to block 4 via block 2, and now uses the macro for the same instruction sequence when returning via block 3. It all seems to work correctly!  I'm going to have to plan a macro listing for all sound equipped trains. (Just 3 so far.)


Improved speed control with Traincontroller Gold:

Speed limits can be applied to each block in a schedule in the Gold variant of the software, so on a per locomotive basis, speed can be adjusted to suit the loco and the track conditions, slowing before bends and/or adjusting speed on the approach to a station platform to allow accurate stopping without the need for extra momentary track sensors......I think.  Need to verify this and see if its any different on Silver.



So it looks as if the Traincontroller Gold software can do the job, which is really not a surprise as it is used in many commercial layouts and has become something of an industry standard.  Next job is to re-look at the loft layout track plans and identify how best to divide the tracks into blocks.

Perhaps something like this ?


Postscript: Just checked out Silver to see if any obvious features that I've made use of in Gold are absent. There doesn't seem to be a start delay feature in the Silver schedule block detail. Its possible to do without this, but it involves a bit of juggling of the scale stop time against the real sound sequence delays. Also, there are some additional block action markers in Gold which are absent in Silver.  No show stoppers so far, so I'll reserve a decision on Gold or Silver for the moment..........

I decided to go for Gold in the end. (Seems to be a popular pastime at the London Olympics as I type this!)  I'm only going to do this once, so I might as well go for the full capability.

I now have the programme working from a big screen laptop and using the Railroad & Co dongle, which arrived earler in the week, I have continuous access to the test track system. (No tears loading the Lenz drivers this time, now I know that they are on the disc, even for Windows 7, and even the Dongle worked as indicated in the Traincontroller entry screen.)  I found the application files in the users area of the original desk top PC and was able to copy these to the laptop to avoid the need to regenerate the test schedules.

Next job is to modify the points and then get the loft track in place.


Long Trains crossing multiple points:

In order to prevent collisions or train derailments caused by switching points under a train, the computer needs to know where the complete train is located on the layout. The Traincontroller manual examples only seem to suggest connecting occupancy detectors to the block sections, while leaving turnouts without detectors. However, where a train crosses multiple adjacent points, there is a real danger that the computer may release the points area prematurely, resulting in a point change right under an active train. This can be prevented by adding detectors to the points track areas.

The track work between blocks is called "a route" and the detector arrangement is described as a "contact". After a bit of a hunt, I eventually found out that route detector details can be input to the program via the dispatcher window, defined for the requirements of each schedule.

In order for the track occupancy detectors to identify the presence of a complete train, a resistive link needs to be added between at least some of the wheels of wagons or coaches not already fitted with wheel contacts and some form of electrical load. This can be done using resistive lacquer, adjusted to present a little under 10kohm across each wheel set...... Just discovered that the flashing rear lights fitted to the rear bogies of my trains do not draw enough current during the "off" period, to trigger the detectors, so even these require additional parallel resistance!

Experiments with a few resistors showed that anything under 10k ohms would trigger the detectors, while 14k would not. After about 3 coats of Uhlenbrock resistive Lacquer, I ended up with approx. 8k between the wheels on the first test truck axle. This reliably triggers the detectors.

After a little scraping, this axle measures 8.54k ohms on the meter


With an additional axle given similar treatment on the other bogie, the entire wagon measures 4.23k ohms between the tracks.


For fixed formations, the total train length can be included in the train description although without details of the block and route lengths I'm uncertain how this would help! The schedule rules need to be set so that train length can exceed block length and occupied blocks and routes cannot be released under long trains.

I created a new schedule in which the central tracks and points of the test track were described as routes between the two end blocks. The occupancy detectors fully covered the routes and the schedule rules were set as described above. Using the test truck with a resistive axle as a potential crash victim, the schedule automatically directed the train around this obstacle with no disasters but I need to get some more complex track work in place to really explore the capabilities.


Setting up the Loco decoders:

When I added a sound equipped Class 158 to my Traincontroller locomotive list, I discovered the need for some refinements in the speed and acceleration characteristics of the locos. Traincontroller uses one common set of braking and stopping points for the all blocks in a layout (for all schedules in the same dispatcher window). So each loco needs to be compatible with these fixed features. The 158 overshot its expected first stop on the test track by nearly a meter!  (forcing me to terminate the schedule).

I've updated the 158 speed characteristics now, so that it behaves well with some revised block settings. Next back to the 150 to see if it can be made to comply with the same settings.

The software package includes a locomotive calibration system, which I will eventually run through, when I've got a longer track installed in the loft. In the mean time......

The approach seems to be

1) Adjust the loco speed slope to achieve suitably small low speed steps, while maintaining a realistic top speed at the maximum throttle position.

2) Set the acceleration delay (CV3) high enough to provide realistic acceleration when the PC slams the throttle to the max. But... keep the deceleration delay (CV4) low enough to enable the PC to bring the train speed down without the decoder extending the stopping distance.

3) Use schedule + loco specific block speed limits to slow things down where appropriate.          Note: More meaningful detail on loco set-up follows 3 sections ahead......


Points Status monitoring:

I was in some doubt that the Lenz LS100 points decoder with feedback, was providing the feedback information to the PC. (Although it operated correctly within the Lenz system, with status available via the hand controller display.)  The problem was that in the Traincontroller software, each point can be assigned a position control feedback address which does not seem to be available in the Lenz system. So in the absence of this, a plan B was evolved:

Lenz also produce a cheaper points decoder numbered LS150, without feedback, which can handle 6 points (compared to 4 points on the LS100). If this unit is used simply to activate the points, then Lenz feedback module LR101 can be used to provide a feedback signal that can be read by the PC, for up to 8 points. The revised arrangement is shown in the diagram below:

Revised points feedback system


I've ordered up an LS150 and LR101 from DCC Supplies and I'll test the system on the test layout.  Phase 1 of the loft layout uses 16 points and these can be handled at less cost using the above approach than the original concept, using LS100 units, so I hope it works OK...................

Further research on the web, revealed some big question marks about the Lenz controller LZV100 and LS150 combination, when working in a complex Traincontroller environment. It seems that there have been a number of cases where the 0.1 second point change solenoid pulse, has been reverting to around 2 seconds and damaging the point motors...... for reasons that appear to suggest possible incompatibilities between the Lenz controller operation and the LS150 during busy use of the system. My loft layout may not be sufficiently complicated to suffer from these problems, but its a definite concern. Other issues that may compound this problem, from the forum entries I have read, suggest that low current solenoids and a faster computer dramatically reduce the problem. I'm now already using the Peco low current coil motors and my PC is a complete overkill for the application.... so these concerns may not actually be real for my system....but nevertheless, perhaps I'll play safe.

Further checks with the original LS100 suggest that despite the lack of interaction in the position monitoring section of the Traincontroller SW points "properties", it does appear that Traincontroller is receiving points position data. i.e. manually change the points and the indicators on Traincontroller change too..... this couldn't happen unless the feedback data was being received!  When running test schedules, however, the points still receive an audible power spike, even if they are already correctly set.

So going round in circles again!  I'll use the LS150 on the test layout and move the LS100 to the loft layout phase 1, with 3 additional units!    It will be interesting to see how the feedback using the LR101 compares with LS100 operation.........

No obvious difference between the operation of the SL100 and the SL150-LR101 combination, once the Traincontroller software accepted the position control data. This proved troublesome on the second set of points, despite the feedback working immediately on the Lenz controller display. When manual point changes failed to change the PC points screen diagram, I discovered that the feedback address in Traincontroller had been altered after entry. (Perhaps data corruption?) When this was corrected, the PC was able to monitor manual point changes and behaved as it had with the LS100.


LR101 & LS150 installed on the test layout, replacing the original LS100.



Adding the electronics hardware to the layout baseboard:

Phase 1 of the loft layout has 16 points and enough routes and block sections to need 5 occupation detector boards.  I've notionally assigned the points into groups of 4. Each group is controlled by a Lenz LS100.  To make the electronics easier to access, I've made up 4 assemblies on suitable wooden base boards (salvaged from the back of the shed!). These will be hinged to the bottom front of the layout baseboard, so that for initial connections and subsequent maintenance, they can be hinged down to a vertical position. For normal operation, they will be hinged up to an inverted horizontal position, under the railway baseboard. 

The four electronics assemblies


The mounting concept


More on locomotive set-up and the block brake and stop markers:

I've learned a bit more about this subject as a result of testing the sound equipped class 156.  There is a limitation in the Traincontroller software train acceleration control, when applied to LokSound equipped locos, that use the start-up delay, to provide pre-start sounds (and on steam locos, synchronisation of sound and motion).  The Traincontroller software can provide acceleration and deceleration control, to replace or supplement the effect of CV3 and CV4 decoder settings, BUT the acceleration control only works correctly if there is no start delay.

However, I have found a reliable work around for my class 156, which I shall try to apply to my other sound equipped locos.

The process is as follows:

1) Set the block stop markers at the required stopping location, measuring the actual length of the blocks involved. Set the brake markers to be around 6 inches before the stop markers, with a 6 inch ramp. This is fixed for the layout and applies to all trains.

The next steps are specific for each train or locomotive:

2) Using CV5 (and if necessary, CV53 on ESU LokSound or LokPilot decoders) adjust the maximum speed of the loco involved to the correct scale speed. To do this, disable acceleration and deceleration delay (set CV3 & CV4 to zero) then run the loco over a straight track around 2.5m in length. Mark a region approx 1 metre in length in the centre of the test track.  Run the loco at maximum speed through the marked central region and measure the time taken for the front end of the loco to pass through the marked region with a stop watch.  (Take an average of 3 or 4 runs.)

Class 158 power car with the Legomanbiffo decoder flying through the measured metre.


If the marked off central length of track is y inches long in OO gauge.  The full size locomotive would be passing through a length of track 76 times bigger. So 76y inches. To convert this to miles, we divide by 63360. So the equivalent full size track length is 76y/63360 = 0.0012y miles.

If the model takes t seconds to pass through the marked off central track, then speed = 0.0012y/t  miles per second    or 3660 x 0.0012y/t miles per hour which equals 4.39y/t mph.

My measured track section is 41 inches long, so speed in mph = 180/t.

I plotted a graph to save time in converting the t seconds to an equivalent speed for my 41 inch long marked off track:

3) When the max speed is about right, reset CV6 to around 30-40% of the CV5 value.

4) Input the real loco maximum speed in the Traincontroller locomotive data (under the speed tab). Enter acceleration and deceleration figures of 5-10% (low enough to have a negligible influence on the train performance).

5) Establish the maximum speed required in the block(s) in which the loco is scheduled to stop. Set this max speed in the schedule specific block data for that loco in Traincontroller.

6 Using trial and (hopefully reducing) error, adjust CV4 for the loco concerned, so that it stops at exactly the required location.  If the CV4 delay becomes excessive, slightly reduce the max loco speed entered in Traincontroller, below the real loco max speed.

7) Set loco CV3 to a compromise level which is as high as possible to give believably slow acceleration from a standing start, but not so high that it prevents the loco accelerating to the max block speed at the braking points. 

I've ended up with the following data for my sound equipped locos:


Train / Loco Real Loco Max Speed Max speed entered in Traincontroller Measured Max Scale Speed (mph) CV5 CV6 CV53 Platform approach speed (mph) CV3 CV4
Class 156 75 75 72 100 40 140 30 50 40
Class 153 75 75 70 120 50 120 20 40 12
Class 158 Howes Decoder 90 90 80 42 18 85 30 90 48
Class 158 Legomanbiffo Decoder 90 80 80 110 45 130 30 50 32
Class 150 75 75 70 44 17 125 25 60 40
Class 67 125 100 100 180 80 140 25 60 18
Class 221 125 110 110 160 55 140 40 50 24
Class 43 125 97 100 120 40 140 30 60 24


Class 67 (left) and Class 150 (right). Both stopping as required, two to three cms inside the far end of the block


To be the loft layout progresses



Supplier website links (work in progress) :


Railroad & Co Probable software to be used on the computer controlled layout
Trains 4 U Peterborough A good (almost local) source of model rail parts. The test track points, motors and switches came from here.
DCC Supplies Helpful & well informed supplier of all things DCC. The Lenz 100 starter set came from here
Digitrains A very helpful DCC specialist company. The test track LDT and other Lenz parts came from here.
Lenz German DCC system supplier
LDT Specialist DCC module supplier

The photos of real track were taken on the Settle-Carlisle line at Ribblehead during 2009. The photos of test track etc were taken on the kitchen worktop using a Canon Ixus.    


Click to move to Model Rail Index Page