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.
Using a reed relay (Jameco #111448) and a bar magnet glued to a train car, I was able to get my "variable stopping distance" down to about one inch.
Connect wire wrap wire across the relay contacts--the relay will close when the magnet is near.
The stop arm is mounted to the servo horn (HiTec HS-311 servo, amazon.com) using #4-40 machine screws.
Using 4 x 3/4 wood screws, I mount the servo/arm assembly and support brace (opposite side of track) to the plywood base.
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 »