Connect the Raspberry Pi Node-RED flows to IBM Bluemix

Import a new Node-RED flow into the flow editor on the Raspberry Pi device:

    1. Go to GitHub: https://raw.githubusercontent.com/ibm-messaging/iot-device-samples/master/node-red/device-sample/quickstart.json.
    2. Copy the raw JSON from GitHub to your clipboard.
    3. In the flow editor, create a new flow tab.
    4. Import the new flow by clicking the Menu icon > Import > Clipboard.
    5. Double-click the red exec node (getCPUtemp) that retrieves the CPU temperature from the Raspberry Pi device. Add the following information and then click OK:
        • Commandvcgencmd
        • Appendmeasure_temp
        • NameGetCPUtemp

Connect the Node-RED flow on the Raspberry Pi with the Node-RED flow that you already have on Bluemix.
The communication between the Node-RED instance running on the Raspberry Pi and the one running on Bluemix is provided by IBM Watson IoT Platform/Quickstart, which is based on MQTT, a lightweight messaging protocol.

  1. Double-click the blue Watson IoT Output node (wiotp out) in the flow on the Raspberry Pi device. Select Quickstart and enter a unique value for the Quickstart Id. This value can be any string, but it must be unique in the entire system. Then, click OK.
  2. Double-click the blue IBM IoT App In node and enter the same Device Id that you used for the one on the Raspberry Pi. This is how the two Node-RED environments will communicate. Then, click Done.
  3. When the flow is set up as instructed in the previous steps, click Deploy. Then, click the timestamp node on the Raspberry Pi to start the flow that will send CPU data to the Node-RED instance on Bluemix every 5 seconds.
  4. Review the output in the debug panes.
    The two outputs are dissimilar because the Node-RED flow on the Raspberry Pi does not have the trigger warning that you used for the Node-RED flow in Bluemix.
    If you disconnect the connections to the green debug node on the Raspberry Pi, you won’t see any output in the first debug pane, which is highlighted in red, but you will see output in the debug pane highlighted in blue in the following image: