Skill Level: Any Skill Level

In this recipe, we will show you how to connect a specialized IoT gateway to the IBM cloud using MQTT.



  1. IBM Cloud and Watson IoT platform

    The environment of IBM Cloud may look different because of possible changes. This guide shows the status of August 2019.

    IBM provides developers some free services for a limited time and you don’t have to enter any credit card details on the beginning. Create your IBM Cloud account and log into it on console.bluemix.net.

    To connect remotely to your IQRF network from the IBM cloud, you need to set up some services first.

  2. Internet of Things Platform Starter

    Click the Catalog button and find the Internet of Things Platform Starter.



    Fill in this form to set up your cloud application. Type in a unique App name, select your deployment location and your pricing plan and click Create button. Your web application will be available at the given address.



  3. Watson IoT Platform

    Click the Dashboard in the left IBM Cloud navigation menu.


    Click the Cloud Foundry Services item and then click the service which was created when you set up your cloud application in the previous step (it ends with iotf-service).



    Launch the IBM Watson IoT Platform.



  4. Security

    Click the Security item in the left menu and check the connection security.


    Set up the Security level according to your needs and possibilities. We have chosen the TLS Optional. Save the configuration.



  5. Create the Device Type

    Click the Devices item in the left menu.


    First, add the Device Type.


    It’s important to select the type: “Device”. Then, fill in the name of a device type.


  6. Create the Device

    Click the Browse menu. Create a new virtual device by clicking on Add Device.


    Select the Device Type which you have created in the previous step, enter the Device ID and click Next.


    Fill in your Authentication Token and click Next.


    Copy the device credentials. You will use them in the next step.


  7. Set up the MQTT interface at the IQRF Gateway

    Configure the MQTT channel to the IBM Cloud. In the web browser on your computer, insert the IP address of your UP board, and log in to it as admin with password iqrf (or with the account you have created).

    In the IQRF Gateway web application, click on the IBM Cloud item in the Clouds menu.

    Fill in the credentials related to your virtual device from the IBM Cloud, save the configuration and restart the IQRF Gateway Daemon service (click Save and restart).


  8. Node-RED

    Find your Cloud Foundry Application in the dashboard and check its status. It should be running. Then click it.


    Next, click the link Visit App URL.


    Go through the wizard and set up the Node-RED application. Go to your Node-RED flow editor and log in to it.


  9. Node-RED flow

    Create a new flow and delete the example. You will do it by double-clicking the Flow 1 tab. Then press Delete.


    Insert ibmiot input, ibmiot output, two debug outputs and inject input. Connect the objects like it is shown in the picture.


    Using the inject input, we will send DPA commands to the MQTT broker running at the IBM Cloud and our IQRF Gateway will get commands from there. We will also send the commands to the debug window to see the output. All incoming messages from the MQTT broker will be displayed in the debug window.

  10. Modify the inject input

    Double-click the inject input, change the payload type to JSON and insert the DPA command in JSON format here.


    Here is the command which turns ON the red LED on the IQRF coordinator. Click on Done.

    {“ctype”: “dpa”,”type”: “raw”,”msgid”: “1510754980”,”request”: “”,”request_ts”: “”,”confirmation”: “”,”confirmation_ts”: “”,”response”: “”,”response_ts”: “”}


    More examples:

    • Collecting all sensory data from Node #1 using the connected DDC-SE kit: 01.00.5E.01.FF.FF.FF.FF.FF.FF.
    • Turning ON both relays of DDC-RE kit connected to Node #2: 02.00.4B.00.FF.FF.
    • Acquiring temperature from Node #3: 03.00.0A.00.FF.FF.
    • For more information about macros and the IQRF network read the IoT Starter Kit – Part 1: Build your IQRF network.
  11. Modify the ibmiot output

    Click the ibmiot output. Change the authentication to Bluemix service, set the output type to Device Command, and fill in the information of the virtual device you have created earlier. Enter “iqrf” as the command type. Enter “msg.payload” as the Data and click Done.



  12. Modify the ibmiot input

    Click the ibmiot input and select Bluemix Service as the authentication type. Save the configuration.


  13. Test the connection

    Click the Deploy button.


    Show the Debug tab.


    Click the left corner of the Inject button. You send the prepared command to the MQTT broker and to the debug output as well.


    In the Debug tab, you can see the ongoing communication between IBM Cloud and the IQRF Gateway. You can easily double-check that the command has been executed.



    In the same way, you can turn the red LED off as well as send any other DPA command to your network.


    The bidirectional communication between IQRF network and the IBM Cloud is up and running. Now it’s just up to you to use it for your own IoT solution.

1 comment on"How to connect an IQRF Gateway to the IBM Cloud"

  1. Hey,

    I have a PROTRONIX sensor with IQRF gateway which I already contacted to IoT Watson platform, please could you tell me how to start send data from the sensor (temperature and humidity) to the platform?! I don’t know how to set the right flow

Join The Discussion