Trains Random Stopping at and Leaving Stations

Engineering time: uhm, a few months?This layout is just one big loop with three stations where trains can be stopped on side tracks. Two stations have two side tracks and one station has one side track. This is the first project that I have used signals: when a train needs to stop, the signal is put to red, when the train is started, the signal is put on green. Every station has per side track a motorized switch and a sensor. The sensor is located before the motorized switch.

The layout is controlled by one central controller, an Arduino Mega. trains are started and stopped based on a few variables like a maximum time a train can stop at a station, a maximum time a station is empty, etc. Next to that there's a "random sauce" that makes these variables a bit random.

In case the system wants to stop a train, the system checks the sensor if there's currently a train on the switch. If so, the switch cannot be changed since that would derail the train. In that case the system waits a few seconds, checks the sensor again and if there's no train, the switch is put on the side track. Now the system waits until the sensor is hit by a train, which means that a train is guided to the side track. A few seconds after the train has passed the sensor, the switch is put back in the straight position and the side track is disabled which will stop the train.

In case the system wants to start a train, the sensor before the motorized switch is checked if there's a train passing a sensor. If so, the system waits a few seconds before the train on the concerning side track is started, to make sure there's a minimal distance between the trains which are riding on the loop. If the sensor doesn't detect a train, the system waits until the next train passes by to make sure that a train is not started just in front of another train or while a train is on the parallel track of the side track.

This waiting for a train is a downside of this functional design: since a train takes one and a half minutes to complete the whole loop (see video below), the system had to wait for some time before a train could be started or stopped. This resulted in a somewhat boring layout: there were not many actions per minute to make it enjoyable. A version 2.0 which is in development takes really good care of this problem!

About Me

Welcome! On this website you’ll find background information about the projects that I’ve done in the past and and projects that I’m working on right now. Curious about how some of my projects work? You’ll probably find the answer here!

Donate

Excited about my projects? Leave a tip to increase the overall project awesomeness!

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

Strictly Necessary Cookies

Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.

disable

If you disable this cookie, we will not be able to save your preferences. This means that every time you visit this website you will need to enable or disable cookies again.