Subscribe to Arduino Academy and start learning today for FREE!

Model Railroad Turnout Control – Arduino MOSFET

One of the projects we are working on is Turnout Control. Most home layouts are using Atlas or Bachmann track with solenoid type turnouts like the one shown here. More professional layouts use slow moving motors like the Tortoise. Our goal is to make these turnouts controllable with an arduino, so that future projects using train detectors and DCC can allow more automation. So here is the beginning of our project. This one uses the above Bachmann turnout (arduino servo control article coming soon), a arduino nano, two IRL520 MOSFETS, two resistors, and two diodes. The schematic is as follows:

Become the Maker you were born to be. Try Arduino Academy for FREE!

The diodes protect the MOSFET from inductive spikes when the solenoid coils fire. The two MOSFETS engage the solenoid coils to move the turnout. the two resistors keep the MOSFET from randomly conducting when there’s no input signal, by pulling the gate to ground (off). This uses two digital outputs on the arduino called straight and turn. The next article will show the board layout and wiring of the arduino, turnout and power supply. For more projects based on MOSFETS, see


Notify of
Inline Feedbacks
View all comments
4 years ago

Nice idea, but I can’t find the ‘next’ article mentioned. Can you link it?

Brian Jenkins
Brian Jenkins
4 years ago
Reply to  Tom

Thanks for the head’s up! It should be working now.

George Vesley
George Vesley
3 years ago
Reply to  Brian Jenkins

What is the sketch?

Anthony Hill
7 years ago

Technically, the two diodes are not there to protect the MOSFET when the coil fires. They are there to protect the MOSFET when the power to the coil is removed. When that happens, the coil (being a coil) will attempt to keep the current flowing – resulting in a huge reverse voltage spike. The diodes short that out.

David Riewe
7 years ago

Nice work!


Would love your thoughts, please comment.x