Send Data to SmartWorks IoT

Data must be sent via HTTP or MQTT to SmartWorks IoT. For this project we are using MQTT connection.

MQTT Is the standard for IoT messaging. It allows for messaging between device to cloud and cloud to device. More information on MQTT can be found here:

Client connections are always handled by a MQTT broker, which is responsible for receiving and filtering the messages, determining who is subscribed to each message and sending them. To configure the MQTT broker connection, the Host, Username and Password are the required parameters.

Follow the steps below to connect your device via MQTT.

  1. If you haven't already, download the SWX Arduino Training folder.
  2. Substitute src folder for the one available here.
  3. Open credentials.h in VSCode and complete the information required.
  4. Get your User and Password by turning ON the autogenerate feature for the platform to autogenerate the username and password and click Save.

    Figure 1.
  5. Complete the information in files topics_subscribed.h and topics_publish.h as instructed.
  6. Upload the code.
  7. Checke that the data was received in the Raw history tab as seen in the below screenshot.

    Figure 2.

    Figure 3.