Publish and consume data to a controller via MQTT message broker

ESECOTV
29 Mar 202124:05

Summary

TLDRIn this video, Jeremy Oxendine, a Software Information Specialist at Electric Supply and Equipment, demonstrates how to configure and use the IoT Gateway by Kepware for communication between a control system and an MQTT message broker. The process covers both publishing and subscribing to data from a control system to a message broker, using tools like MQTT Spy and Mosquitto. The demonstration walks viewers through setup steps, from configuring MQTT in Kepware to testing with different utilities, ultimately showcasing how to read and write data to/from a control system using MQTT protocols.

Takeaways

  • ๐Ÿ˜€ The IoT Gateway by Kepware enables easy communication between control systems and MQTT message brokers for data exchange.
  • ๐Ÿ˜€ The configuration of the MQTT client in the IoT Gateway allows devices to subscribe or publish to specific topics in the MQTT broker.
  • ๐Ÿ˜€ In the demonstration, the focus is on using a ControlLogix controller with two tags: one for reading data (test_read_mqtt) and another for writing data (test_write_mqtt).
  • ๐Ÿ˜€ MQTT Spy and Mosquitto client utilities are used to monitor and interact with the MQTT broker during the demonstration.
  • ๐Ÿ˜€ The MQTT broker used in the demo is RabbitMQ, running inside a Docker container, which communicates with Kepware's IoT Gateway to move data.
  • ๐Ÿ˜€ Kepware's IoT Gateway is configured to send data from the controller to the MQTT broker, with specific topics like 'write_mq' and 'read_mq' being defined.
  • ๐Ÿ˜€ The process involves setting up channels and tags in Kepware, then configuring the MQTT client with necessary connection parameters like IP address, port, and routing keys.
  • ๐Ÿ˜€ For writing data to the MQTT broker, a routing key is used, such as '2_write_mq', which helps define the topic structure and ensure data is sent to the correct queue.
  • ๐Ÿ˜€ To receive data from the MQTT broker and bring it back into the controller, the 'read_mq' topic and corresponding routing key '2_read_mq' are used in the IoT Gateway configuration.
  • ๐Ÿ˜€ The MQTT Spy tool is used to visualize changes in data, showing how values from the controller (like 98) are successfully written to the message queue.
  • ๐Ÿ˜€ The overall setup shows how easy it is to configure Kepware for MQTT communication, but setting up the message broker and managing security credentials (like IPs and ports) can be more complex.

Q & A

  • What is the purpose of the IoT Gateway in this demonstration?

    -The IoT Gateway allows for the reading and writing of data to a control system via an MQTT message broker, facilitating communication between the control system and external applications or services.

  • What MQTT broker is used in this demonstration?

    -The MQTT broker used in this demonstration is RabbitMQ, which is run inside a Docker container.

  • What tags are used in the ControlLogix controller for MQTT communication?

    -The tags used are 'test_read_mqtt' for reading data from MQTT and 'test_write_mqtt' for sending data to MQTT.

  • How does Kepware facilitate communication between the control system and the message broker?

    -Kepware's IoT Gateway is configured to communicate with the MQTT broker by setting up a channel to connect to the control system, reading data from defined tags and sending it to the message broker, or subscribing to topics to receive data.

  • What utility is used to monitor MQTT messages in this demonstration?

    -The MQTT Spy utility is used to monitor the MQTT messages being published or received through the message broker.

  • How is the MQTT client configured within the IoT Gateway?

    -The MQTT client within the IoT Gateway is configured by providing the broker's IP address, port (default 1883), setting the topics for reading and writing data, and entering credentials such as the username and password for the MQTT broker.

  • What role does the 'routing key' play in MQTT communication?

    -The routing key is part of the topic in MQTT communication, helping to direct messages to specific queues. In this demonstration, routing keys are used to identify whether data is being written to or read from the correct queue (e.g., '2_right_mq' for writing and '2_read_mq' for reading).

  • What happens when data changes in the ControlLogix controller?

    -When data in the ControlLogix controller changes, the IoT Gateway monitors the specified tag, then writes the new data value to the message broker's queue, which can then be retrieved by subscribing to the appropriate topic.

  • How is data from the message broker sent back to the controller?

    -Data from the message broker is sent back to the controller by subscribing to the appropriate queue in the IoT Gateway and writing the received data into the specified tag in the controller.

  • What are the common challenges when setting up a message broker and Kepware?

    -The common challenges include configuring the message broker correctly (including setting up ports, security credentials, and routing), ensuring the message broker is functioning, and dealing with network or firewall issues. However, the Kepware configuration itself is straightforward once the broker setup is completed.

Outlines

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Mindmap

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Keywords

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Highlights

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Transcripts

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now
Rate This
โ˜…
โ˜…
โ˜…
โ˜…
โ˜…

5.0 / 5 (0 votes)

Related Tags
IoT GatewayKepwareMQTTControl SystemsMessage BrokerAutomationData ManagementPLC IntegrationTech DemoConnectivityIndustrial Automation