Build a Private MQTT Broker
Certain Weintek HMI models have built-in support for MQTT server & client, and support direct connection with cloud services such as Amazon Aws IoT, Microsoft Azure and IBM Cloud…etc. HMI processes data from PLC and publishes messages to an MQTT broker, which will handle message delivery to the subscribers. For certain types of data that require extra care in its protection, users may wish to use a private MQTT broker.
Here are some choices for building a private MQTT broker:
- Use MQTT broker inside the HMI when a less number of connections is required.
- Use an external broker such as HiveMQ, Mosquitto, or EMQX when a larger number of connections is required.
Use MQTT broker inside the HMI:
Set MQTT Server IP to 127.0.0.1 to use this HMI as a broker. In the projects of other HMIs, the MQTT Server IP should also be set to the same IP address as the HMI used as the broker.
Use an external broker:
Settings may vary between brokers. The following takes EMQX as an example:
In Windows, download EMQX’s file from its official website, and then launch EMQX broker using cmd.exe.
EMQX broker can then run on PC. Use a browser to browse for the information such as the clients, topics, which are handled by EMQX broker.
HMI’s publisher or subscriber will use the PC’s IP as MQTT Server IP. Messages can then be sent or received using EMQX broker.