How to make a slow moving turnout motor and circuit that controls turnout approach lights. The circuit can also be modified to initiate other actions.
Turnout Motor Overview
The code presented causes a yellow spotlight signal to flash when the turnout is in the divergent position. Yellow and green lights can be displayed on the layout control panel to show the operator the status of the turnout. Red and green entry lights display at each of the turnout ends.
The point motor is a Tower Pro SG90 servo that is controlled by an Arduino Nano. The Nano is attached to the board base via DuPont pin headers. That allows for the Nano to be removed for easy re-programing, replacement or used elsewhere.
This image shows a piece of 5 x 7 cm prototype board, a mini servo Tower Pro SG90, an Arduino Nano, 8 each 270 ohm resistors, 1 each 10k ohm dropdown resistor and 9 LEDs. All are widely available online.
This configuration uses 5mm LEDs. The resistance value of the 270 ohm resistors is fine for most commercially available LEDs. Do check what value you should have for your LEDs. Here is a simple procedure that uses AI.
You can get a complete kit with all the components at this link.
The code is available on pastebin where you can either copy it or download. Go here.
Turnout Demonstration Using A Code Simulator
Update In Progress
Turnout Motor Board Assembly
Telephone cable wire is used to connect the various elements.
You can also get a circuit board as one of the kit options. That saves a lot of time is you are going to make many of these for your layout.
This assumes that the board is powered by 5 volts through the 5v / GRND pins on the Nano. This powers the servo directly from the external power supply.
Use an On/Off toggle or latching push button switch.
The led colors we use are in the code. Change them to suit your needs.
You can reduce the number of LEDs simply by not wiring them.
Ppins A0, A1, A2, A3, A4 can be used as digital pins if you use a UNO or MEGA.. In the code loop they are commented out because we are using Nano. As output pins they can be used to trigger activity on another circuit. Such activity could include, but not be limited to turning on trackside lighting, audio, animating figures, etc.