Bottom row shows the latest addition to the layout - the remodelled station added February 2016
This project began in early 2015. The members of the Orpington Model Railway Society support the Pratts Bottom village fete each year by putting on a garden railway exhibit. We were trying to find a way for the display to become more interactive for the visitors, so I devised the Stop The Train Game. The train travels around an oval of track at a different speed each time the game is played. The player has to judge when to press the button for the train to slow down and stop at the station. The faster the train is traveling the longer it will take to stop.
For the first version of the game, you had to watch the train to judge its speed, but this turned out to be nearly impossible to do with any degree of accuracy.
The prototype N Gauge version To make things easier, I added a speedometer
The original scoring scale on the platform
Now that I had proved the concept it was time to upscale the electronics to control the garden railway.
The control equipment was used on this garden railway exhibition layout at the Pratts Bottom Village Fete. The stop the train game was run on the middle oval track. The players had three attempts to stop the train at the platform and could win a prize if they were successful.
In June 2015, the project was accepted for the Brighton Mini Maker Fair. There was insufficient space to run the garden railway, so it was back to N gauge, but with some improvements. The original track would be fully landscaped and automatic scoring added to the electronic display.
Originally, I was just going to produce a simple village scene but after a little thinking, I decided to create a story line where the passengers were trapped at the station by escaped dinosaurs and only the player could rescue them by stopping the train at the platform.
Suppliers as follows:
Vehicles - Ebay
Trees - Ebay & local model shop
Railway arches, roadway and station platform - http://www.wordsworthmodelrailway.co.uk/ _ Free download (print at 50% for N Gauge)
Dinosaurs - local toy store
Fencing - Grey netting from dressmakers.
Fence poles - Large matchsticks from hardware store.
Station Buildings - Peco from local model shop.
The ballast was laid on the track dry and then soaked with a 50% mix of PVA and water (with a tiny bit of washing up liquid).
The grass areas were created using various scatter materials stuck down with PVA and then given a coat of hair spray.
The hedges were made from green supermarket scouring cloths cut into strips covered in PVA and then dipped in scatter material.
At the heart of the control circuitry is an Arduino Nano. This provides all the control functions for controlling the speed of the train, detecting when the button is pressed, displaying the speed and score, detecting the final position of the train and keeping score.
A MOSFET module is used to switch the power to the track using pulse width modulation (PWM). This controls the speed of the train.
The train cruising speed is different each time game is played and this is set by generating a random number between 100 and 255. 255 produces a 100% duty cycle (maximum speed) and 100 produces a speed that is about 40% of the maximum.
The train steps up in speed one unit at a time until it meets the generated random number, then stays as that speed until the button is pressed. It then decelerates one unit at a time until it stops. The time taken to accelerate and decelerate can be varied by adjusting the time interval between steps.
When the train stops the light level from 4 light dependent resistors (LDRs) mounted on the track is measured. If the train stops over one or more of the LDRs, the light level is reduced and the change detected. The Arduino then assigns and displays a score based on which sensors are covered. The 4th LDR detects if the train has overrun the platform and will reduce the score of one of the other LDRs by 50%.
The Arduino Nano will remember the score for each of the 3 rounds and will add these up to produce a final score at the end of the turn.
Components
Arduino Nano + sensor shield
Mosfet driver module
Buck voltage regulator board.
Illuminated push button
4 x light dependent resistors
12v power supply (1 Amp is plenty)
Connectors
Wire
Connecting it up
I used a standard LAN cable to connect the sensors to the control box as this was a cheap and easy way to obtain a multi-wire connection.
I found it easiest to use a sensor shield when wiring my system. Although it is possible to connect an Arduino direct to 12v, it does make the small on-board voltage regulator work quite hard, so I have regulated the 12v supply voltage externally down to 9v at the Arduino power jack.
Please contact me if you would like a copy of the code. This is available as a text document or .ino file that can be imported directly into your Arduino program. You will need to adjust the acceleration and deceleration timings to suit your particular layout and locomotive.
To get the best out of this set up, choose an engine that operates smoothly and reliably at low speeds. Keep your track very clean to ensure a reliable supply of electricity to the train.
Layout set up and ready to go at the Brighton Mini Maker Faire.
Read the full report on the exhibition here
Other Exhibitions and displays
December 2015
Pratts Bottom Christmas Fayre
January 2016
Pratts Bottom Primary School
Orpington and District Model Railway Society Annual Show
February 2016
Bertha James Centre Model Railway Show
Tonbridge Model Railway show
April 2016
Arduino Day, Machines Room, London E2
May 2016
Pratts Bottom Village Fete
December 2017
Welling and District Model Engineering Society
Santa Specials