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 controller controls a motor that opens and closes the bridge. The states “fully open” and “close” are reported back to the controller by reed sensors. If the bridge reaches its end positions “fully open” or “close”, the motor is stopped.
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 is fully 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.
The MattzoBridgeController is fully controlled by Rocrail commands. If not fully closed, the train or trains can not pass the bridge and will stop ahead of it. The state of the bridge is controlled by the sensors, which are also reported to Rocrail. Rocrail will also clear trains over the bridge when the bridge is closed, and only open the bridge if no train is on the bridge or approaching. The bridge can opened and closed via the Rocrail user interface. Additionally, Rocrail can also control time scheduled opening and closing operations of the bridge if desired.
Both single and double track bascule bridges are supported.
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 setup requires some complicated work-arounds. On the picture, the boom barriers simulate the bridge.
The MattzoBridgeController uses the MattzoLayoutController Firmware. 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.
Status and next steps
The MattzoBridgeController is almost ready. We are in final stages of the development. The public release is planned for Firmware version 0.4.