bootstrap modal form


… a model railway layout for Advent controlled with an Arduino Uno.

The Idea:

The purpose of this web page is to document the progress of my Winterbahn Project.

The idea was to combine my desire to built a winter landscape for a model railway with an automated control using an Arduino micro controller.

The intention is to have a mini layout to bring out before Christmas which will run by itself to the amusement of onlookers. It should give me the experience in both creating a ‘Snowy Scenery’ and learning the uses and programming of an Arduino micro controller. 

The main features of the Winterbahn layout are:

    A winter scenario with LOTS of snow.

    A rural station with 2 passing tracks.

    A church.

    A small Christmas Market.

    A wooded hillside at the rear of the layout to accommodate the tunnel.

    A road with a level crossing and possibly a bridge over the tracks.

    Use of many LEDs and other lighting effects for the buildings, streets and Market.

    Possibly sound: church bells, railway station announcements, etc.

The Layout:

The main technical elements of the Winterbahn layout are:

The layout is H0 scale. 

It is a simple circle with two passing tracks.

The tracks are Trix C-Gleis.

There is a station in the visible area.

There are ‘parking’ tracks in the tunnel area.

There are two trains running in opposite directions.

A passenger train which will stop at the station.

A goods train which will run slowly through the station and return to the parking track.

The distance for the braking until full stop is set in the ‘loco DCC decoder'(CV4).

The acceleration and top speed is set in the ‘loco DCC decoder'(CV3).

Winterbahn track plan logic

The figure opposite gives a logical plan of the layout showing the points, tracks and reed contacts which are defined in the sketch to control the operations.

The Hardware:

Stacked onto an Arduino Uno is a ‘proto shield’ which comprises an LM7809 voltage regulator to take 12 – 18 Volts down to the Arduino Vin voltage of 9V, and an LMD18200 H-Bridge acting as the DCC Booster.

The H-Bridge was bought on ebay for ~10 Euros and stuck with double-sided tape to the proto shield.

On the right is the circuit diagram showing the connecting pins to the Arduino and the input / outputs to the LMD18200.

The Arduino UNO and the finished shield with the LMD18200 H-Bridge and the connectors ready to be attached to the layout. See the cicuit diagram above for the inputs and outputs. On the right is the full stack.

The (youtube) video shows one ‘run through’ of the sketch. The electric loco starts running to the station when the Arduino reset button is pushed. It crosses the reed contact and causes the program to stop the loco. Due to the deceleration DCC CV3 it runs to a gentle stop. After a short wait at the station it then starts back to its parking place. This is repeated again twice before the steam engine starts. The steam engine slows down for a few seconds after crossing the reed contact in the passing track. After returning to its parking track (again controlled by reed contacts) the electric loco starts off again. This whole operation is repeated 3 times in all before the program stops and the trains are all halted in their parking positions. A new reset of the Arduino starts the whole thing off again.

The Arduino sketch is very basic and does not require extra libraries. The full sketch is listed by clicking the button below:

The points are spring-loaded and thus the trains keep to their own tracks without needing any switching control. as the speeds are controlled by the DCC CVs, the sketch only needs to control the stop, slow and start commands in DCC.....

.......and now a few images of the progress so far.