The IBM Watson Internet of Things Platform is a fully managed, cloud-hosted service that makes it simple to derive value from Internet of Things (IoT) devices. When combined with the IBM Bluemix platform, Watson IoT Platform provides simple, but powerful application access to IoT devices and data. You can rapidly compose analytics applications, visualization dashboards, and mobile IoT apps. Create IoT applications that feed insights to your backend enterprise applications.
Gateways are a specialized class of devices in Watson IoT Platform which serve as access points to the Watson IoT Platform for other devices. Gateway devices have additional permission when compared to regular devices and can perform the following functions:
- Register new devices to Watson IoT Platform
- Send and receive its own sensor data like a directly connected device,
- Send and receive data on behalf of the devices connected to it
- Run a device management agent, so that it can be managed, also manage the devices connected to it
Refer to the documentation for more information about the Gateway support in Watson IoT Platform.
This recipe shows how one can setup an Watson IoT Platform Organization and register Gateway(s) in it, so that one or more devices can be connected to IBM Watson IoT Platform via the Gateway.
Create Watson IoT Organization
When you create a service “Internet of Things Platform” in IBM Bluemix, a new Organization will be created for you. This Watson IoT organization is a space used for connecting and managing devices (and Gateway devices) to the Watson IoT Platform, so that your applications can access their live and historical data.
You can create an Watson IoT Platform organization by using IBM Bluemix. Follow the below steps to do the same,
- Open your favorite browser and go to Bluemix. If you are an existing Bluemix user, log in as usual. If you are new to Bluemix you can sign up for a free 30 day trial.
- Once you signed up to Bluemix, click this link to create the Watson IoT Platform service in Bluemix.
- Type a name for your service and click Create button as shown below,
- Observe a Welcome page, click on¬†Launch button to enter into the IBM Watson IoT Platform organization space. The IoT organization is a space used for connecting and managing devices to the IBM Watson IoT Platform, so that your applications can access their live and historical data.
- Observe that a new Organization is created where you can add, connect and manage IoT Gateways and devices.
At this step, we have successfully created the Watson IoT organization.
Create Gateway Device Type
Each Gateway device connected to the Watson IoT Platform is associated with a device type. Device types are intended to be groups of devices which share common characteristics. So in order to add Gateway devices in Watson IoT Platform, one need to create a device type. Following are the instructions for creating a Gateway Device Type.
- Go back to the IBM Watson IoT Platform dashboard, click Devices tab, device types tab, then click on the Create Type button as shown below,
- Observe that there are 2 options provided now, namely Create device type and Create gateway type. As this recipe focuses on adding a Gateway device, click Create gateway type and proceed,
- Specify a name for the device type to be added and optionally a description as shown below, then click Next,
- Observe that a template page is given where you can select and define one or more attributes. All of these attributes are optional. They will be used as a template for new Gateway devices that are assigned this device type. Attributes that you do not define may still be edited individually later when you add the Gateway. You can define one or more attributes by selecting them and clicking Next as shown below,
- Define the selected attributes Manufacturer and Model as shown below, then click next,
- Define optional Metadata in JSON format as shown below, you can choose not to set this attribute as its optional, then click Create,
- Observe that a new device type is added in the Watson IoT Organization,
At this step, we have successfully created a device type in Watson IoT organization.
Add Gateway in Watson IoT Platform
Gateways are a specialized class of devices in the Watson IoT Platform. Gateway devices can register new devices and can send and receive data on behalf of devices connected to them. You need to add the Gateway in Watson IoT Organization before connecting it. Carry out the following steps to add the Gateway in IBM Watson IoT Platform.
- In the Watson IoT Platform dashboard, click Browse tab and then Add Device button as shown below,
- Choose the device type “iotsample-gwtype” that we created in the last step, then click Next as shown below,
- Enter a unique device id, which will distinguish your Gateway from all other devices that you might connect to the Watson IoT Platform(you can use 1 or something more sophisticated like your devices MAC address), then click Next as shown below. Also note that the values of “Manufacturer” and “Model” attributes are populated from the device type “iotsample-gwtype”. These values can be overridden, and attributes not set in the device type can be added as well.
- Add a Metadata and click next, (you can choose not to add Metadata as its optional),
- In the next page, you can either add your own authentication token, or allow the IoT Platform to generate a token for you. The IoT Platform generated token will be 18 characters long and will contain a mix of alphanumeric characters and symbols. The token will be returned to you at the end of the registration process. In case if you want to add your own token, enter the token as shown below, then click Next,
- As shown below, you will be given a summary page to verify the details before adding the Gateway to IoT Platform. Verify and click Add,
- At this step, the Gateway is registered to your Organization and you will be provided with the registration details as marked below. To get your Gateway connected, you need to add the credentials to your Gateway. So make a note of them.
- Click the cross button to get back to the main dashboard and observe that the Gateway is added in your Organization,
So, now we have successfully added a Gateway in the Watson IoT organization.
In this recipe we demonstrated how to setup an Watson IoT Platform Organization, create a Gateway Device Type and register a Gateway device using the dashboard. Also, you can use the IBM Watson IoT Platform ReST API, or the Client Libraries to create the Gateway Device Type and register Gateways in Watson IoT Platform.
Where to go from here?
Go through Connect Raspberry Pi as Gateway to Watson IoT Platform recipe to develop you own Gateway and connect to IBM Watson Iot Platform.