How To Expert Tips Download the code files for Model Railroader’s Arduino Projects

Download the code files for Model Railroader’s Arduino Projects

By Model Railroader Staff | September 8, 2025

Looking for the code files for Model Railroader's Arduino Projects? You've come to the right place

Email Newsletter

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

Code for Button/Blink Test (SN095) – Chapter 1, page 11

This code is basic but allows the reader to gain insight into key elements for several other projects in this book.  It combines two pieces of code that are listed in the examples tab in Arduino IDE.

Click here to download a .txt file which includes the code

 

Code for Basic 3-Color Signal (SN110) – Chapter 2, page 19

This code expands on SN095, by adding multiple LEDs/incandescent bulbs using the delay command to simulate the transition of a railroad signal through its sequence from red to yellow and back to green after a switch initiates the start.

Click here to download a .txt file which includes the code

 

Code for Crossing Signal (SN160) – Chapter 2, page 21

This code is set up to demonstrate the ability to use a piezo device to emulate a a road crossing bell and synchronize the sound to the blinking of two LEDs.

Click here to download a .txt file which includes the code

 

Code that incorporates the two infrared sensors (SN165) – Chapter 2, page 22

The next step in this project is to incorporate two infrared sensors that are located between the tracks on either side of the road crossing.

Click here to download a .txt file which includes the code

 

Code with Outputs opposite for common Positive Crossing signal lights (SN166) – Chapter 2, page 24

This code reverses the common side on the LEDs to a positive rather than ground.

Click here to download a .txt file which includes the code

 

Code for Station Fast Clock (SN150) – Chapter 2, page 26

This code is specific to the Sparkfun Microview Arduino and sets it up as a ten-to-one fast clock with an analog clock face.

Click here to download a .txt file which includes the code

 

Code for Simulated Arc welder (SN220) – Chapter 3, page 27

This code uses an on-off switch, white LED and the random function to simulate an arc welders intermittent arc.The original code had some time issues, this version is simple and works well.

Click here to download a .txt file which includes the code

 

Code for simulated arc welder and cutting torch (SN230) – Chapter 3, page 29

This code expands the simulation by incorporating the milli command to simulate both the arc welder using an LED and simulating a cutting torch using a small 12 volt lightbulb.

Click here to download a .txt file which includes the code

 

Automatic reversing loop control for standard DC (SN184) – Chapter 4, page 44

This code senses when a train is in the reverse loop section and then throws the turnout along with swapping the feed wires to the main line so the train runs continuously with no action for the engineer.

Click here to download a .txt file which includes the code

 

ABS Code V1.5 Common Cathode Code – Chapter 4, page 50

This code implements a single section of bi-directional ABS signals using Arduino with signals that have common cathode (positive side of LED).

Click here to download a .txt file which includes the code

 

Code Occupancy detector Code (SN010) – Chapter 5, page 58

This code ensures the occupancy detectors work prior to using them in the next step.

Click here to download a .txt file which includes the code

 

Code for CMRI Node to interface with JMRI (SN245) – Chapter 5, page 61

This code sets up a single CMRI Node on an Arduino that will communicate with JMRI located on a computer or Raspberry Pi.

Click here to download a .txt file which includes the code


Click here for Model Railroader‘s Arduino Projects, written by Paul and David Bradt and available from shop.trains.com

You must login to submit a comment