Please read the general section first!


The MattzoSpeedController is used to measure the speed of LEGO trains on the layout.

The controller is based on an ESP-8266, uses the MattzoLayoutController firmware, and features a small OLED display. The example on the picture above comes in a nice little 3d printed box with LEGO compatible studs (designed by Tomáš Jukin).

Functional Description

Two reed sensors need to be connected to the controller. The controller measures the time between two sensor events and calculates and shows the speed of the train in a studs/second or another speed unit on the display. If the train has more than one magnet that triggers the sensors, the MattzoSpeedController will also calculated the length between the two magnets and optionally also show it on the display.

The MattzoSpeedController works autonomously, but it can be connected to Rocrail via MQTT like most of the other MattzoControllers. This may be useful to make use of the connected sensors in Rocrail for train automation and block sequencing purposes.


We will shoot a video with the nice little speedy trains about the MattzoSpeedController soon. Thanks for your patience.


A wiring diagram will be provided soon.

If you are experienced in electronics and can’t wait: buy an OLED display and connect it via I2C to an ESP8266 controller. Connect two reed sensors to Pin D6 and D7. Get or build a nice case. Here you go.

Required components:

  • I/O board with micro controller. We have used a NodeMCU Amica Modul V2 ESP8266 ESP-12F. Similar modules should work as well.
  • An OLED display that can be connected via I2C to a micro controller. For the case shown above, a 0,96° 128×64 OLED display should do, e.g. this one.
  • A usual USB charger as a power supply.
  • Two reed switches, e.g. the ones recommended for the MattzoSensorController.
  • A bread board. The one fitting into the case shown above is this one.
  • The usual standard stuff like wires etc.

Rocrail Configuration

No configuration in Rocrail is required.

If you want to make use the reed sensors in Rocrail, configure the sensors in Rocrail as described on the MattzoSensorController page.

Firmware Setup

The MattzoBridgeController uses the MattzoLayoutController Firmware from version 0.4.2 or above. This version of the firmware is not released yet as I am writint this (2021-06-10), but we have intentions to release it soon.

Please read the documentation for the MattzoLayoutController first how to basically setup, configure, compile and upload the firmware. Use the example configuration file “MattzoLayoutController_Configuration_Speedometer.h” instead of the default configuration file!

The speed controller specific parameters in the configuration file start in section “// SPEEDOMETER CONFIGURATION”. The meaning of the parameters is explained in the configuration file and should be self-explanatory.



The MattzoSpeedController firmware was programmed by MattzoBricks core development team member Markus, who also had the initial idea for this controller. The firmware was subsequently merged into the MattzoLayoutController firmware by Mattze and is now part of the common code base for land based MattzoControllers.

Thank you, Markus!

Leave a Reply

Your email address will not be published. Required fields are marked *