DCC to MQTT

Select DCC to MQTT as your communication module if you would like to use the DCC interface breakout board and forward received DCC commands to an MQTT broker.

Note: While feeding DCC commands to MQTT, all DCC command interpretation of the IoTT Stick, e.g. for a BlueHat LED chain, remains active.

Setup Instructions:

Open the Node Configuration page and select DCC to MQTT as communication module. Click Save and Restart.

After rebooting, the web page will display an additional tab labeled MQTT Configuration. Click the tab to open the MQTT configuration page.

Set the server settings (IP address, port number, user name and password) according to your MQTT broker of choice.

Note: By default, settings for a public MQTT broker (either test.mosquitto.org or broker.hivemq.com) are preinstalled. This is a good setting for just an initial test. If you plan on using an MQTT broker on a regular basis, it is recommended to set up a local broker within your Wifi network. A good solution with plenty of support on YouTube is a Raspberry Pi using Mosquitto.

Set a node name to your liking. This should be a unique name, so no other IoTT Stick should use the same name. If you click the Add MAC Address option, this is automatically ensured as the used name includes the unique MAC address of the Stick.

Enter a broadcast topic of your choice in the DCC Broadcast Topic field. MQTT messages will be published by the IoTT Stick using this topic.

Click Save and Restart to make your settings permanent.

You now can open an MQTT viewer on your PC or smart phone and subscribe to the DCC broadcast topic you entered in the configuration page. Once the viewer is connected to the browser, you should start seeing the decoded DCC commands appear as soon as you change a locomotive speed or a switch position.

Note: In DCC, there are commands that are sent as needed, e.g. commands for switches and signals. And then there are commands that are constantly sent out, i.e. locomotive speed and function commands. The IoTT Stick sends one time commands immediately to MQTT. Refreshed commands are sent as soon as a change is detected. So, when you set a locomotive to a new speed, you will get one MQTT message with the new speed. 

MQTT examples:

All MQTT payloads consist of a JSON string with the relevant attributes. The first attribute is always a type attribute, the other attributes depend on the type.

Switch command example: {"type":"switch", "addr": 13, "dir": "closed", "power":"on"}

Signal command example: {"type":"signal", "addr": 800, "aspect": 10}

Loco speed example:  {"type":"loco_speed", "addr": 7616, "addr_type": "long", "speed": 1, "speedsteps": 127, "dir": "forward"}

Loco function example: {"type":"loco_function", "addr": 7616, "addr_type": "long", "func_group": 1, "func_value": 00}

 

 

Please publish modules in offcanvas position.

Free Joomla! templates by Engine Templates