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

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 AskTrains@Trains.com. Be sure to put “Ask MR” in the subject.

Share this article