Application-side programming via Node-RED

If you are interested in using the Node-RED tool to build your application-side program, follow these steps. We will be using IBM’s bluemix for this.

Node-RED is based on the Node.js runtime, and it is included in the Internet of Things Platform Starter boilerplate that we created earlier.

  • Navigate to the app URL, which is usually http://<app_name> In this case, it is
  • Click the Go to your Node-RED flow editor button. You may need to scroll down a little to see the button.
  • Click the menu symbol in the top-right section. With the mouse pointer over Workspaces, click Add to add a new workspace.

  • Click the menu symbol in the top-right section. With the mouse pointer over Import…, click Clipboard to import the flow.

  • Copy the content from the MyData/redsample.txt in the source code to the Nodes text field, and then click OK.

  • A confirmation indicates that the flow has been imported.

  • Double-click each flow block. You will see its configuration dialog. These parameters may seem familiar as they are similar to those used in building the application-side program in Java.

  • Click the Deploy button in the top-right section to deploy the application-side program.

  • You may run the device-side program again, and you will get similar results. On the right pane of the editor, you can view the messages from the device side as well.

It is more user friendly to build your application-side program using the Node-RED GUI editor. Node-RED provides many built-in flow blocks so that you can wire them together easily and deploy them immediately. For more information about using Node-RED on IoT, see the Bluemix documentation.

Note: You do not need to register the application in the IoT service console manually, as it will be registered automatically when using the Node-RED editor. Choose the Bluemix Service for Authentication option when prompted.

Credits: IBM Developers