The following diagram shows the overall architecture of the MattzoBricks Train Automation System:

MattzoBricks Train Automation System: Architecture
MattzoBricks Train Automation System: Architecture

The following sections describe the components of the overall architecture.

Rocrail

Open Source Software for controlling model trains. Used as the backbone of train automation in our platform.

Here is a short list of things that Rocrail does:

  • Create and manage the logical plan of your LEGO train layout,
  • allocate blocks for your trains,
  • calculate and set routes, switches and signals,
  • open and close boom barriers,
  • execute time tables and schedules,
  • start and stop your trains,
  • react to sensor events,
  • many other helpful things…

MQTT Broker

Message Broker that transports commands from Rocrail to the trains, switches, signals and boom barriers, and feeds back information from sensors to Rocrail.

The MQTT Broker acts as the central communication pipeline between all components.

The most common MQTT broker for personal computers is a free software called “mosquitto”, which we also use for our own layouts. Any other MQTT should also do. The broker may run on the same computer as Rocrail, which makes deployment quite easy.

Additional hardware besides a Personal Computer is not required.

MattzoControllers

MLC Prototype
MattzoController

A MattzoController consists of a microcontroller and usually some other additional electronical components. Depending on their specific type, they serve different purposes, e.g. controlling train motors and lights, flipping switches, settings signals or transmitting sensor events back to the MQTT broker.

Trains

A train is an object that moves with one or more motors on your layout. From a logical perspective, it doesn’t really matter if your train has cars or not. Of interest is only if the train may change direction.

Train are controlled by MattzoTrainControllers. The specific type of train controller depends on the LEGO power and control system that you are using.

More info: here.

Switches

You certaily know what a switch is. The difference to a LEGO standard switch is, that the switches we use in automated train layouts are motorised, usually by small servo motors.

Switches are controlled by MattzoLayoutControllers.

More info: here.

Signals

Sempahore main and distant signal
Sempahore main and distant signal

Signals are an assembly of 2, 3 or 4 LEDS. Something they also have servos.

Signals are controlled by MattzoLayoutControllers.

More info: here.

Sensors

Sensors detect train positions. They are connected to MattzoLayoutControllers, which report the sensor information back to the automation computer (Rocrail).

Check out everything about sensors here.

Level Crossings

Level Crossings consist of Boom Barriers and flashing lights. They are controlled with MattzoLayoutControllers. The MattzoLayoutController is very flexible and intelligent and supports various deployment modes. It handles crossings for single track or multi track train lines.

More info: here.

Bascule Bridges

Bascule bridges are movable crossover components for LEGO trains that usually span over rivers. Together with turntables, they count among the most advanced components on LEGO train layouts.

All info about bascule bridges can be found here.

Remote Controls

The Powered Up Remote Control is a well known and widely spread remote control. It is familiar to anybody who has ever bought a LEGO train set driven by Powered Up.

You can use the Remote Control, if you want to take direct control over a train or another layout component, and release Rocrail of its duties for a while. Nevertheless, we make use of the remote control in a slightly different way that you will be used to…

Read more.