Please read the general section first!
The MattzoBridgeController is used to control bascule bridges or similar components.
The underlying idea is to automate a bascule bridge over which train lines are running. These bridges must frequently open due to ships crossing the river or bay under the bridge.
The MattzoBridgeController is fully controlled by Rocrail commands via MQTT.
The controller controls a motor that opens and closes the bridge. The states “open” and “close” are determinated by reed sensors. The sensor events are reported back to Rocrail. After the sensors are triggered, there is usually some extra time to fully close or open the bridge. After the extra time has expired, the bridge has reached its final position, the motor is stopped and a virtual sensor even is send back to Rocrail to announce the “fully open” and “fuly closed” state.
When the bridge is fully open, a green signal indicates that boats can pass the river beneath the bridge. If the bridge is moving or closed, the signal is red. A flashing yellow LED indicates that the bridge is moving. When the bridge is opening, a small white LED next to the red signal indicates the upcoming opening of the bridge and that captains shall start their engines.
If not fully closed, the train or trains can not pass the bridge and will stop ahead of it. The closed state of the bridge is secured by the closing sensor. If this sensor is released while the bridge is in the closed state, an emergency brake is broadcast to all trains.
Rocrail will only clear trains over the bridge when the bridge is fully closed. The bridge can be opened only if no train is on the bridge or approaching the bridge. The bridge can opened and closed via the Rocrail user interface. Additionally, Rocrail can also trigger automatic, time scheduled opening and closing operations of the bridge if desired.
Both single and double track bascule bridges are supported.
Before continue to read, you should have a look at the following video. There is also a German version.
The following diagrams shows the standard configuration for the wiring of the MattzoBridgeController.
- I/O board with micro controller. We have used a NodeMCU Amica Modul V2 ESP8266 ESP-12F. Similar modules should work as well.
- Motor shield L9110
- 2 channel motor shield.
- Max. 12V.
- ~800mA maximum continuous current.
- 2A max. peak current (this is about the blocking current of a LEGO train motor).
- LEGO power functions cable, cut in two halfs.
- Power supply, around 9V. Depending on your bridge and motor, your motor may work else with less volts. We have done successful tests even with 5V only (Simple USB charger).
- LEDs in different colors.
- Two reed switches, e.g. the ones recommended for the MattzoSensorController.
- Basic stuff like bread board, resistors, wires etc.
The status LED indicates to WiFi connection status, the MQTT connection status and lights up when one or more sensors are triggered. The status LED is very handy in practice. Therefore, this wiring option is recommended.
The configuration of a bascule bridge in Rocrail is a pretty complicated task. There is almost no documentation about this in the Rocrail help, and only very sparse and cryptic information in the forum and elsewhere. So do yourself a favour and follow the instructions below instead of wasting of hours of figuring this out by yourself (as I had to do).
As a general hint, please note the bridge object is handled like an “accessory”, which in turn is basically handled like a “switch” in Rocrail.
Add the Bascule Bridge
Add a single or double track bascule bridge to your Rocrail plan and call it “bridge”.
Add the Sensors
Add two sensors to your plan and call them “fb-bridge-open” and “fb-bridge-closed”. Do not connect those sensors to your track layout.
Create two text labels and position them next to the sensors.
Create the required routes that lead over the bridge. Whenever possible, use the auto router for perform this job, as it relieves you from a lot of tedious work.
The result of the auto router is pretty good for single track bascule bridges, but it’s not perfect for double track bascule bridges.
For double track bascule bridges, we need to do some changes to these routes generated by the auto router:
- Open the route configuration dialog, select one of the routes that lead over the bridge and navigate to the tab “Commands”. Identify the “switch command” to close the bridge. Change the “Lock” setting of this command from “Lock” to “Open”.
- Repeat this procedure for the other routes that lead over the bridge.
WARNING: make sure you complete the “Routes lock” configuration for the bridge further below. If you miss that part, the resulting configuration is unsafe and the bridge could be lifted while a route is set over the bridge, which may cause a crash desaster on your layout.
Configure the Bridge
Open the configuration dialog for the bridge.
- Check “Manual operated”.
- Set the address of the controller. Set port to “1”. This is the logic port in the MattzoBridgeController for opening and closing the bridge.
- Set “sensor turnout” to “fb-bridge-open”.
- Set “sensor straight” to “fb-bridge-closed”.
- Check “Activate”
- Check “Auto mode”
- Set “interval” to 30 seconds. This is the time that the bridge will remain closed after it was fully closed until it is opened again.
- Set “delay” to 10 seconds. This is the time that the bridge will remain open after it was fully opened until it is closed again.
The proposed values for “interval” and “delay” are good for a start. You can change them later to fit your specific needs or preferences according to the Rocrail documentation.
If you configure a double track bascule bridge, and have conducted the changes to the routes as described above, you must complete another absolutely crucial task in the “Control” tab:
- Routes to lock: you IMPERATIVELY must select all routes that lead over the bridge to make sure that the bridge is closed and remains closed when a train approaches or is on the bridge.
WARNING: if you create new routes that lead over the bridge later, you must review these settings and add those router to the “routes to lock” selection above. If you forget to do this, the bridge is unsafe and might be opened during a train is on the brige.
It is also possible to simulate the bascule bridge in 3D Model Train Studio, though the full setup including the feedback sensors requires some work-arounds.
The MattzoBridgeController uses the MattzoLayoutController Firmware from version 0.4 or above. Please read the documentation for the MattzoLayoutController first how to basically setup, configure, compile and upload the firmware.
The bascule bridge specific parameters in the configuration file start in section “// BASCULE BRIDGE CONFIGURATION”. The meaning of the parameter is explained in the configuration file and should be self-explanatory.