Upcoming Versions
V1.2
Date: probably in winter 2024/2025
New features, improvements and changes:
MTC4BT
- Wired LAN (W5500 module). Increases stability of the MTC4BT significantly, as the RF module in the ESP32 does no longer switch between WiFi and Bluetooth. Important for complex, high-traffic scenarios.
- Integration of PU remotes. Trains can now be controlled manually using standard Powered Up remote control units.
- BuWizz2 integration. MTC4BT is now able to connect LEGO Powered Up Hubs, SBrick units or BuWizz2 units. BuWizz2 have an integrated, rechargeable battery, and four ports for standard Power Functions motors or lights. Very powerful and useable for our purposes.
- Important bug fixes.
Current Version
V1.1
Date: May 30th, 2024
Improvements and changes:
MTC4BT
- 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 train starts, stops, or changes direction.
- Controller configuration can be split into multiple files. This is required if the configuration files gets too large.
- Updated and enhanced the MTC4BT documentation.
- Several minor bug fixes and improvements.
MTC4PF
- Configurable power for status LED using PWM.
- Functions can now also be controlled via Rocrail actions.
- Changed standard value of MIN_ARDUINO_POWER from 400 to 0. This change might require to update some configuration files for your locos.
- Soft stop
MLC
- MLC mini standard configuration.
- MLC mega standard configuration enhanced with double slip switches (rocrail port 1001 to 1008).
- Configurable power for status LED using PWM.
- Support for multi-aspect signals (signals with more than 4 aspects).
- Signals are set to default state (red) when controller boots
- Blinking signal leds.
- Enhanced all light signals in MLC mega and MLC mini standard configuration now by a 3rd and 4th aspect: red, green, blinking green, blinking red. Default rocrail ports have also changed (1, 2, 3, 4 for first signal; 11, 12, 13, 14 for second signal etc.)
History
V1.0.2
Date: February 6th, 2023
Improvements and changes:
MTC4BT
- 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.
MLC
- Signal overshoot sensors.
- Updated some configuration files.
V1.0.1
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.
V1.0
Date: December 24th, 2022
First public release of the Mattzobricks git repository:
https://github.com/Mattzobricks/MattzoControllers.git
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 (introduced a work-around in V1.1: splittable configuration files).
- 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.
V0.6.1
Date: November 18th, 2022
General
- Last regular release with Arduino IDE based Controllers. Later versions will be based on VSCode + PlatformIO.
MTC4BT:
- Bugfix
V0.6
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.
MLC and MTC4PF:
- 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!
V0.5.1
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.
V0.5
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:
bool SPEEDOMETER_CONNECTED = false;
to:
bool SPEEDOMETER_CONNECTED = false;
- In most of the MTC4PF configuration files, the following line must be added:
bool STATUS_LED_REVERSE = false;
V0.4.1
Date: April 3rd, 2021
MattzoLayoutController
- 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.
V0.4
Date: March 20th, 2021
MattzoLayoutController
- 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.
MTC4PU
- Bug fix, improving stability of WiFi connection and controller operations.
Several other bug fixes and improvements.
Additional example configuration files for various MattzoControllers.
V0.3
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.
MTC4PU and MTC4PF
- 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.
V0.2.1
Date: November 19th, 2020
MattzoTrainController for Power Functions (MTC4PF):
- Bugfix.
- Power range optimized.
V0.2
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.
V0.1
Date: June 6th, 2020
First public release of the firmware for MattzoSensorController, MattzoSignalController and MattzoSwitchController.
Roadmap
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 station displays
- Support for turn tables
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!
Cheers,
Raymond
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. 🙂
Cheers,
Mattze
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,
Paul
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!
Cheers,
Mattze
hi nice project, but in the new firmware i miss a file
#include “Lpf2Hub.h”
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
#include
^
compilation terminated.
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).
is there an other thing to install?
You need to install the PubSubClient library.
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!
VG
Flec
Ich würde empfehlen, dies im Arduino-Forum oder über Google zu recherchieren.
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.
LG
Flec
Hi Flec,
You can find the Syslog library here: https://github.com/arcao/Syslog
Works perfectly!
Kind regards,
Lucas
Thanks alot
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.
You need to include the Legoino library as described in MTC4PU.ino.
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
#include
“”
can anyone help with this one? I allready tried to install the TinyXML library without luck…
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,
Mattze
okiedokie!
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.
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”.
Cheers,
Mattze
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?
Cheers,
Sebastian
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.
Cheers,
Mattze
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?
Regards,
Hilbert
> … 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.
Hi Matthias
considered hosting on github? i just implemented sta+ap and mattzo_network_configuration with configmanager.
Grüße
Georg
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.
Cheers,
Mattze
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 ?
Danke
Klar, das geht. Dafür bitte einen MattzoLayoutController bauen, Firmware aufspielen und entsprechend der Anleitung konfigurieren.
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
Hallo Andy,
ja, wir haben noch einiges vor. Freut mich, dass es Dir gefällt.
Gruß,
Mattze