Back on the Rails

Holidays seem to be my train time. I did a train show in April and a merit badge clinic in September and that is about it. I have gotten excited about the new Raspberry Pi computer, and plan on using it to control Dawson Station instead of the two Arduinos I use now.  There were are a lot of things that I hacked together to get Dawson Station working, and I've long wanted a chance to do it over, simpler and cleaner.

My first step is designing a new control board. This will basically have an Arduino brain (Atmega 328) and two L293D H-bridge controllers. That isn't much of a departure from how it currently works, except it collapses several separate modules on to one board and will be able to control the engine and turnouts itself, or interface with another computer (say a Raspberry Pi)!
Perhaps my biggest leap in simplicity is in the turnout control. In my prior amateur stumbling, I ended up using a transistor to control a relay to control Ken Stapleton's switching circuit (times two!). I burned up two Atlas under-table switches figuring out that Rube Golberg setup. I guess that happens when a 5 volt guy starts trying to control 12 volt systems.  I've determined you could do the same job with several two-dollar, high-power MOSFET transistors, or (drum-roll please) a L293D H-bridge. There are two of these on the Adafruit motor control shield I'm currently using, capable of powering two DC motors each, of which I'm currently using exactly one half of one. A single H-bridge, with some diodes, can control both turn outs! It works, and I've only burned up one resistor and two cheap transistors.
The prototyping and testing is done, and the board is laid out and sent off for manufacture. See if you can tell the difference between my board and Lady Ada's motor shield. That is Open Source Hardware for you. She provides all the design files and I just stripped it down and built if up the way I wanted, complete with a  Wii nunchuck adapter! I just have to wait six weeks for it to come back from China to see if it works as advertised. If it works, I'll post my designs on line for others to use as well. So it goes.


  1. Could you tell me how you are controlling the turnouts with the H bridge? Are you just usingit as a switch?
    Ricardo Jorge

  2. Yes. The center lead of the turnout solenoid ties to ground. The outer leads tie to the H-bridge outputs. You can then pulse them for ~250ms to make it switch. If you hold the current on too long, it will melt the solenoid. My Atlas switches work well with as low as 12VDC input. My Life-Like ones need more like 20VDC to kick over. I haven't done any experimentation with applying PWM, which should cut the current needed. Let me know how it goes!

  3. Thanks Ken,
    The nunchuck and the motor shield work flawlessly. A nice touch is the possibility to adjust "momentum" in it's various forms.
    I use servos in my layout turnouts and have been toying with them and the Arduino, but also have a smaller one where I use Atlas. I'm using the capacitor discharge unit 2 ( to limit the pulse and give the solenoids the "punch" they need, and it is this discharge that I wanted to switch with the L239, but the idea of limmiting the discharge to 250ms with software makes this unit disposable.
    Needless to say that I am a great admirer of your work in this layout, and I am looking forward to hear about the results of your new "shield".
    Thanks again,
    Ricardo Jorge