Wii Nunchuk Train Control?

With the layout mostly complete, I've been looking at adding some "electronic tweaks". One of the things I've been less than happy with is the controls.

The state of the art for model railroading right now is called DCC, or Digital Command Control. Instead of varying DC voltage to the track to control the train, an alternating voltage is supplied with a digital command signal mixed in. A micro-controller on the engine decodes the signal and applies power to the motor.

That seems a bit much for a four-foot layout, and there is not much by way of hardware decoders for N-scale (yet). Another alternative is to just pulse the DC signal to the track in a scheme called pulse-width modulation. Instead of variable voltage, maximum voltage is applied for variable widths of time. It seems a little crazy, but it works so well that it is used on large industrial motors. The big advantage for model trains is smooth operation at slow speeds - a big plus at Dawson Station.
The key to pulling off a cool hack like this for a wanta-be hacker like me is to let others do the engineering. The Arduino micro-controller was designed to be easy to use and program, and it is. And while it is great at flashing LEDs like you see in a project like the "Game of Life" kit (not technically an Arduino, but the same main chip), it needs a little help driving motors. Another brilliant concept in Arduino is stackable prototyping shields. You basically add another layer of circuit board with the space and wiring to do what you want. In this case, the brilliant engineer LadyAda at Adafruit has designed one for driving motors and servos.

The final piece of the puzzle is the interface. How do you tell the micro-controller what you want? "Buttons", is the correct answer of course. If you saw my earlier video, I used a momentary toggle switch to increase or decrease speed. With the goal of the layout to be operated by kids, I was still looking for something easier. Enter the Wii Nunchuk. (Ed. note: I've seen a lot of spelling variations, but the offical Nintendo manual calls it a "nunchuk"). A couple of years ago (ancient history in web years) I came across a post by Tod Kurt who made a simple little circuit board allowing you to plug your Wii nunchuk into a circuit without cutting anything. I bought a board from him ($4 I think, a bargain for the brilliance), but just forgot about it, not having a killer use for it at the time. Now I do!



And there you have it. Who knows how many dollars of Nintendo engineering on its way to Dawson Station. Stay tuned, since that is only the start of the planned "geekification". If you want to know the bloody details, as in code, I detailed it at great length on Instructables. Which, I just been informed, has been "featured".

7 comments:

  1. Hi there! thanks for the post! Quick question: will that work with any electric trains? I've got an E-Z tranck system train... curious to see if that would work. Any ideas? What are the requirements?

    ReplyDelete
  2. I love it, great project for Father's day!!

    ReplyDelete
  3. I love reading your posts. You're having so much fun with your layout. And that's how it should be. Well done!

    ReplyDelete
  4. Great project!Thanks for sharing your great creativity with us...

    ReplyDelete
  5. Very cool. I'm looking to use an arduino as the base to some yard panels to issue DCC turnout routing commands on to the Digitrax Loconet. This should eliminate a lot of wires under the layout.

    ReplyDelete
  6. I used to be fascinated together with the subject as well as the circulation on the tale. Keep up up to now the truly awesome perform.modelismo ferroviario en valencia

    ReplyDelete