Home » Electronics » Turnout decoder for 64 servos

Turnout decoder for 64 servos

Using servos instead of normal turnout motor can be a challenge for the electronics. Comparing to the normal versions, these decoders cant not only enable/disable some of the outputs. They need to have the following features.

  • Send a specific signal to every servo, so they are in the right position.
  • Move slow, as you don’t want the servos speed, but instead something much slower
  • Turn of power to the servos, if you turn of the power to the tracks.
  • Turn on power to the servers, but not all at the same time. If you have 100 servo, you DON’T want them to get power at the same time. It will drain so much from your power source, so it will affect the voltage, and then the microprocessors restarts itself because of brown-out.
  • Separate power connection to the servos. Not from the same source that gives power to the microprocessors.
  • Memory to remember end-points. You don’t want the servo to move to much or to little
  • Memory to remember last know position. No need to refresh/restart the entire railroad, and to move the arm to a start position every time you power on the servos

This list is something that I have found out of experience. But now, all these features are included in my servo controller solution. So feel free to use it, and I hope you will get a good experience from using it.

I have created a very short movie that shows the movements of the servos and turnouts. I will give you an understanding about the operation on the track once they are installed.



This servo decoder is built up from a central card and a number of smaller daughter cards. Every central card can handle 16 daughter cards, and every daughter card can handle four servos and four signals. Yes, you heard right. It can also handle signals. So a full blown out solution, you have a controller for 64 servos and 64 signals. On my railroad, I actually have four central cards, as they are under different tables. But not all cards are full on daughter cards. One of them have only four daughter cards.


USB and Raspberry Pi

All configuration changes regarding turnout addresses, servo speed, servo endpoint and so on is handled thru an USB interface, connected to a Raspberry Pi. I use the Raspberry Pi as that is a normal Linux computer, and it was already available on my railroad as I use it for my Lightning Solution. For those of you that don’t know what a Raspberry Pi is, it’s basically a very small computer. Roughly the size of a normal turnout decoder. I will, somewhere in the future add a full image to my Raspberry Pi to this page for downloads. Will make it much easier for new users to get started. Send me a comment to this post if your interested.


XpressNet connection

Connection to the railroad for is done thru XpressNet. I know that alot of people will find that stupid, and argument that a standard DCC signal from the tracks are better. Usually the first one is the fact that you can only connect 31 devices to that bus, depending on version. Well, that is actually wrong. You can have 31 devices talking on the bus, but you can have a lot more devices connected and listening. So thats not a limitation. And there is also information about feedbacks available on the bus. Why do I wnt that? Lets say that you want to change a signal to red as soon as the trainentersthe next block. Very simple if you can listen to the feedback from that track, and turn it in the decoder compared to waiting for the signal to switch to red from example TrainController. And the last argument is why should I draw power from the DCC booster to handle turnouts? Let the booster do the one thing it’s designed to do. Feed power to the track.


The micro controller and programming

The central board is built around a PIC 18F4550. One of the features in this chip is the USB connection, and I use it for communicating to the Raspberry Pi for configuration changes. The program is written in MikroC from MikroElektronika. Now, one of the features is that the serialnumber for the USB device must be unique, and I set it the current timestamp at compile time. A very easy solution for me atleast, as the cards will have a unique serial number from that. For that reason, I have included 4 different HEX files in the download package. The olny difference between them is the USB serial number. If you connect to cards with the same serial number, linux will ID them as the same device and try to multipath them. Not so good. So just use different HEX files, and your safe. If you need more than four unique serial numbers, drop a comment and I can compile some more.


Connections and wiring

servocontroller wiring

To proper wire the solution, this is what you have to do.

  1. Add +5V power to the Central card. Be aware of polarization, as there are no protection built in that will protect the micro controller if you do it wrong.
  2. Add +5V power to the daughter cards for the servos. The servo power and the +5V power to the central board have a common ground. So be aware of the polarization here as well. I recommend to use a separate power supply for the power to the servos. To avoid disturbance on the micro controller when turning on the servos
  3. Connect the daughter board to the central card. I use the kind of wire that usually is used to install larm systems at houses. A four wire cable, but I only use three of them
  4. Connect the servos to the daughter card. Ground (usually black on the servo cable) should be closest to the PCB edge, and the signal (yellow in my case) closest to the micro processor
  5. Connect the USB cable between the central card and the Raspberry Pi. I actually have a number of USB hubs located under all the tables that is connected to the Raspberry Pi. And this is something I can recommend anyway if you will build another one of my projects. I use the Raspberry Pi and/or USB a lot.
  6. Attach the XpressNet cables. The L cable is power, and that is not really needed, but I usually connect it anyway. Just so I have a complete XpressNet wire to the board and can connect maybe a handcontroller further down the buss.


Linux utility

The linux utility have a lot of functionality. You can do the following

  • Set the name of the card
  • Set speed of the servo
  • Set min and max positions of the servo
  • Set the adress of the central card
  • Show all settings, including addresses for every servo and signal
  • List all connected cards
  • Save and restore settings to/from a file
  • Turn on the ident LED on the central card

For syntax and command help, run the following command

./servoSettings help



Circuit - ServoCentralCard V1.2

Circuit - ServoSignal DaughterCard V1.5


PCB design


PCB - ServoCentralCard V1.2

Yes, I know. The text “Isak är bäst på LEGO” is on the PCB. That’s Swedish and stands for “Isak is best at LEGO”. My son Isak helped me to etch the PCB’s (on a side note, etching PCB’s is a great activity to do with an 4 years old kid) and demanded that the text should be on the PCB. So now it is…



Daughter card

PCB - ServoSignal DaughterCard V1.5



CentralCard V1.2 CAM
DaughterCard V1.5 CAM
4 x Servo DaughterCard HEX

16 x ServoCard Controller HEX

Leave a Reply

Your email address will not be published.