The Stack

The controller hardware design, while less than optimal, has settled down. It is too late to make any major changes before the show. I've taken to calling it "The Stack":
Starting at the bottom is the most robust part of the stack, an Arduino Duemilanove. It is a well loved development board based on the ATmega328 8-bit microcontroller. At 16 Mhz, 32 kB flash, and 2 kB RAM it actually specs out better than my first computer (a Timex ZX-81).

Next up the stack is a motor controller shield from Adafruit. It is a bit overkill, since it can control up to 4 motors at once using two L293D H-bridge chips. I'm only using one to power the train at 12VDC using 2 KHz pulse-width modulation. It connects to the layout using an CAT-5 LAN cable via a RJ-45 socket. I'm bringing in 12V for the controller and 5V for the microcontroller in here.

This proto board is just a stop-gap measure to get the rest of the connections (turnout controls and sensor inputs) from the layout. I should be able to combined it to get rid of one layer in "the stack", but for now it works.

Here is the top of the stack. I designed the board using Eagle CAD and had it manufactured by BatchPCB. It has a surface mount CD4067 analog multiplexer to light the LEDs to show the turnouts and throttle. It has given me no end of grief, and needs a redesign. Perhaps the best feature of the board is the Wii Nunchuk interface on the lower left. Even that needed some jury-rigging to get to work.

The turnout controllers, the sensors, sensor multiplexer, and the 5V power supply are all on the underside of the board and discussed elsewhere. What a mess. But it works. For now.

Video tour of the setup.


  1. Any chance you can post the arduino code you used for the railroad? I am attempting something similar and would like a good starting point.

  2. Send me an email (check my profile), and I'll send you the code. I'd love to see someone else doing Arduino related railroading!