Why do this?
- Pulse-width modulation allows smooth operation at slow speeds.
- Set realistic rates of acceleration and braking.
- Set maximum speed to avoid derailments.
- Program operational responses to meet your operating style.
- Control train based on sensors, auto reversing, whatever.
- Because you can, and it is cool.
Step 1: Beg, Borrow, or Build
1. Wii Nunchuk. - The only part of this that isn't "open source" or completely hackable. It is, luckly, relatively inexpensive, easy to obtain (you may already have one on hand), and incredibly versatile. For $20 you are getting:
Countless hours of Nintendo product engineering (priceless)
2. WiiChuck Adapter. - While you can cut your cable to access the wires, your kids will hate you when they go to play Lego StarWars next time. A couple of bucks will get you an adapter and guilt-free access to a software library written by the guy that came up with it (www.sparkfun.com/commerce/product_info.php), or your could build your own using this Instructable.
3. Arduino Microcontroller - You can buy or build one of these. They are easy and fun to use, and with the shields, can be put to a number of uses, repeatedly. They come in a number of variants. I like the newer Duemilanove since it has USB built in. Here is one source: www.adafruit.com/index.php
4. Motor Controller - As versatile as the Arduino is, it can't drive a DC motor on it's own. You can breadboard something together using a H-Bridge chip like the SN754410, as shown here, or buy a shield kit that fits right on the Arduino and comes with software libraries and examples. I'm using one I built from Adafruit shown here.
5. Model Train - (Sold separately). Or any small DC motor you might want to drive. I'm actually doing this for a small "switching puzzle" layout I've got built. It is only 1' x 4', and I want it to be easily (and safely) operated by children. It involves a lot of slow-speed back-and-forth, unlike the typical full-throttle round-and-round stuff. You can learn more about the layout on the last page.