Upcoming Version


Date: coming soon

Improvements and changes:


  • The LED of the LEGO Powered Up hub is now switchable. It can be set to any color manually via Rocrail or automatically when the starts, stops, or changes direction.
  • Controller configuration can be split into multiple files.
  • Update and enhanced the MTC4BT documentation.
  • Several minor bug fixes and improvements.


  • Configurable power for status LED using PWM.
  • Changed standard value of MIN_ARDUINO_POWER from 400 to 0 (still under review).


  • MLC mini example configuration.
  • Configurable power for status LED using PWM.
  • Multi-aspect signals: signals with more than 4 aspects.

Current Version


Date: February 6th, 2023

Improvements and changes:


  • Fixed the memory leak.
  • When a loco of a train with multiple locos disconnects, all other locos of the train stop.
  • When the last loco of a train with multiple locos connects, all locos of the train resume the last Rocrail command.
  • When the last loco of a train with multiple locos connects, all locos of the train resume the last fn command.


  • Signal overshoot sensors.
  • Updated some configuration files.



Date: January 1st, 2023

Improvements and changes:

  • General
    • Added VSCode workspace files to facilitate working on specific projects.
    • Minor bugfixes for platformio.ini files
  • MLC
    • Fixed and optimised example configuration files.
    • Fixed a bug for the bascule bridge.
    • Optimised serial logging.
    • Reporting of all physical sensors immediately after connection to the network.


Date: December 24th, 2022

First public release of the Mattzobricks git repository:


Firmware is now completely based on VSCode / platformIO. Arduino IDE is no longer required and supported.

Contains firmware for the following controllers:

  • MTC4PF
    • Codebase migrated to VSCode and platformIO.
    • Simplified configuration.
    • Code improvements.
    • Removed 4DBrix Wifi Train Controller support.
  • MTC4BT
    • Flexible and powerful light configuration including manual and automatic light group switches.
    • Significant performance improvement of the firmware in high traffic environments (many MQTT messages per time).
    • Improved stability when connecting multiple Bluetooth devices.
  • MLC
    • Codebase migrated to VSCode and platformIO.
    • Simplified configuration.
    • Code improvements.

Known limitations:

  • MTC4BT
    • The controller will crash when the configuration files become too large. This should not be a problem for normal configurations, but with 5 trains and a lot of light and light trigger configuration the limit might be reached.
    • There is a memory leak that leads to a reboot of the controller after about 1 to 2 hours (depending on the traffic on your layout; fixed in V1.0.2).
  • MLC
    • The example files for the MLC are somewhat buggy. Light signals do not work with the example configurations. Fixed in V1.0.1.


Date: November 18th, 2022



  • Last regular release with Arduino IDE based Controllers. Later versions will be based on VSCode + PlatformIO.


  • Bugfix


Date: October 3rd, 2022


MattzoTrainController for Power Functions (MTC4PF):

  • Up to 8 trains with LEGO Infrared Receiver 8884 can now be controlled with a single MTC4PF.
  • Fully configurable lights including manual and automatic control
    • No more code changes for auto lights required.
    • Control set of lights and components of multi-color LEDs with a single function button in Rocrail.

MattzoLayoutController (MLC):

  • Optimized servo power off for servos wired via port extender PCA9685.


  • New directory structure, allowing for private controllers configurations
  • Better hostnames, controller can be more easily found when updating firmware via OTA

MattzoTrainController for Powered Up (MTC4PU):

  • Removed from the package. Please use MTC4BT instead!


Date: January 9th, 2022


MattzoTrainController for Power Functions (MTC4PF):

  • Function pins support now analog output values. This allows dimming of the connected LEDs. Required for bipolar LEDs in direction-dependent train lights.
  • Corrected bugs in some example configuration files.

MattzoLayoutController (MLC):

  • Improved servo power save mode for directly connected servos. Servos no longer swivel away when powered off.
  • Corrected minor bugs in some example configuration files.


Date: December 18th, 2021


MattzoTrainController for Bluetooth (MTC4BT)

  • Initial Release
  • ESP-32 based controller that supports LEGO Powered Up and SBrick
  • Enhances MTC4PU functionality
  • Based on PlatformIO instead of Arduino IDE
  • Might make MTC4PU obsolete on the long run

MattzoTrainController for Power Functions (MTC4PF)

  • Multi-train support (to control multiple Power Functions infrared receivers with one controller)
  • Minor changes in standard wiring configuration

MattzoTrainController for Powered Up (MTC4PU)

  • WiFi Bugfix

MattzoLayoutController (MLC)

  • Servo
    • Directly connected servo can now be powered off after a couple of seconds, which reduces power consumption, prevents servo burn offs if blocked and reduce servo flattering.
  • Switches
    • Improved configuration of multi-servo switches (e.g. Trixbrix double slip switches).
  • Signals
    • Support for semaphores (form signals)
    • New powerful and flexible signal configuration
    • LEDs can be used for multiple signal aspects, e.g. green/yellow for German Hp2 (“go slow”) aspect.
    • Multi-servo support for form signals for complex form signals
  • Level Crossings
    • Optimization of boom barriers movement
  • Bascule Bridges
    • Support for multi leaf bascule bridges
    • Support for continuous servosOptimized state machineOptimized configuration
  • SpeedController
    • Measure the speed of your LEGO trains and show it on a display!
  • Configuration
    • Improved configuration for servos, LEDs and sensors
    • Decoupled hardware components (servos, LEDs and sensors) from logical components (switches, signals, level crossings, bascule bridges etc.)
  • Removal of legacy Switch, Signal and Sensor Controller firmware packages.

Known Bugs in Firmware 0.5

  • In most of the MLC configuration files, the following lines MUST BE CHANGED from:


  • In most of the MTC4PF configuration files, the following line must be added:
bool STATUS_LED_REVERSE = false;


Date: April 3rd, 2021



  • Delayed primary boom barriers for enhanced realism.
  • Virtual sensors for switches, level crossing and bascule bridge to make sure that the controllers have received a command and to prevent trains to enter critical track sections before switches, boom barriers or bascule bridges are safely set or closed.


Date: March 20th, 2021



  • Unification of MattzoSwitchController, MattzoSignalController and MattzoSensorController into a single MattzoLayoutController.
  • Support for port extenders PCA9685 and MCF23017 to control hundreds of signals, switches and sensors with a single controller.
  • Support for level crossings with moving boom barriers and flashing lights.
  • Support for bascule bridges with opening and closing leafs.


  • Bug fix, improving stability of WiFi connection and controller operations.

Several other bug fixes and improvements.

Additional example configuration files for various MattzoControllers.


Date: January 3rd, 2021


MattzoTrainController for Powered Up (MTC4PU)

  • Initial release.

MattzoTrainController for Power Functions (MTC4PF):

  • Complete code refactoring.
  • Separation of configuration from firmware code.
  • Support for LEGO Infrared Receiver 8884.
  • Support for 4DBrix WiFi Train Receivers.
  • Multi-train-support.


  • Automatic train lights for all MattzoTrainControllers.

Boot problem fix for all ESP8266 based MattzoControllers.

Emergency stop for all trains if signal or sensor controller disconnect from MQTT.

Optional status LEDs for all MattzoControllers.

Network logging (syslog) and over-the-air (wireless) firmware updates.

MattzoController have now correct hostnames on the intranet.

Safety feature for MattzoSwitchController to prevent breaking switch servos on obvious misconfigurations.

A large variety of other new features and improvements.


Date: November 19th, 2020


MattzoTrainController for Power Functions (MTC4PF):

  • Bugfix.
  • Power range optimized.


Date: October 25th, 2020


MattzoTrainController for Power Functions (MTC4PF):

  • Initial Release

Central network configuration file to configure SSID, WiFi passphrase and MQTT broker IP address.

Various code improvements.


Date: June 6th, 2020


First public release of the firmware for MattzoSensorController, MattzoSignalController and MattzoSwitchController.


In the following, we continuously list our plans for upcoming versions.

Please note that the roadmap may change any time without prior notice.

Future versions

Some of the planned features for upcoming releases include:

  • Web-interface to update firmware and configure the controllers
  • Speed correction for decreasing battery power
  • Support for remote controls
  • Support for station displays
  • Support for turn tables

29 thoughts on “Firmware History

  1. Hi Mattzo,

    I’ve been using your firmware with great success sofar, so first: thank you for that! My first success was with the reed sensors. I have those working now and I’m very pleased with the results sofar. I have other parts and pieces on the way for the next steps I’m planning for my layout.

    I’m very excited about the path you’re taking and the content you’re sharing on the subject. As a 20+ year software developer and a Lego train enthusiast, I can’t wait to be able to contribute to the project.

    I have seen a couple of simple improvements sofar. Because I found a lot of the same code in all controllers, the first most obvious improvement for me would be to move some general setup logic (code and variables) to separate libraries for reuse. This could significantly simplify the actual code in each controller and make the hole project more maintainable in the process.

    I’m no expert on micro controllers, but it seems you have that part covered. I’d like to try and integrate the SBrick into Rocrail as an alternate train controller. I’m planning on doing that anyway and I’d love to donate the code to the project, if you’d like. This existing project seems like a good start: https://github.com/BensonHsu/SBrick-Framework

    Please let me know if there is any way I can currently contribute to the project. I’d be more than happy to help!


  2. Hi Ray,
    substantial code unification is one of the key issues of Firmware 0.3 and leads us out of the prototype phase to a more mature approach of developing and maintaining the firmware. Regarding contribution: check your mail. 🙂


  3. Hello Mattze,

    Just downloaded V0.3 for my PU trains, and after some fiddling around, succes!
    It works perfectly, now to configure Rocrail and built some sensors and switches.
    (and the garden layout)
    Thank you for all your effort for making this, I’m a very happy man.

    Keep up the good work, can’t wait voor de levelcrossingcontoller….

    Greetings from the Netherlands,


    1. Hi Paul,
      thank you very much for your feedback! I am glad that it works on your end as well!

      We will publish some more very interesting stuff for you in the near future, so stay tuned!


    1. sorry i forgot to install this Legoino library.

      i use Amica V2 Nodemcu
      ESP8266MOD 12-F
      but now i got this:
      In file included from C:\Users\WORK\Documents\Arduino\MTC4PU\MTC4PU.ino:64:0:
      C:\Users\WORK\Documents\Arduino\libraries\MattzoBricks/MattzoController_Library.h:31:26: fatal error: PubSubClient.h: No such file or directory
      compilation terminated.
      exit status 1
      Error compiling for board NodeMCU 1.0 (ESP-12E Module).

      is there an other thing to install?

  4. Hi, ich habe gerade angefangen mit der Firmware herumzuspielen und versuche gerade die Software für die Sensoren auf meinen NodeMCU Lua Lolin V3 Modul, d.h. auf den ESP8266 12E zu spielen, nachdem ich mir nach herumsuchen im Web die Bibliothek für dieses Board heruntergeladen und installiert hatte, jedoch meckert nun Arduino IDE und behauptet “Fehler beim Kompilieren für das Board NodeMCU 1.0 (ESP-12E Module)”. Habe ich das falschle Board ausgewählt, oder die falsche Bibliothek heruntergeladen? Denn das V3 Board steht dort nicht zur Auswahl, obwohl auf diversen Seiten zu diesem Board diese eine Bibliothek angesprochen wurde.
    Würde mich über Hilfe sehr freuen!

      1. Ich habe den Fehler gefunden und PubSub ebenfalls installiert. Jetzt habe ich noch eine letzte Frage: Wo findet man die Syslog.h Datei? Denn diese ist das einzige Problem worüber Arduino IDE gerade meckert.

  5. Arduino: 1.8.13 (Windows 8.1), Board: “Arduino Uno”

    MTC4PU:31:10: fatal error: Lpf2Hub.h: No such file or directory

    #include “Lpf2Hub.h”


    compilation terminated.

    exit status 1

    Lpf2Hub.h: No such file or directory

    I’m struggling to find the problem with this.

  6. Hi I’m trying to upload the firmware for a switchcontroller to my NodeMCU V2 WiFi Amica ESP8266 ESP-12E. But when compiling i get this error:
    Meerdere bibliotheken gevonden voor “Servo.h”
    In file included from C:\Users\henk\Documents\Arduino\MattzoController_Switch\MattzoController_Switch.ino:13:0:
    Gebruikt: C:\Users\henk\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\Servo
    C:\Users\henk\Documents\Arduino\libraries\MattzoBricks/MattzoController_Library.h:44:22: fatal error: tinyxml2.h: No such file or directory
    Niet gebruikt: C:\Program Files (x86)\Arduino\libraries\Servo

    can anyone help with this one? I allready tried to install the TinyXML library without luck…

    1. Hello Henk,
      we have now set-up a support forum. You can find in the navigation bar under “My MattzoBricks”. Please post your question there, as it will be relevant for other people as well!

      I will close the commenting function on the documentation pages shortly.

      Thanks + good luck,

  7. Many Thanks Mattze! I started developing my own code for automating my LEGO trains, was a great experience, but your work has taking it to a whole different level. I started w/ the signal crossing and then moved to the switches. I was saving the train automation for last. Your code covers everything; Rocrail has been the hardest part to get going, but it’s awesome. I’ve connected MQTT into Node-Red for monitoring, and working on some control w/ it. That’s where I started with the automation, having found internetoflego.com prior to your work.

    1. Hi Dan,
      happy to hear that. Love to hear further success reports. I am also collecting pictures and videos of people having built their layout with MattzoBricks train automation. The best ones are being published on mattzobricks.com, section “projects”.


  8. Hi Mattze,
    thanks for the great work. What are your thoughts on publishing this on github or any similar service so that people can contribute more easily?

    1. Hi Sebastian,
      we are planning to do that. Haven’t decided on the right point in time, though. If you are interested to contribute, send me an e-mail.


  9. Hi Matthias,
    Great work!
    I have looked through your code, but why haven’t you added OTA updates and a simple webpage for configuring the controller (Acces point and normal wifi mode)? All “soft” items can be stored in de nvs of an ESP32, basicly making it a compile once use many times firmware.
    I have done the STA and AP mode, nvs stuff and OTA stuff, so if you need a hand?

    1. > … why haven’t you added…

      There are many things we could do, and sometimes we have to focus on the things we actually do (in our sparetime). 🙂

      By the way, OTA is indeed already integrated. Check the file MattzoController_Library.h and search for “OTA”.

      We have thought about web configuration feature since quite a time, and maybe we are going to add this at a later point.

      1. Hi Matthias

        considered hosting on github? i just implemented sta+ap and mattzo_network_configuration with configmanager.


        1. Hi Georg,
          as you can see in the discussion thread above, we are planning to release the repository to the public one day, likely with version 1.0. At the moment it would be too much work for me and the other members of the core development team. We wouldn’t be able to check all the pull requests that we’d get, and therefore it would be too frustrating for people who would like to contribute. If we believe you are qualified to contribute, it’s better to get in touch with me directly and check if there are other ways of cooperation.

          Thanks for your patience.


  10. Hallo Herr Mattzo,
    ich würde gerne fragen ob es möglich wäre nur die Weiche und Lichtsignal oh Züge in Rocrail zu steuern und zu simulieren? wenn ja wie gebe ich die Adresse der Servo und Lichtsignal ?

  11. Hallo Matthias,
    die Roadmap ab 0.6 ist ja der Hammer!
    Das wird ja noch ein Mega Projekt. 1.0 haut mich jetzt schon von den Socken!

    Vielen Dank für die SUPER Arbeit die Ihr hier macht. Danke Danke Danke
    Endlich hat mein LEGO wieder einen Sinn 😉

    LG Andy

Leave a Reply

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