You're reading ...
Arduino, Hardware, Software, Traincontroller

Traincontroller 53 – Speed profiling an engine using an external device.

This is part 3 of 3 on a € 6,- DIY model train speed measurement device.

Part 1: The hardware
Part 2: The Arduino software
Part 3: Speed profiling an engine in Traincontroller 9 with an external device

Traincontroller 9 has a semi-automated speed profiling option for use with a ‘third party device’. Well … that ‘third party’ … that’s us! With our brand new built Arduino speed measurement device described in part 1 and 2.

The TC measurements are done one by one. When we press START the engine starts to run with a speed and direction set by TC. Our device performs the speed measurement while the train passes by. When done, we press STOP and TC shows a field where we can enter the measured value. We now press START again to start the next measurement. And so on.

Despite the operator interaction, measuring a complete speed profile this way takes far less time than it would otherwise, because the device performs the measurements with high accuracy over just a very short distance.

The steps to take to profile an engine with an external speed measurement device are:

  1. If your Command Station has the option to select the DCC output voltage, set it to the desired value and from there on never change it again.
  2. Set your loc decoder’s CV3 (acceleration) and CV4 (deceleration) to 0 (or to 1, if 0 gives problems) and ensure that ‘traction control’ is enabled (refer to your decoder’s user manual how to do this).
  3. Tune CV2 (minimum speed at step 1), CV5 (maximum speed at step 28) and CV6 (medium speed at step 15) such that you derive speed values that you like, using the measurement device. Example: 4, 80, 40 km/h. Also measure the backward max speed … this may differ some.
  4. In TC9, go into Edit Mode and double click the engine to profile in the ‘Engines+Trains’ window to open its properties window.
  5. Click the ‘Speed’ tab and enter the maximum speeds you just measured in the ‘Forward’ and ‘Backward’ fields.
  6. Now click the ‘Automatic Speed & Brake’ button and in the new window click ‘Advanced Fine Tuning’. We’re in the speed calibration window now.
  7. First click the ‘Threshold Speed’ tab. Move the green slider to forward speed step 1. The engine now runs at the minimum speed we just tuned with CV2. Click ‘Store’. Do the same backward.
  8. Now click the ‘Speed Profile’ tab and from the ‘Measurement’ drop down select the one with the tools icon, where the tooltip says ‘Measurement of the complete profile with a third party device’.
  9. TAKE CARE: Set both the ‘Run Out’ and ‘Pause’ fields to zero. If there is a non-zero value in the ‘Run Out’ field, your engine will keep running after you pressed ‘Stop’ … we don’t want that.
  10. We’re ready to start measuring. Place the engine such that the forward direction is towards the measurement device. Just a few cm away is fine at low speeds; this will give nice short measurement times. Now press ‘Start’.
  11. The engine now runs through our measurement device. Once it is fully out, press ‘Stop’, read out the km/h value, enter it into the field presented by TC and click ‘OK’.
  12. Click ‘Start’ again to start the next measurement (this will be backward). And so on … until 14 forward and 14 backward measurements are done. Take care to let the engine run a bit further away as the speed increases … we need to give it some room to accelerate.
  13. When the speed calibrations are finished, select brake compensation measurement from the drop down.
  14. Enter the brake ramp distance you use in the majority of blocks and set the slider to the speed with which you usually enter blocks where you want the train to stop.
  15. With a few iterations, tune the ‘Brake Compensation’ forward and backward values such that the engine stops accurately at the distance specified.

The video shows the whole process.



About RudyB



15 thoughts on “Traincontroller 53 – Speed profiling an engine using an external device.

  1. Thanks so much for this Rudy! I built a similar speed measurement device using an Arduino nano and some diodes from cheap TCRT5000 sensors. I modified your Arduino code so that only the raw speed is sent to the serial monitor. and then used a little 10 line python script in Windows to monitor the serial port and copy any data onto the windows clipboard. That gives me fully automated speed profiling in Traincontroller! I noticed the Arduino code that wrote to the display had quite a bit of overhead so that the slowest timing I could get was about 700ms (~160km/h in N scale at 200mm sensor separation ) – by commenting out the zeroing of the display at the start of a run would get that down to about 300ms. This is going to save a lot of time profiling my locomotives!


    Posted by Chris C | June 16, 2019, 00:48
  2. Hi Rudy, I got interested in your ”speedometer” for the modeltrains. I’m a user of the ESU ECoS and Traincontroller And decided to build me a similar using most of your code. What’s missing is the interface to Traincontroller which can be easily be fixed with ”AutoIt” scripting language for Windows. I have written a little Windows program using AutoIt which will read the serial from the Arduino and place the value on the clipboard for Traincontroller speed profiling. Works great! Please contact me if you find this interesting. Best regards /Peder


    Posted by Peder Berggreen-Clausen | April 26, 2019, 14:41
    • Peder, that sounds absolutely great. I am a user of AutoHotkey, which is somewhat similar to AutoIt. I’d be very intersted to see what you have made. At the museum we need to profile many trains, automating it will gretly reduce the effort. I will send you an email.


      Posted by RudyB | April 27, 2019, 08:03
  3. Guten Tag Rudy.
    Ich habe arduino-1.8.8 installiert aber der Speed-Measurement-Device folder und sketch ist nicht auffindbar.
    Kannst Du mir weiterhelfen?
    Liebe Grüße


    Posted by HDGSandkrug | January 23, 2019, 11:12
  4. hello Ruud,im ital247, i first contacted you in relation to getting a walthers 130″ turntable to work using train controller gold software via video traincontroller 53 on youtube. i am still unable to get these working together, can you help me please?


    Posted by ital | September 9, 2018, 20:35
  5. hallo Rud! What about the use of a ‘roller test bench’ as indicated at pg.128 of TC9Gold manual? In this case we do have a train rolling on ‘its own’ only…than how to perform the speed measurements?
    …thks for all your cute exercises about TC


    Posted by vieri | April 11, 2018, 15:38
  6. Hi Rudy. Isn’t the speed measurement using a distance of 200mm inherently less accurate than say, using the distance of a Block on the layout of perhaps 1M or more when using TC to make the measurements using indicators?

    My thinking is that in such a short distance speed variations of the locomotive due to gear wear, inaccurate decoder, motor speed ripple, temperature, etc. have a greater impact on the measurement accuracy than over a greater distance where momentum aberrations are more likely to average out.


    Posted by Geoff | April 9, 2018, 15:40
    • Sure, the longer the track, the higher the overall accuracy (given an accurate time measurement) and the more all kinds of aberrations average out. But the device is more than accurate enough and it gives a substantial gain in the time needed for a complete profile. Plus … it is just fun to build and to have one.


      Posted by RudyB | April 9, 2018, 15:50
      • Absolutely! Actually, I had been looking for an Arduino project to learn on as well as incorporate into my MRR activities and this looks perfect. Indeed, I have spent a lot of time over the years profiling new locos as well as re-profiling others from time to time as they loose accuracy due to aging. Thanks.


        Posted by Geoff | April 9, 2018, 17:12
  7. Hi Ruddy. I am folllowing your TC tutorials since you started. The tutorials are super, better than the original handbook !! I had built DDC decoders with Arduino, but I never tought to build a speed measurement device. Thanks a lot for sharing !


    Posted by E4lok | March 31, 2018, 17:55


  1. Pingback: A € 6,- model train speed measurement device. Part 2: the Arduino software. | rudysmodelrailway - March 29, 2018

  2. Pingback: A € 6,- model train speed measurement device. Part 1: the hardware. | rudysmodelrailway - March 29, 2018

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Archive of all posts


%d bloggers like this: