Go Down

Topic: Automating Train Movement (Read 628 times) previous topic - next topic


In my second example, there are only 4 short paths.

Blocks per short path, ordered from source to destination
0, 2, 3
3, 5, 6
7, 5, 4
4, 2, 1
I'm a little confused by this because none of them seems to be the inverse of the other - eg how do you get from 3 to 0 ?

In any case, let's assume that physically 0, 5, 3 is also an option - but 2nd preference because 5 is normally used for the other direction of travel.
Then I would add that group as another path to be considered if the first path 0,2,3 fails. (these numbers are just for illustration - please substitute sensible ones)

Two or three hours spent thinking and reading documentation solves most programming problems.


Those paths apply to my second example.

The second example is taken from the middle of a larger layout.  It only has eastbound and westbound sidings, and no return loops.


I'm also building a layout using Arduino to control Turnouts, Control Panel, Signals but NOT the actual trains (which are DCC). It's still a work in progress (and I keep finding something "just a bit different" to change - and then on top of that, there's the "improvements" that can be made to the layout....) but certainly the overall concept seems to be looking good.

The concept & layout so far has....
- 36 control "blocks" - no direct DCC control, but the ability to "turn off" power if a train passes a signal at Red/Stop
- including double track and single (bi-directional) track areas - from a programming perspective one block per direction.
- holding loops and sidings
- hidden sidings (fiddle yard)
- Modern Australian practice, which can mean signals with 5 or 6 lights (LEDs....in HO...scratch built)
- Control Panel with indicators and switches for signals, track and turnouts
- Separate train detection (NOT track/DCC based) currently using reed switches and magnets (cost), but intended to be flexible enough to be changed seamlessly to any other type of detector system.
- I2C communications between multiple Arduinos to handle the sheer number of inputs/outpus - I've currently got 2 Megas and 1 Uno all handling different things, with one of the Megas the Master Controller.
- 20+ turnouts....EVENTUALLY controlled by Servo motors via Arduino........eventually.....

Basically everything except actual loco control is through the Arduinos, including directly powering the Signals/LEDs.

Happy to discuss more if anyone's interested, including sharing code.

Ross McConchie


Forgot to say where I'm actually up to:

- About 1/4 of the layout is "usable" with track down, train detectors, control panel & signals installed (scenery? what's that?)

- Another 1/4 needs to have the correct wiring set up - detectors first, then signals - oh and I need to fix that bit of track....

- Control Panel Switches and LEDs, Turnout logic (basically just the switch on the panel at this point) all working as they should - for this half of the layout

- I2C communications working

- Track power "control" not connected, but not critical

- Block logic, train detection, etc working beautifully (for this half of the layout)

- The last 1/2 has track and power, but that's about it - including no control panel.

- Block logic for the rest....I'm slowly expanding the number of blocks "in use"...keeping a close eye on how much memory I'm using.

- Counting inputs/outputs as well in case I run out.

So to get train "running", at least on a double track "continuous run", it's really only a couple of days work....but I'm making signals at the moment.....and.....

Ross McConchie


Rather than hijack the Thread started by @bhuck why not start your own Thread, put all your existing content into it and then delete all your input from here apart from a link to your own Thread ?

That way Forum users could get full value from both experiences with a lot less confusion.

Two or three hours spent thinking and reading documentation solves most programming problems.


You need to thoroughly understand the information on this page:


The Arduino will essentially mimic the CTC machine.

(Isn't it funny how the spell check does not know the word "Arduino"?)

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131