Stop the Train Game - Jurassic Junction

Click the pictures for a larger view

        https://lh5.googleusercontent.com/-S-Y5ey-t9iY/VeQw_NabdHI/AAAAAAAAUe4/RQ8UbtINE2w/w1278-h719-no/2015%2B-%2B1

 
 
 


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.


Landscaping the layout

I wanted a bridge and a tunnel on the layout so decided to build it on 3 layers.


Wooden supports to support the track bed on the middle layer.


Hardboard mounted on the middle and cut to form the slope and bridge. The roof of tunnel the was then added to form the top layer.


Newspaper was scrunched up into balls and then covered in papier-mache. I tore the paper up in to squares covered in PVA, but apparently it is better to use triangles.


Nearly done. I started to apply the final layer of plain white paper at the front. This stops the news print from showing through the paint.


All now covered. There are a few creases visible (maybe I should have used triangles) but just needed to dry properly before painting.



The whole layout was painted with a base colour of "Grizzly" brown. Tester pots from DIY stores are handy for this task.


Other colours were added from an acrylic art set to accentuate the rocks. 
 

Part of the roadway is stuck down and some of the trees are planted.


The layout is now more or less complete.

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.


How it works

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.    


Whats in the box





Lid

Video Game Button micro switch with LED illumination. 
16 x 2 LCD Display with serial interface mounted on back (reduces wiring).

Main box 

Top - voltage regulator with current limiting
Middle - MOSFET module 
Bottom - Arduino Nano mounted on a Sensor Shield

Connectors  on right

Top - Power to Track
Middle - 12v Input from PSU
bottom - CAT 5 socket (used for connection to light sensors on layout) 
































Connecting it up
I found it easiest to use a sensor shield when wiring my system. See the PDFs at the bottom of the page for details of how to connect the various modules together. 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.

The Code

Please see the links to the software code at the bottom of this page. 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.

Exhibitions

September 2015

Brighton Mini Maker Faire

                                                                                                                                    
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

February 2016
Tonbridge Model Railway show

April 2016
Arduino Day, Machines Room, London E2

May 2016
Pratts Bottom Village Fete



  

Subpages (1): Layout ideas
ċ
Stop the Train.txt
(10k)
Neil McGrath,
18 Jan 2016, 14:05
Ċ
Neil McGrath,
31 Aug 2015, 11:55
Ċ
Neil McGrath,
22 Feb 2016, 14:32
ċ
Stop_The_Train.ino
(10k)
Neil McGrath,
18 Jan 2016, 14:16
Comments