Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

How is MQTT configured in the xPort Edge and xPico 200 modules?

MQTT (Message Queuing Telemetry Transport) is a popular protocol for connecting IoT (Internet of Things) devices and applications . In this article, we will explore how to test using the publish/subscribe model.  This article, explains how to configure MQTT in xPort Edge and xPico 200 families of products and also outlines a simple way to test the feature using the Mosquitto Broker.

xPort Edge MQTT Configuration Diagram

...

To test MQTT functionality in xPort Edge, you would typically need the following:

MQTT Broker: This is the server that receives all messages from the clients and then routes them to the appropriate destination clients. In our case, we are using the Mosquitto Broker.

...

By having these components in place, we can effectively test the functionality of MQTT in xPort Edge, ensuring that it can successfully publish and subscribe to messages via the MQTT broker.

Installation of MQTT Broker


The first step is to install the MQTT broker on a PC running Windows. The MQTT broker typically listens on its default port, which is 1883. After installing the Mosquitto Broker, open the Mosquitto.conf file and locate the "listener" configuration. Here, assign the listener port to 1883. Additionally, set the "allow_anonymous" connection to true. Save and exit the configuration file. For example, in a Windows environment where Mosquitto was installed using the Windows installer, the Mosquitto.conf file is typically located in the installation directory, such as C:\Program Files\mosquitto\mosquitto.conf

image-20240403-095928.png

image-20240403-095229.png

Configuration in xPort Edge


In the Web Manager for xPort Edge / xPico device, after selecting select MQTT. as the protocol in Line 1 configuration, go to the MQTT section in the menu and assign the IP address of the PC where MQTT is installed. Specify the topic name for publishing and ensure that the same topic name is used for subscription. In addition to that, enter the Device ID, which must be unique to the device connected to the server.

image-20240403-110054.png

Testing MQTT Functionality

To test the functionality of MQTT in xPort Edge, we can use the MQTT Explorer. In the MQTT Explorer, enter the name of the host machine where the MQTT broker is running and listening on port number 1883. Then, click "CONNECT."

...