The train must be large enough to carry frogs (O scale) and must stop at precisely the right spot to receive passengers. Stopping the train at a precise spot (not give or take an inch) is somewhat challenging. Voltage from the supply varies throughout the day. Voltage dips when heavy loads start in the house. Voltage at the train engine depends upon track connections and wheel connections. The train engine is an imprecise electromechanical device.
The method of control I settled on requires detecting the position of the train with a magnetic switch (relay actually), then shutting the motor off and "crashing" the train into a stop sign.
Let's start with something that didn't work too well. I set up a photocell and photoresistor--and they reliably detected the train--but I had 3 to 4 inches of variance in where the train actually stopped after detection.
Bio:My book, A BEGINNERS GUIDE TO 3D PRINTING: 14 SIMPLE TOY DESIGNS TO GET YOU STARTED is now available. If you want to design your own stuff, but thought it was too hard to learn, it isn't. Take a look....read more »