Connect IoT devices to the Open Platform
This document walks through :
- Provisioning a device to Open Platform
- Visualizing data from devices
Requirements
- A PC with web browser
- Optional : A device to connect to Open Platform solution
- If you do not have any of following devices, you may use Raspberry Pi Web Simulator
- Raspberry Pi
- Seeed WIO Terminal
- A PC with Linux
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 :
- Creating device identity in IoT Hub
- Prepare a device
- Authenticating the device
- 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.
- Browse to Open Platform Web Dashboard with your browser
- Click Device Management in the Navigation Menu
- Click Device Management tab
- Click Add a device
- Give a name for the new device e.g. PiSimulator1
- Click +Create
Once a new device is successfuly created, it should be added to the dropdown device list
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.
-
Browse to Raspberry Pi Azure IoT Online Simulator with your browser
Click Raspberry Pi Simulator in the Navigation Menu
- Select the new device you created above, if not selected
-
Click Advanced (for Device Developers)
You should see fields are filled.
-
Click green button next to Primary Connection String
This will copy the connection string in clipboard.
3. Connecting a device
-
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 :
-
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.
-
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.
Next Step
- Developers : Learn more technical details of the Open Platform Open Platform Developer Guide : Architecture Overview