Please read the general section first!
The MattzoLayoutController (MLC) can be used to act as a speed measuring device for LEGO trains.
This deployment of the MLC features a small OLED display and two sensors. The example on the picture above comes in a nice little 3d printed box with LEGO compatible studs (designed by Tomáš Jukin).
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 controller will also calculated the length between the two magnets and optionally also show it on the display.
The controller 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 are planning to create a video with the nice little speedy trains about the speedometer option in the MattzoLayoutController.
Make sure you subscribe to our social media channels!
Thanks for your patience.
The following wiring diagram shows how to build a MattzoLayoutController configured as speedometer.
- 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.
- A bread board. The one fitting into the case shown above is this one.
- The usual standard stuff like wires etc.
Please read the MLC general page first.
To configure the firmware configuration, you need to edit the controller configuration file (controller_config.h).
In this file, the following sections are relevant:
- SENSOR WIRING CONFIGURATION, and the
- SPEEDOMETER CONFIGURATION.
The sections are clearly marked in the standard configuration file, and the different parameters are explained with code comments, so you shouldn’t have too many problems to understand what you need to do.
For a start, you should have a look at the example configuration file “MLC_conf_Speedometer.h”.
No configuration in Rocrail is required.
If you want to make use the reed sensors of the speedometer in Rocrail for other purposes, configure the sensors in Rocrail as remote sensors as described on the sensors page.
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 refined and merged into the MattzoLayoutController firmware by Mattze and is now part of the common code base for our land based MattzoControllers.