Preparing and realizing the data transfer via MQTT

The following steps are not required to follow the tutorial "Putting Raspberry Pi into operation". However, you will need the following information when you want to transfer unencrypted data between Raspberry Pis via →MQTT. This possibility is provided by logi.RTS starting with version 2.3.1301.

Connecting to Raspberry Pi by using PuTTY

Use PuTTY for the following configuration/installation steps.

  1. Start PuTTY.

  2. In dialog PuTTY Configuration, enter the detected IP-address under Host Name, select SSH under Connection type, then click Open.
    images/download/attachments/405733828/puttyConnect-version-1-modificationdate-1529913583767-api-v2.png

PuTTY displays a terminal window in which you have to enter certain commands – one after each other. Conclude each command by pressing the Enter-key so that the corresponding action is executed.

Configuring logi.RTS on the Raspberry Pi

How to configure logi.RTS assuming that logi.RTS has been installed into this directory: /opt/RTS/PLC

  1. Terminate logi.RTS on the Raspberry Pi.

  2. Within the terminal window of PuTTY: Change into the directory /opt/RTS/PLC of the Raspberry Pi.

    cd /opt/RTS/PLC/

  3. Open the file RTSIO.cfg in a text editor, change this file and save the changes.

    nano RTSIO.cfg
    Original line
    #LoadLibrary RTSS_MQTT
    Changed line
    LoadLibrary RTSS_MQTT

    In detail:

    1. Delete the prefix character # in this line.

    2. Save the changes and exit the editor: Press Ctrl+O (and confirm the file name), then press Ctrl+X.

  4. Start the Raspberry Pi anew. logi.RTS will run after the reboot, if you have added logi.RTS to the system start (see under "Installing and starting logi.RTS on Raspberry Pi").

Installing/configuring MQTT broker

Transferring data via MQTT requires a MQTT broker. You may install this MQTT broker on any computer or on the Raspberry Pi. Take care that logi.CAD 3 and the Raspberry Pis are able to access the MQTT broker.
See the user documentation of your MQTT broker, if you need information on installation and/or configuration of this MQTT broker.

Example for a MQTT broker that logi.cals is using: the open source software Mosquitto (http://mosquitto.org/). On Debian-based Linux systems, such as Raspbian, the installation of the Mosquitto broker can be performed by entering the following commands as the root user:

apt-get update
apt-get install mosquitto 

Controlling the connection for TCP port

The MQTT broker is communicating via the default TCP port 1883. Allow this connection in the Windows Firewall because it is required by logi.CAD 3 (see troubleshooting article "The Windows Firewall has blocked features of this program" for information on this).

Enhancing the application by MQTT blocks

  1. Use the appropriate MQTT blocks in your logi.CAD 3 application.

  2. Load the application onto the Raspberry Pi – this is analogous to the description under "Loading application onto Raspberry Pi".

Analyzing applications that use MQTT blocks

In order to analyze MQTT applications, there are several tools. logi.cals uses "MQTT RCP Application" of the "Graphical MQTT Client Tools" of the Paho framework (https://eclipse.org/paho/clients/tool/). By using the program you can determine whether messages have been published to a certain topic on a given MQTT broker. Furthermore, it is possible to subscribe to arbitrary topics.