In Froggy World, the amusement park for adventurous frogs, we have catapulted, booted and seesawed Froggy.  Upon departing the seesaw http://www.instructables.com/id/Froggy-World-3-The-Seesaw/ Froggy must land in a waiting train car. 

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. 

The system uses 3d printed parts:


and an Arduino for logic control.

Step 1:

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.
How do you set up those sensors?
For the led sensors, look at: <br> <br>http://www.instructables.com/id/Froggy-World-2-The-Boot/step16/null/ <br> <br>and you will see a diagram using 5 volt power with a resistor and led in series (to light the led) and 5 volt power with a resistor and photocell in series. The voltage across the photocell changes when light changes--that is sent to an analog input of the Arduino to determine when the light beam has been broken. <br> <br>The magnet and relay does not require a microcontroller to be useful. The contact on the relay closes when the magnet passes by; you can use this contact closure for whatever purpose you need.
Any way to do it without an Arduino?
If you took the resistor/photocell in series and (from the mid point of that combination) took a wire to the base of a transistor, that transistor could be used to operate a relay. You would have to play with the resistor value to get the right combination, based upon your photocell, transistor and relay.
I'll look into making an instructable on this in the next day or two.
Here's more information: <br> <br>http://www.instructables.com/id/Simple-Light-Break-Detection/
You could briefly(very breifly) reverse the trains motor to &quot;Brake&quot; the train, at your detector that should decrease your stopping distance.

About This Instructable


14 favorites


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 ... More »
More by MikeTheMaker: Macbook Air Broken Hinge Brace Two of Three Bears Computerized Bouncing Gator
Add instructable to: