Beginners Ask Trains How can I use an Arduino on a model railroad?

How can I use an Arduino on a model railroad?

By Steven Otte | June 17, 2024

Ask MR: An Arduino can do things like controlling signals, turnouts, and animations

Email Newsletter

Get the newest photos, videos, stories, and more from brands. Sign-up for email today!

A small, square, blue circuit board labeled “Arduino Uno”
There are many ways to use an Arduino on a model railroad. These tiny, inexpensive, programmable computers can perform functions such as controlling signals, routing turnouts, and running animations. The Arduino Uno, seen here, is one of several brands and types of Arduino microcontrollers available. William Mitchell photo

Q: In your Ask MR question “Is there a way to automatically slow DCC locomotives?” you mentioned Arduino, a DCC-connected programmable system. Is that like Java Model Railroad Interface (JMRI) software, and if so, how do the two compare? — Bruce Fogwell

A: Hi, Bruce. Arduino isn’t software — it’s hardware. An Arduino is a tiny computer, called a “microcontroller,” with its own programming language. Arduinos are open source, meaning that how they are made and the firmware that runs them is public knowledge. Anyone can make and distribute them and their software, they’re extremely inexpensive, and upgrades are being made all the time.

Plug-in circuit modules called “shields” let you connect an Arduino’s inputs and outputs to components like lights, displays, speakers, motors, solenoids, sensors, and other systems useful on a model railroad. Modelers have been using them for such layout jobs as detecting block occupancy, controlling signals, indexing turntables, playing sound effects, lining turnouts, running lighting effects, and more.

Java Model Railroad Interface, as its name implies, is written in the Java programming language. Arduinos have their own open-source programming language. (It’s similar to C++, if that means anything to you. It doesn’t to me, since I flunked out of computer programming class.) So Arduino and JMRI don’t work directly together. But both can interface with other digital systems, including DCC, so sending data and signals from an Arduino to a JMRI-equipped computer is theoretically possible. Though both do their jobs so well on their own that I can’t imagine a case where you’d need to.

We’ve published numerous articles on ways you can use an Arduino on a model railroad. These include:

We’ve also got a book on how to use an Arduino on a model railroad coming out in early 2025. Those should open your eyes to what’s possible and what’s coming in the future of our hobby.

Send us your questions

Have a question about modeling, operation, or prototype railroads? Send it to us at Be sure to put “Ask MR” in the subject.

2 thoughts on “How can I use an Arduino on a model railroad?

  1. Not only do Arduinos come into good use, so will the Raspberry Pi mini-computers. in some applications. The advantage the Arduino has is that it can be uses to trigger relays or servos. The RPi can be used for direct control, as it can run JMRI with pretty much any O/S that can run on an RPi (as they include C++). They also have HDMI output so that a monitor can be attached.

    And for both – they are rather inexpensive. An RPI, with power supply and case will run about $50, add another $10-20 for a good sized micro-mini memory card (I recommend 16-32gb minimum), and viola – you’ve got a very good small computer. Given that the O/S is free if you get it from Raspberry, and JMRI is free, that’s a pretty good deal.

    1. A quick correction: The Raspberry Pi also has an open-source Java imbedded in pretty much all of its available O/S bundles.

      Sorry – that was an omission I should NOT have made…

You must login to submit a comment