Jump to content

Recommended Posts

Throttled CAB Controller


My “2012 Scratchbuild Challenge” entry was to design, build and test a Train Controller (DC).


This I called the :- Throttled CAB Controller.



My “Throttled CAB Controller” started out as an idea to show an application of my “2012 Innovation Challenge” entry, which is a one stop PCB design capable of controlling all, (possibly!), of a model railway's motor control requirements both intelligently and flexibly.


The most fundamental requirement of a model railway is, well, a train!

The second most fundamental requirement of a model railway is to make the train move!

Electric motors have dominated model railways ever since they were made smaller, (and cheaper), than their clockwork cousins.

Initially, controllers they were just on or off with a switch to swap the polarity (direction) to the rails but it 'controlled' the train. Since then more and more aspects of 'real railway' operations have been built into the controllers capabilities – variable speed, smoke(!), directional lights, multiple operation – until DCC was developed. (Radio control being better but, due to price, does not 'lead' the market – yet! Yet, all these systems suffer from one undesirable aspect – they are fixed, permanently wired, copyrighted/hidden source code.

That is to say, they are all fixed in the way they operate – you can't change them AND you have to use them in the way that the designer thought that they should be used.

Not always ideal, not always what is required and NOT for me!


The “Throttled CAB Controller” is designed to be both flexible and powerful.

Flexible in that you can change the way that it works.

Powerful in that it can control/manage the power to the rails in a number of ways.

But, basically, it is a Dual DC train controller with added features, controls and capability.


As of the 1st of October, the “Throttled CAB Controller” was complete in terms of hardware and was fully tested. Some of the “Features” were complete, or were only half implemented, whilst other features are not yet written into the software yet.

OK, I haven't labelled the various external connectors yet. I also want to add a serial connector and an external programmer connection point as well, but I do now use it to 'play' trains.






2*DC (PWM) Train controls of up to 1A each.

1*LED indication.

1*LCD Display (diagnostics only).



1*12v to 24v regulated DC input (~2A).

1*Main Power control (Forward – Off – Reverse).

1*Inertia control.

1*Brake control.

1*Train Type selection switch (Rotary 2*6 position).

1*Train Circuit Selection switch (on-off-on SPST).

1*ENTER button (Push to make SPST).

1*STOP button (Push to make SPST).

1*Program connector (Optimised for PicKit2).






Train circuit 1 Proportional direction Control in 1% steps. (Complete).

Train circuit 2 Proportional direction Control in 1% steps. (Complete).

STOP operation (Emergency) with all currently implemented features. (Complete).

Train 1 Record Journey – DC Shuttle. (Complete but will be modified to get 2 train working).

Train 1 Replay Journey – DC Shuttle. (Complete but will be modified to get 2 train working).

LED indication. (Functional for diagnostics but will be improved for 'normal' operations.)


Not yet written:-

Train 2 Record Journey – DC Shuttle.

Train 2 Replay Journey – DC Shuttle.


Train Type selection.



PC communications.

Random (shuttle timing) control!

Senseless operation (for use with siding end diode protection).

Recipes (probably via a PC only).

DCC. (Way into the future! But operating the same way as the DC version.)




The design, and build, were documented here:-




starting at post #63. Whilst my Entry (very short) can be found here:-







A “kit” of parts are shown here:-


(It's NOT A KIT! It's all my work including the PCB design! ;) )



The Front Panel schematic:-




The Controller's IO resource allocation:-



CAB Controller IO.pdf

This may seem complex, or too well documented(!), but it did allow for very quick construction and software development as all the “thought” was done – AND was proved to be “right” – BEFORE the soldering iron was switched on!



During the construction of Throttled CAB Controller”:-





And, as this is as much about software as it is hardware, some pictures of the software that is running inside the unit:-




An admission here. I have 'taken' these screen shots today (19/10/2012). These routines HAVE been edited since the 1st of October to aid readability, to improve program flow and to add meaningful comments. The function, that the routines achieve, has not changed. Power to the tracks still provides power to the tracks! The shuttle routines still shuttles!


The full source code is here:-



Program changes, since the 1st of October, have centred around improving the LCD diagnostics display, interrupt timing control, more efficient memory storage, PowerPOT centre deadband, and as previously stated, program documentation and flow, oh, and the LED flashes now!



Throttled CAB Controller” Operation


Using the “Throttled CAB Controller” is a dream as I have tried to make it really intuitive.

Slow speed control is crisp, refined and repeatable, and there is plenty of “umph” at the top end too.

(Depends on loco though! No controller is going to help fix bad quartering, however, I do accept that a feedback controller can mask all manor of small problems! Hmm, must think about that – and because it is (fully/very) flexible – I can!)


To use it just select which circuit to control and apply power to the track by turning the Power knob in the required direction – and the train then moves.


To “Record” a journey, (Shuttle Mode), select “Control” and then just Drive the train as normal until you have finished.

The Controller is recording everything that is applied to the track. Don't forget to include any pauses you may want, (usually at each end). Pressing the ENTER button, at any time in this Mode, clears the memory so you can start recording again if you mess-up.


To “Replay” a journey, (Shuttle ad infinitum), drive the train to the start position, (if not already there), and select “Direct”. Pressing ENTER resets the journey to the beginning regardless of where the train actually is.


Pressing STOP, at any time, immediately disables all outputs until the Power knob is returned to OFF position. “Shuttling” can then be restarted in the usual way.



Everything else needs to be written – including the stuff I haven't thought up yet!

But most things have been tested separately but aren't yet incorporated it into the Main Routine.

The “Record” and “Replay” features would be even more intuitive if they were labelled “Record” and “Replay” instead of “Control” and “Direct”! Wait a minute, it's just an edit to change the laminated front Panel, which I can printout and laminate at work. Just not done it yet!


The controller, in Shuttle Mode – is brilliant – even if I say so myself! It is a joy to set-up and an even bigger joy watch in operation.

The first time it worked, (properly), I replayed a recorded journey two things immediately struck me. One, the Replayed Journey was ~15% longer than the Recorded Journey, (the result of a minor timing bug which was easily corrected), and two, the actual train movement “looked” as if an operator was “still” Driving the Train”!

This was quite weird, (at first), but if you think about it it's obvious. Technically, that's what was actually happening! Also, all the Shuttle units, I have seen, operate by varying a delay, ramp-up, cruise time, and if you are lucky – a ramp-down time. These NEVER allow for curves, gradients, rubbish loco's, point work, etc. Recording a Journey, naturally, compensates for all these problems, (resistances to movement), whilst allowing you to add prototypical train movements such as coasting, slowing and accelerating for speed restrictions or picking up tokens etc. Also, most trains I have seen approach the stops slowly/cautiously and then wait their next turn. They Accelerate away quite aggressively but then slow over any point work and then, once again, accelerate.

Recorded journeys doesn’t need to be “out and back” shuttle movements either. You can start your recording whilst the train is in motion, record the journey, and then end the “journey” - preferably, at the same place – and at the same speed. Again, incorporating any slow downs, stops, (changes of direction!!!), delays, etc, as you want – (within the constraints of memory).


One of the future features I want to add to “Journeys” is sensor-less operation. I'm not even sure if this is possible or even if SDB will be able to implement it, but I will try anyway. Sensor-less operation, it is hoped, will allow 'fixed' timing to be added to journeys to synchronise the Trains position to where the controller recorded it originally. This will give accurate positioning for the acceleration/deceleration/stops/signals/etc each and every time thereafter.


Another feature, that i'm particularly proud of is what I call “FreeSound”.

This is basically a way of getting sound to come out of you loco but with NO sound decoder fitted!

I have tested this and it does work but it is quite and limited – what did you expect for free?

Anyway, horns/whistles whilst stationary are easy. I'm not so sure about sounds on the move though. Something for the future.



Anyway, I present you the Throttled CAB Controller”:-







  • Like 5

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.