Skip to main content

Here's a project I've been working on for the last, oh... year or so, that I thought folks might be interested in.

A little background: I've been running DCC on my layouts for a while now. I do a large, temporary layout around the holidays each year (see this post for more details), so I wanted a standalone DCC accessory decoder for my turnouts. Nothing commercially available fit the bill, and I don't already have nearly enough other projects going on, so...

I decided to design and build one myself. I wanted to be able to basically just pop the turnouts into the layout like any other piece of track - no setup after installation, no wiring, but still independently controllable. Also, I wanted something based on a widely available microprocessor, so that it would be supported and upgradeable well into the future. The design had to be DCC powered and controlled for easy installation, and the whole thing had to be small enough (both the electronics and the mechanical bits) to attach to the side of a turnout and be installed above board.

Skipping months of development and getting to the good part, here is a picture of the completed assembly installed on a #4 Ross Custom turnout.


And the same turnout from the underside showing the circuit board in the enclosure:


I came up with three different versions of the circuit board and enclosure designs, one for standard size turnouts, one for longer turnouts like the #6s and #8s, and one for double crossovers like the Ross model #175 or #280. The long version has two relays for controlling the turnout leads depending on the position. The crossover version controls four servos instead of just one, and has four relays for all the turnout leads. All three versions share a similar design and features, including:

  • Operation configurable via CVs
  • Controllable via accessory commands for normal turnout operation
  • Controllable via signal aspect commands for external outputs and optional functions
  • Non-derail sensors (contact or optical) automatically throw the turnout for trains approaching from the wrong direction
  • Two solid state relays for powering or grounding switch rails as needed
  • RGB LED for status indication
  • Manual control via pushbutton on enclosure
  • 5A switching power supply powers the board, servos, and externally accessible 5V output
  • Two external controllable outputs for lighting or other accessories
  • Servos are powered off when not in use
  • Two servo speeds, slow for normal operation and fast for non-derail
  • Software upgradeable in place

Here are a couple pics of the printed circuit board assembly. The blue Arduino daughterboard is an off the shelf item from Sparkfun. The green PCB is the part that I designed and built.


I wrote up a paper detailing the mechanical, electrical, and software aspects of the design, if anyone is interested in more details. It's on my website here. The code is maintained on GitHub, which I will open up once it's a little more combat proven.

At this point, I have sixteen of them built and installed on an assortment of Ross Switches, including a bunch of #4s, some O72s, two #6s and two O96 curved switches. I am putting the final touches on the installation on a #280 crossover as I type.

Setup of this year's layout starts tomorrow, so I better finish up tonight!

Update 9/10/18:

Here is the github repository for the code I developed.

Update 4/7/20:

For a related project that builds on some of the development I did for this one, see my Tale of Two Turntables.


Images (4)
  • IMG_6439
  • IMG_6446
  • IMG_6240
  • IMG_6238
Last edited by thor73
Original Post

Replies sorted oldest to newest

Severn posted:

Maybe a stepper motor then ... probably more expensive.

Yeah, there are a lot of different options for driving a mechanism like this. A stepper would be cool because it would naturally prevent the points from moving when unpowered (provided the detent torque is adequate). But, they require a motor controller chip in addition to the Arduino, whereas the Arduino can drive a servo directly. The mechanical packaging and attachment to the mechanism were also going to be a little more involved. I also had a hard time finding any small enough and readily available.

I also looked at small linear servos, like those used in micro RC planes. The packaging for those was going to be a little tricky.

Those are both ideas that I still think about periodically, though... 

Severn posted:

Just a question.  Why not turn the motor 90 degrees and get rid of the angle bracket connector ... ?

This was mostly for packaging reasons. I wanted the overall width of the assembly to be as small as possible, and putting the servo against the switch is much narrower than trying to put the servo in-line with the points link. The mechanism adds a few other nice features as well:

  • The bellcrack applies force basically in line with the points link. With the servo acting directly on the points link, there would be a larger angular component to the force, which I wanted to avoid.
  • The way it's installed, the bellcrank reduces the mechanical advantage of the servo, which means less servo travel for a given point motion, as well as reduced force applied to the points.
  • The linkage has a 'dog-leg' in it, which gives the mechanism some compliance. This makes it easy to maintain a reliable preload on the points, and also provides protection for the switch in case the servo goes haywire or a trains runs through the wrong way.
Doug-Sr posted:

very impressed great to see someone into three rail dcc or 2 rail s either

rtr12 posted:

That is a great project. Nice looking switch machine too. And as Doug-SR says above, it's great to see something in DCC for 3 rail!  

DCC really fits my needs well, especially when you get into designing and building your own stuff. A project like this would have been much harder working with proprietary protocols.

Off topic a little bit, but I also chose DCC because I can buy engines from any manufacturer. MTH is awesome with the PS3 having native DCC support. But any of the others are usable as well with a decoder replacement. Admittedly this adds some cost and effort, but it allows me to run any engine I want. I currently have some MTH PS3 engines, as well as some older MTH, Atlas, and Williams that I have upgraded.

Almost my entire engine stable is MTH PS3 and that is what I was going to use with DCC, if I ever get around to it. I already have DCS and Legacy, but the Items available and ability to customize (or fiddle) with almost everything in DCC is the draw for me. I am planning to have all 3 systems, the DCC being separate from what I already have layout wise. I have been eyeing the NCE DCC system for sometime now. I have so much other stuff to do first it will be quite a while before I get to it.

I like DCC because of all homebrew projects like this one or this one --  ... to list but a few.

As for the servo vs ___ motor.  I didn't think about the need for a motor controller chip/board.   Not really being a HW person, I only know just enough to be not even dangerous but half wrong, half the time or more.

So you say you are going to "open source" it in some way?   Even though it wouldn't be cost effective it might be fun to adapt it to make my few by hand switches adapted to some sort of remote throwing kind...


Here are a couple pics I took of the two different non-derail setups. Most of the switches use a contact sensor arrangement, similar in principle to the Lionel 022 switches. For this setup, the short main and short curved rails are isolated from the track ground and are instead each wired to an A/C optocoupler on the controller. When a wheelset rolls onto the short rails, it closes the circuit to the track ground on the outer main rails. This causes the opto output to go low, signaling to the controller that there is a train present.

The advantages of this arrangement (vs. the optical sensor) are cost and ease of installation. The main disadvantage is that the short rails are isolated from track ground and cannot carry any usable current for engines (although they are so short this is not really an issue in practice). They also require the use of insulating pins on each short rail.

Here is a #4 turnout wired with the contact sensors:


I use the optical sensors on the longer turnouts and the double crossover, where I want all the rails grounded to minimize the chances of engines stalling. The sensor is a self-contained unit consisting of an IR emitter, IR detector, and logic circuitry. When a train passes over the sensor, the detector picks up the reflected IR from the underside of the train, and the output of the detector circuit goes low, signalling to the controller that a train is present. Each turnout needs two sensors. They are more involved to install than the contact sensor wires, because each sensor requires a power, ground, and signal line. However, the installation is pretty tidy, and they provide the best possible track continuity.

Here is a #230 curved turnout equipped with the optical sensors. You can also see the ground wire I added for the short rails, which are not grounded by default.



Images (2)
  • IMG_6615[1]
  • IMG_6616[1]

"The sensor is a self-contained unit consisting of an IR emitter, IR detector, and logic circuitry. When a train passes over the sensor, the detector picks up the reflected IR from the underside of the train, and the output of the detector circuit goes low, signalling to the controller that a train is present."

Did you think about ID'ing the engine also?

Just linked to this thread from another Arduino thread.  As others have said "nice job"!

Do you happen to remember the type or manufacturer of the optical sensor you used?  They seem to fit nicely between the ties of the Ross switch and are inconspicuous.  I have used the TCRT 5000 in several places on my layout, however it is not as compact as the type you are showing.



Hey cool.  I finally, finally actually wired up one of my Ross TZ-xxx switch boxes and it's little button actuator.  And while I'm not saying it doesn't work, it seems to work in odd-ish ways to me at least, as it kind jerks from one side of the track to other in little "snicky" movements.  Maybe I'll grow to live it,  but -- I want a smooth movement... just move one side to other, slower or fast -- maybe depending on how hard I hit the button or the length of time I hold it down.   And I think, something sensitive to wrong way travel to fast switch the other way for non-derailing functions (since I can't keep track of anything anyhow... i need a little help).  I'm just about certain I don't like cutting the track to make derailing work.

Anyway, has nothing to do with anything really, except this opens up some possibilities!


Add Reply

OGR Publishing, Inc., 1310 Eastside Centre Ct, Suite 6, Mountain Home, AR 72653
Link copied to your clipboard.