Overview

Skill Level: Any Skill Level

Beginner

Ingredients

  1. Bluemix account (on U.S. South)
  2. Firefox or Chrome browser

Step-by-step

  1. Pattern or single library elements

    The quickest way is to simply follow the workflow described in the video below.

    The other steps are useful only if you want to understand how to use the library elements that make up the pattern (i.e. Device Geo Maps and Generic Geo Device)

  2. Create IoT Workbench Solution

    Note: Skip this step if you have already a solution

    1. Login to Bluemix (U.S. South) and create Internet of Things Workbench service (currently listed under lab services)

    2. Type and create a new solution (say Device Maps Solution)

  3. Deploy Node.js application and set the MQTT Settings

    Note: Skip this step if you already have your MQTT settings set for an Watson IoT service and have a Node.js application deployed

    1. Select the application in your solution, set its name and then click “Deploy to Blumix” (right sidebar). If deploy fails make sure you have enough quota of memory and services and try again – this takes a few moments.

    2. Navigate to the Bluemix application dashboard (you can seelect the application and click on the application dashboard URL link in Workbench)

    3. Open the Watson IoT service instance and generate a new API Key and capture the new generated key and token

    4. Switch back to your solution in IoT Workbench, click on the settings menu (top right 3 green bar) and open the MQTT Settings dialog

    5. Set the API Key and Token you got from Watson IoT, then close the dialog

  4. Adding map capabilities to the Node.js application

    1. In IoT Workbench, go to the Libraries Catalog page

    2. Cick on Device Geo Maps and add the element to the solution

    3. Connect the map element to your Node.js application

  5. Deploy and test your application

    1. Add devices to your solution in IoT Workbench that send lat and lon information periodically. Easiset way is to go to the libraries catalog and add the Generic Geo Device element or Basic Weather Station.

    2. Connect the to your application and add the messages to the connector by selecting it (the connector) and clicking SELECT (righthand sidebar). As long as there is a message sending lat (geo latitude) and lon (longtitude) to the device periodically it will show up on the map.

    3. Select the application, make sure your GIT credentials are properly filled in, and then click Deliver (right side bar) – this will update, build and re-deploy the application on Bluemix

    4. Switch to the simulation page, create some device instances and fill in their data including lat and lon.

    5. Switch to your application URL (you can do so via the link on the application side bar) and append the URL with /map.html. You should see a map showing the devices. Clicking on a device marker should show you the rest of his data.

    You can import the GIT source files to your Node.js IDE (e.g. Eclipse) to review and modify the Node.js application code.

Join The Discussion