Configure MQTT Forwarding

In-Sight Vision Suite allows you to configure MQTT Message Queue Telemetry Transport (MQTT) is a lightweight messaging protocol used to send and receive data between devices. forwarding for metrics in your Spreadsheet job A job is a user-configured program in In-Sight Spreadsheet consisting of functions and designed for specific applications. You can create and edit jobs using the In-Sight Spreadsheet interface, and load them on a vision system for deployment in a live environment.. To set up MQTT forwarding, perform the following procedures.

Set Up MQTT Broker and Client on Your PC

Before you can set up MQTT forwarding in In-Sight Vision Suite, you need to set up an MQTT broker A broker is a server that receives messages from publishers and forwards them to subscribers. In MQTT, the broker acts as a central hub, managing topics and message delivery between devices and systems. and client on the PC where you intend to receive MQTT messages. The following procedure provides an example setup for the broker and client applications, but any application that supports MQTT v3.1.1 or v5 is compatible.

  1. Install the latest version of mosquitto for Windows to use as an MQTT broker, only checking the Service option when prompted during the installation.

  2. Open the Windows command prompt and execute the following command to put mosquitto on your path:

    set "PATH=%PATH%;C:\Program Files\mosquitto"

  3. Create a new text file called mosquitto.conf in the mosquitto directory, and add the following two lines to the file:

    Copy
    allow_anonymous true
    listener <port-number> <your-machines-ip-address>
  4. Start the mosquitto application with the following command:

    &> mosquitto -c .\mosquitto.conf -v

  5. Install the latest version of MQTTX for Windows to use as an MQTT client.

  6. Start the MQTTX application.

  7. Connect your MQTTX application to the mosquitto broker that you set up using the network IP address and port number that you defined in the mosquitto.conf file.

  8. Create a new subscription to # to show all topics in the client window.

Set Up Certificates in In-Sight Vision Suite

If you want to establish secure communication over MQTT, you have to install the necessary certificate on your In-Sight vision system before configuring your connection. To install your certificate, use the Certificate Management utility in In-Sight Vision Suite.

You can install the following types of certificates using the Certificate Management utility:

  • TLS - allows other devices to trust your In-Sight vision system

    • Web HMI, WebSDK (HTTPS)

    • Secure File Transfer (FTPS)

    • Enterprise Connectivity (MQTT with mTLS)

  • Trusted (Certificate Authority) - allows your In-Sight vision system to trust other devices

For more information about installing certificates, see the Certificate Management section in the In-Sight Vision Suite Help document.

Configure MQTT Connection in In-Sight Vision Suite

Once you have the MQTT broker and client set up, and you have installed the necessary certificates, if any, you can configure the MQTT connection for your In-Sight vision system using the Enterprise Connectivity utility in In-Sight Vision Suite.

In the Enterprise Connectivity utility, perform the following procedure:

  1. In the Connection Settings section of the dialog, enter the following information:

  2. Open the Formatter Settings dropdown to configure MQTT formatting:

    1. If you select the Default option for the Mode setting, your In-Sightvision system uses the default script provided by Cognex. You can modify the following additional settings:

    2. If you select the Custom option in the Mode setting, you can upload your own custom script file to define the MQTT format. You can also click the Add Subscription button to add custom MQTT subscriptions.

  3. Open the Last Will and Testament (LWT) dropdown to configure any final messages in case of an unexpected disconnection:

  4. Open the Advanced Settings dropdown to fine-tune the MQTT connection for reliability, performance, and compatibility with your broker and network environment:

  5. Click Create to apply your changes.

Configure MQTT Metrics for Forwarding

Once you have your MQTT connection set up, you can add named cells in your Spreadsheet job for forwarding metrics. For more information, see Enterprise Connectivity Metrics.