Create an Internet of Things Platform Starter application
Learn how to create a Node-RED and Watson IoT Platform Starter application to connect IoT devices to the Watson IoT Platform
In this tutorial, learn how to create a Node-RED and Watson IoT Platform starter application that can be used to connect IoT devices and simulated IoT devices to the Watson IoT Platform. This combination of services will be assembled to work together, including a Node-RED Node.js web server, a Cloudant database to store the sensor data, and the IoT Platform service, so that you can easily connect IoT devices.
In this tutorial, you will learn how to:
- Create a Node-RED Starter Kit application running in the IBM Cloud
- Create an Internet of Things Platform service instance
- Connect the the Internet of Things Platform service instance to the Node-RED Cloud Foundry application
- Restage the Node-RED Starter Cloud Foundry application
- Open the Watson IoT Platform so that you can send data from IoT devices and device simulators
- Configure the Node-RED visual programming editor
To complete this tutorial, you need an IBM Cloud account (IBM Cloud Lite, trial, or paid account).
You can complete this tutorial in less than 20 minutes.
- Create a Node-RED Starter application
- Create an Internet of Things Platform service
- Connect the Internet of Things Platform service to the Node-RED Starter application
- Open the Node-RED visual programming editor
- Launch the Watson IoT platform
Step 1. Create a Node-RED Starter application
Follow these steps to create a Node-RED Starter application in the IBM Cloud.
Log in to IBM Cloud.
Click Catalog (1), and search for Node-RED Starter (2).
Under Starter Kits (3), click the Node-RED Starter (4) tile.
Enter a unique name for your application (5). This name will be part of the application URL (6). Note: If the name is not unique, you will see an error message, and you must enter a different name before you can continue.
The Domain (7), Organization (8), and Space (9) will be pre-populated with valid options for your IBM Cloud account. If you have a Lite account, then accept the defaults. If you have a trial or paid account, or belong to additional organizations, then you can choose to deploy to any region, organization, and space that is available to you.
In the Selected Plans, you can provision the Node-RED Starter application using the IBM Cloud Lite plan (10).
Click the Create button (11).
Step 2. Create an Internet of Things Platform service
The next step is to create an Internet of Things Platform service instance.
- Return to the IBM Cloud Catalog
- Search for Internet of Things
Click the Internet of Things Platform tile (12).
Specify a unique service name, such as: “discover-iot-try-service”
Click on the Create button.
Step 3. Connect the Internet of Things Platform service to the Node-RED Starter application
So far, you have provisioned the IoT Platform Service and Node-RED Starter application in the IBM Cloud region as specified. In this step, you bind the two together.
- Once your Internet of Things Platform service instance has been created, the Manage page describes the plans. The Lite tier is free, but it will be deleted after 30 days of inactivity.
- Click Connections (13) in the left navigation menu.
Click the Create connection (14) button.
Connect to the Node-RED Cloud Foundry application created in Step 1 by clicking on the Connect button.
Restage the Node-RED Cloud Foundry application to bind it to the Internet of Things service by clicking on the Connect & restage app button.
Click on the Restage button to confirm the restage of the Node-RED Starter application.
Click on the application name to open the Node-RED Starter application Overview page.
Wait for the Cloud Foundry application to restart, which is indicated by the status “This app is awake.” Then, click the Visit App URL link.
Step 4. Open the Node-RED visual programming editor
A new browser tab will open to the Node-RED start page. Node-RED is an open source Node.js application that provides a visual programming editor that makes it easy to wire together flows.
Several panels will help you set up Node-RED in your Watson IoT Platform application.
When you see the welcome panel, click the Next button to proceed. (Step 1 of 4)
Secure your Node-RED editor by setting a username and password. Remember your username and password. Click the Next button to proceed. (Step 2 of 4)
If you forget, you can reset the username and password in the Cloudant DB or by setting IBM Cloud environment variables. Click the Finish button to proceed. (Step 3 of 4)
Click the Go to your Node-RED flow editor button to launch the Node-RED flow editor. (Step 4 of 4)
Sign in with your new username and password credentials.
The Node-RED Visual Programming Editor opens with a default flow. On the left side is a palette of nodes that you can drag onto the flow. You can wire nodes together to create a program.
Step 5. Launch the Watson IoT platform
Now that you’ve bound the two apps together, and configured the Node-RED Visual Programming Editor, you can launch the Watson IoT Platform.
Return to the IBM Cloud Application Details page.
Click the Overview item (15) in the left navigation menu.
In the Connections tile, click your iotf-service (16).
Click the Alias of … link.
The Internet of Things service landing page opens. From the Manage page, click the Launch (17) button.
The Watson IoT Platform service opens in a new browser tab. You can now create an IoT device.
Congratulations. You have now created a Node-RED and Watson Internet of Things Platform Starter application in the IBM Cloud.