GUI-O Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Episode 10: Migrating to HiveMQ broker

    Scheduled Pinned Locked Moved
    GUI-O Application Tutorial Series
    1
    1
    217
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      kl3m3n
      last edited by kl3m3n

      NOTE: The following tutorial applies to IoT (MQTT) connection mode only.

      By default, GUI-O application uses a MQTT test broker that is running on our own server. The broker listens on ports 1883 (unencrypted), 8883 (encrypted with client certificates) and 8884 (encrypted). This is perfect for testing and some smaller use cases, but some IoT scenarios require using a broker platform that gives you finer control over additional settings (e.g., managing credentials for different clients).

      There are numerous platforms that offer managed cloud MQTT broker, such as HiveMQ, EMQX, CloudMQTT, etc. This episode focuses on migrating from GUI-O broker to HiveMQ broker using ESP32 board.

      Software prerequisites:

      • Arduino IDE (https://www.arduino.cc/en/software)

      • ESP32 Arduino board support (see https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html)

      • Arduino Client for MQTT(https://github.com/knolleary/pubsubclient)
        You can follow the setup instructions or directly download and include the PubSubClient.zip library within the Arduino IDE (Sketch -> Include Library -> Add .ZIP library)

      • GUI-O application (https://play.google.com/store/apps/details?id=com.guio.guioapp)

      Components needed:

      • ESP32-WROOM-32 (or any other Arduino supported WiFi capable board; see https://github.com/knolleary/pubsubclient#compatible-hardware for compatible hardware)

      The entire tutorial is split into various steps. All necessary information is given in each step.

      1. SETUP HIVEMQ

      1. Navigate to https://www.hivemq.com/downloads/ and signup to (free) HiveMQ cloud plan

      2. Login to HiveMQ cloud console and navigate to "Clusters"

      3. Create a new cluster selecting any cloud service provider

      4. Select "MANAGE CLUSTER" (NOTE: The "Cluster URL" is required later)

      5. Select "ACCESS MANAGEMENT" tab and add new credentials (at least one)

      All steps are shown in the video below.

      2. SETUP GUI-O FOR HIVEMQ

      1. Open GUI-O application, open settings and navigate to "Connections -> IoT -> IoT Settings"

      2. Set the "Server name" using the HiveMQ "Cluster URL" (see 1. SETUP HIVEMQ).

      3. Set the "SSL port number" to 8883

      4. Set the "User name" and "User password" based on the HiveMQ credentials (see 1. SETUP HIVEMQ)

      5. Navigate to "Connections -> IoT" and press "Connect" to test the connection

      All steps are shown in the video below.

      3. SETUP ESP32 FOR HIVEMQ

      1. Download BasicMQTT_HiveMQ.ino sketch and open it in Arduino IDE

      2. Get the certificate of your HiveMQ broker (see video below)

        • On Linux, open the terminal and enter command:

        openssl s_client -connect <hivemq_url>:8883 -showcerts

        replacing the <hivemq_url> with the "Cluster URL" (see 1. SETUP HIVEMQ)

        • You can alternatively use an online Linux terminal (e.g., https://www.tutorialspoint.com/linux_terminal_online.php) to execute the same command

        • After running the command, copy the last certificate displayed in the terminal and replace the one in the downloaded Arduino sketch (keep same certificate formatting)

      3. Use the downloaded Arduino sketch (i.e., BasicMQTT_HiveMQ.ino) while referring to the video below. Make sure that the server url, user name and password are set according to HIVEMQ setup (see 1. SETUP HIVEMQ)


      If you have any questions or run into any problems, please let me know!

      Best regards,
      kl3m3n

      1 Reply Last reply Reply Quote 0
      • First post
        Last post