Been a whirlwind couple of months, and the project blog has been neglected slightly. Now that spring has finally sprung in the “Northland”, outdoor projects will be the highest priority. Thankfully, I have a few projects that I needed to catch up on writing about, and this is one of them…..
This is the first of a number of posts in regards to a larger project that I am helping a friend with. It will be a very interesting project and hopefully more posts will come from it.
The main focus of this post is solving the challenge of displaying a model railroad locomotive’s “scale speed” on an actual locomotive speedometer for viewing.
To accomplish this, I needed the following supplies:
- Micro USB 5V power supply
- ESP8266 Arduino
- Stemedu DC0-25V Voltage Sensors
- GG90 Micro Servo
- Retired Pulse Locomotive Speedometer
- LEDs (3.3V)
- Wire

A “real” locomotive speedometer uses small generators on the axles of the locomotive to generate a voltage pulse based on how fast the wheels are turning. The speedometer then reads this signal and based on what the wheel size is set to, displays the locomotive’s speed. As the wheels of the locomotive wear down over time, the wheel size is measured and the device is re-calibrated.
The basic idea of my project was to use a DCC decoder programmed to the same speed table (amount of power applied to the DC motor in the model based on the DCC controllers set speed table) as the locomotive we want to display the speed of. This DCC decoder will put out the same voltage as the one in the model locomotive. Using an Arduino, it will read voltage (simular to the Aurdino Voltage Monitor Project) and then in turn drive a servo based on the voltage / scale speed.
I started working on the project before an actual speedometer had been secured. I started with hooking up the voltage monitor, servo and Arduino. This was the first project I have ever used a servo with, so it took a little messing around to get the hang of it. I came up with a sketch (Arduino program) to get the job done.
#include <Servo.h> // add servo library
Servo speedometer; // servo object
int traction = 0; // analog pin used to connect the sensor
int speed; // variable to read the value from the analog pin
void setup() {
Serial.begin(115200);
speedometer.attach(D4); // SERVO D4
speedometer.write(0);
}
void loop() {
speed = analogRead(traction); // Traction voltage reader (value between 0 and 1023)
Serial.println(speed);
speed = map(speed, 0, 1023, 180, 0); // scale of the speedo
speedometer.write(speed); // move the needle
delay(200); // waits for the servo to complete movement
}
Using the script, I created a prototype “model” (if you can even call it that) of a the speedometer plate and tested it out. I used a desk top variable power supply for adjusting the reference voltage to the sensor, and everything seemed to be working fine.

At this point, it turned into a waiting game to get ahold of a retired speedometer. Thankfully some friends came through and found a couple of them. With the delivery of the first device, it was time to start taking it apart.


The calibration board, also houses 4 light bulbs for illumination of the semi transparent face plate. The unit is equipped with a dimming knob on the side of it as well. I will replace the function of the bulbs with four small LEDs.




Once I had the face plate all cleaned up it was time to start building a mount for the servo. I used two pieces of styrene mounted on each side of the servo, secured with super glue. After the glue hardened, I secured the servo to the back of the face plate using hot glue. As messy as hot glue can be, it is nice in these types of applications, where parts can go bad or errors are made.

I reinstalled the plate into the case and secured it with hot glue. I then took 4 white LEDs, and secured them to a polystyrene sheet and place that on the back of the servo. Using the Arduino’s 3.3v pin and ground, I wired the LEDs in parallel and got ready to test what I had done so far.

I ran some tests, and powered on the LEDs. At this point I was as far as I could get without the decoder. To be continued in part two!
Awesome! Keep up the good work.
You never cease to amaze me with what you come up with, Will!