How to create a simple IOT Bluemix application.

What do you need to get started:
  • An IBM ID and password
  • An IBM DevOps Services account
  • A Bluemix account
Setup BlueMix environment.

Step 1: After registration, we go to the CATALOG section on menu side and choose Internet of Thing Foundation Stater.

1

Step 2: Go to the DASHBOARD, click on recent created application to access control page. IBM will add automatically 2 services are IBM Cloudant and Internet of Thing Service to our application.

2

Configure IoT Application

Step 1: Click our app’s ROUTES path to browse to the app website:

3Step 2: Click Go to your Node-RED flow editor. We can see default IoT flow diagram:

4

On the left side is the list of available nodes (input and output “connectors” and functions to perform on input data or to produce an output). On the right side are the properties of the node that’s selected in the worksheet.

Step 3: Remove all nodes from the sheet and create a new flow datagram. New flow graph includes 1 “IBM IoT APP In” node connected to debuger and cloudant node.

5

Step 4: Click on IBM IoT App In Node and change Node’s configuration:

6

  • Authentication method define the way device authenticate to connect to BlueMix platform.
    • Bluemix Service: Using Inbound authentication service. This is the common way to authenticate devices connect to IBM IoT service.
    • Quick Start: No need any authentication service.
    • API Key: Authenticate using API key. The key is found in Node properties.
  • Input Type: Define data which is received from devices such as: Event, command or status.
  • Device ID and Event: Define device IDs or event will be received.

Step 5: Click on Device Status Debug node to configure output debug message.

7

  • Output: define message fields which want to show.
  • To: define place to display messages. Debug tab are located in the right side of screen.

Step 6: Click on cloudant node to configure cloudant database:

8

  • Service: define database service which is added into our application.
  • Database: define the name of database used to save data.
  • Operation: define method used to save data.

Configure IBM IoT Service:

Step 1: Click on Interenet of Thing service and launch dashboard.

9

Step 2: Click on device section on menu and add a new device:

  • First, we will choose device types. In this case, we choose “MQTT device” or we can create own device type

10

  • Fill device ID, this value is used to identify and distinguish between devices

11

  • Skip metadata and Security step. After successful creation, device is showed on device page.

12

Connect device to IoT service using Python application:

Step 1:Download and install ibmiotf library using command “pip install ibmiotf”.

Step 2: The constructor builds the client instance, and accepts an options dict containing the following definitions:

  • org – Your organization ID.
  • type – The type of your device.
  • id – The ID of your device.
  • auth-method – Method of authentication (the only value currently supported is “token”).
  • auth-token – API key token (required if auth-method is “token”).

Step 3: Use ‘connect’ method to connect created device to IoT service.

Step 4: After connect successfully, we use ‘publishEvent’ method to publish data to IBM IoT service. The parameters is requested are topic name, datatype and data respectively.

You can see more application detail at https://github.com/hunglkuit/BlueMix-Tutorial

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

<span>%d</span> bloggers like this: