MRR Speedometer (Arduino)

Aug 5, 2026 | General, The Build | 6 comments

MRR Speedometer (Arduino)
Several years ago, while working on DCC programming and speed matching locomotives, I wanted a simple way to see how fast a locomotive was actually moving. Judging speed by eye only gets you so far, and measuring a section of track, timing a locomotive and doing the math every time gets old pretty quickly.

It also seemed like exactly the kind of problem an Arduino could solve.

The basic idea behind the MRR Speedometer is pretty simple. Two infrared sensors are placed a known distance apart along the track. When a locomotive passes the first sensor, the Arduino starts measuring time. When it reaches the second sensor, the Arduino knows how far the locomotive traveled and how long it took to get there. From those two numbers it can calculate the scale speed and display it immediately in miles per hour.

Since the sensors operate independently of the track, the speedometer doesn’t care whether the railroad is running DC or DCC. It also works in either direction. Whichever sensor the locomotive encounters first starts the measurement and the other completes it.

Using It on the Railroad

The original version used sensors spaced about 2.65 inches apart, but there isn’t anything particularly special about that distance. The software can use whatever distance exists between the two detection points. The scale is handled the same way, allowing the same basic hardware to calculate speeds for Z, N, HO, S, O or G scale.

I also experimented with several different ways of mounting the sensors. They can sit beside the track as part of a portable speedometer, but there is no reason they have to be obvious. They can be separated and incorporated into scenery or structures as long as they can reliably detect the train and the distance between them is known.

Where the speedometer became especially useful was DCC speed matching. Rather than watching two locomotives and trying to decide whether they looked close enough, I could run each locomotive through the speedometer at several throttle settings and have an actual number to work with. Make an adjustment to the decoder, run the locomotive through again and immediately see the result.

It was also a good reality check for normal operation. Model trains have a funny way of looking slower than they really are. Something that appears to be moving at a reasonable switching speed can look considerably different when the display says 30 scale miles per hour.

The electronics for the project were deliberately simple. An Arduino Nano handles the timing and calculations, two inexpensive infrared sensors detect the train, and a small LCD displays the result. I initially built everything on a breadboard while working through the software and sensor placement, then moved the project onto a more permanent prototype board once I was happy with it.

At the time, that was really all I was trying to accomplish. I needed a speedometer, so I built a speedometer, the way I wanted it.

  • Scale: Z, N, HO, S, O, G
  • Kits include v2 Components
  • Bi-Directional
  • DC or DCC
  • Displays Scale Speeds
  • Speed match your DCC locomotives
  • 4 Different Sensor configurations
  • Compact and portable
  • On-board Status LEDs.
  • It requires a 5v supply, USB, or direct for the Nano.

One Piece of a Larger Puzzle

What became more interesting over the years was the idea behind it.

The infrared sensors don’t actually know they’re part of a speedometer. One simply reports that something has happened at one location and another reports that something happened somewhere else. The Arduino gives those two events meaning. In this case it uses the time between them to calculate speed, but measuring speed is only one thing you can do once the railroad can tell you where something is happening.

A train passing a sensor might affect a signal. It might trigger lighting in a building, start an audio sequence, operate an animation or tell another part of the railroad that a train has entered or left an area. Two or more events can also be related to each other instead of every little electronic project underneath the railroad living completely on its own.

That’s part of the thinking behind IRROD, the system I’m currently developing for my own railroad.

IRROD isn’t simply this speedometer expanded into something larger, and I’m not trying to turn every old Arduino project I’ve built into part of it. But projects like this are where a lot of the ideas came from. They gave me a chance to experiment with sensors, microcontrollers and physical events on the railroad and start thinking about how those pieces could work together.

The speedometer still does exactly what I originally built it to do. Put a locomotive through the sensors and it tells me how fast it’s going.

It just turned out to be one small piece of a much larger puzzle.