View on GitHub

project15

Project 15 from Microsoft | Open Platform Repository

Connect IoT devices to the Open Platform

This document walks through :

  1. Provisioning a device to Open Platform
  2. Visualizing data from devices

Requirements

Provisioning a device to Open Platform

In order to consume (e.g. visualize) data from a device, the device must be provisioned. Provisioning device means :

  1. Creating device identity in IoT Hub
  2. Prepare a device
  3. Authenticating the device
  4. Establishing a connection

1 : Creating a device identity in IoT Hub

A device must be known to the solution. Creating a device identity means registering a device entity in IoT Hub. In this instruction, we will use Raspberry Pi Azure IoT Online Simulator.

  1. Browse to Open Platform Web Dashboard with your browser
  2. Click Device Management in the Navigation Menu
  3. Click Device Management tab
  4. Click Add a device
  5. Give a name for the new device e.g. PiSimulator1
  6. Click +Create

Once a new device is successfuly created, it should be added to the dropdown device list

IOTHUB 05

2. Preparing a device

Each device firmware/device app has their own way of programming authentication information. For this demo, we will use Raspberry Pi Azure IoT Online Simulator.

  1. Browse to Raspberry Pi Azure IoT Online Simulator with your browser

    Click Raspberry Pi Simulator in the Navigation Menu

  2. Select the new device you created above, if not selected
  3. Click Advanced (for Device Developers)

    You should see fields are filled.

  4. Click green button next to Primary Connection String

    This will copy the connection string in clipboard.

IOTHUB 06

3. Connecting a device

  1. Switch to Raspberry Pi Azure IoT Online Simulator

    Replace [Your IoT hub device connection string] with the connection string

    [!IMPORTANT]
    Ensure the connection string is inside single quotes ` `

    Correct
    const connectionString = `HostName=P15-IoTHub-jq…….`;

    Incorrect
    const connectionString = HostName=P15-IoTHub-jqs…….;

    Example :

    IOTHUB 07

  2. Click Run button to connect and start sending simulated telemetry to Open Platform.

    In the bottom right pane, you should see log saying the simulator is connected and sending telemetry.

    IOTHUB 08

  3. Switch to Open Platform portal

    Confirm telemetry and events are pushed to the portal.

    [!NOTE] Make sure you click Stop in Raspberry Pi Simulator or close browser when you are finished.

    IOTHUB 09

Next Step

Project 15 from Microsoft - Open Platform