How to Send Messages from Schneider Workstation to MQTT Explorer Using MQTT Protocol

 MAGENDRAN P MAGENDRAN P
4 min read

The MQTT (Message Queuing Telemetry Transport) protocol is a lightweight messaging protocol designed for small sensors and mobile devices. It provides efficient and reliable communication, making it ideal for IoT applications. In this guide, we'll explore how to configure Schneider Workstation to send messages to MQTT Explorer using the MQTT protocol.

Prerequisites

Before we begin, ensure you have the following software installed on your system:

  • Schneider Workstation (version 2 or later)

  • Mosquitto MQTT Broker

  • MQTT Explorer

Step 1: Set Up Mosquitto MQTT Broker

First, we need to set up an MQTT broker. We'll use Mosquitto, a popular open-source MQTT broker.

Installation

  1. Download and Install Mosquitto:

    • Go to the Mosquitto official website and download the installer for your operating system.

    • Run the installer and follow the installation instructions.

  2. Start the Mosquitto Service:

    • Open the command prompt and start the Mosquitto service using the command:

        shCopy codenet start mosquitto
      
  3. Verify Mosquitto is Running:

    • Use the following command to check if Mosquitto is running:

        shCopy codenetstat -an | find "1883"
      
    • You should see output indicating that Mosquitto is listening on port 1883.

Configuration

The default configuration of Mosquitto should work for basic communication. However, if you require TLS/SSL encryption or other advanced features, edit the mosquitto.conf file located in the installation directory.

Step 2: Configure Schneider Workstation

Next, we'll configure Schneider Workstation to connect to the MQTT broker and send messages.

Access MQTT Settings

  1. Open Schneider Workstation.

  2. Navigate to the MQTT Client Configuration:

    • Go to the Settings or Communication section, depending on your version.

    • Find the MQTT Client configuration settings.

Configuration Settings

Enter the following information into the MQTT Client configuration:

  • Client ID: A unique identifier for your client (e.g., Schneider_Client_01).

  • Broker Address: 127.0.0.1 (localhost) if the broker is on the same machine or the broker's IP address if it's on a different machine.

  • Port: 1883 for non-TLS or 8883 for TLS (SSL) connections.

  • Protocol: Select MQTT.

  • Username/Password: Enter credentials if required by your broker. Leave blank if not needed.

  • Keep Alive: 60 seconds (or according to your network's configuration).

  • Topic: The topic you wish to publish to (e.g., test/topic).

Enable the MQTT Client

Ensure the MQTT Client is enabled in Schneider Workstation by setting the Enabled option to Yes.

Step 3: Use MQTT Explorer to Receive Messages

MQTT Explorer is a powerful tool for monitoring and managing MQTT messages. Let's configure it to receive messages from the Schneider Workstation.

Download and Install MQTT Explorer

  1. Download MQTT Explorer:

  2. Install MQTT Explorer:

    • Run the installer and follow the installation instructions.

Connect to the MQTT Broker

  1. Open MQTT Explorer.

  2. Set Up a New Connection:

    • Click on File > New Connection.

    • Enter the following details:

      • Name: Local Broker Connection (or any name you prefer).

      • Broker Address: 127.0.0.1 (or your broker's IP address).

      • Port: 1883 for non-TLS connections.

      • Username/Password: Enter credentials if your broker requires them.

      • Client ID: MQTT_Explorer_Client.

  3. Connect to the Broker:

    • Click Connect to establish a connection with the broker.

    • You should see a successful connection message if everything is configured correctly.

Subscribe to a Topic

  1. Subscribe to a Topic:

    • Enter the topic you want to subscribe to (e.g., test/topic) in the Subscription field.

    • Click Subscribe to start listening for messages on this topic.

Step 4: Testing the Connection

Let's verify that Schneider Workstation can send messages to MQTT Explorer:

  1. Publish a Message from Schneider Workstation:

    • Use Schneider Workstation's MQTT client to publish a message to the configured topic (e.g., test/topic).
  2. Check MQTT Explorer for Messages:

    • In MQTT Explorer, you should see the message appear under the subscribed topic.

    • Verify that the message contents are correct and that there are no errors.

Troubleshooting Common Issues

If you encounter issues, consider the following troubleshooting steps:

1. Verify Network Connectivity

  • Ensure the broker's IP address and port are correct.

  • Use the ping command to verify the broker's reachability.

shCopy codeping broker_ip_address

2. Check Broker Status

  • Confirm that the MQTT broker is running and listening on the correct ports:
shCopy codenetstat -an | find "1883"

3. Review MQTT Broker Logs

  • Check the MQTT broker logs for any connection errors or warnings.

4. Firewall and Security Software

  • Ensure that no firewalls or security software block the broker's ports.

5. Verify MQTT Client Configuration

  • Double-check Schneider Workstation's MQTT client settings for any typos or misconfigurations.

Conclusion

By following these steps, you should be able to successfully configure Schneider Workstation to send messages to MQTT Explorer using the MQTT protocol. Whether you're using this setup for testing, development, or IoT applications, MQTT provides a reliable and efficient means of communication. If issues persist, consult the documentation for Schneider Workstation and MQTT Explorer or reach out to support forums for further assistance.

1
Subscribe to my newsletter

Read articles from MAGENDRAN P directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

 MAGENDRAN P
MAGENDRAN P