Thanks for joining this short workshop! In the next hour or so, you will be introduced to Azure IoT Central and IoT Plug and Play, letting you discover how simple IoT can be.
The integration with The Things Network and the onboarding of LoRa devices on IoT Plug and Play is in its very early stages, and you should expect the experience in integrating The Things Network with Azure IoT to dramatically improve in the coming months. But we couldn't wait to offer you a little taste of what it will become soon.
To go through this workshop, you will need your laptop and a Web browser… that's it!
We will provide a Seeed Studio SenseCap Temperature and Humidity sensor for you to see real data flowing in.
Note that we have taken care of the provisioning of this sensor on The Things Network as well as the setup of the integration through a WebHook to IoT Central. These parts are the ones that will change in the near future, and we want you to focus on the experience with the Cloud stuff!
Check out the video below that explains what IoT Central is for. Skip if you are eager to get to the hands-on!
Here are a couple of simple diagrams explaining how things are working today and what we expect to be able to offer within The Things Network in the future.
In the following steps you will:
- Create your very own (and free) Azure IoT Central application
- Add an IoT Plug and Play Certified device to the application
- Import an IoT Plug and Play model for your LoRa sensor
- Bridge TTN to Azure IoT Central and connect the LoRaWAN SenseCap TH Sensor to your application
- Additional challenge
Azure IoT Central comes with a free 7-day trial that doesn't require an Azure subscription. If you have an Azure subscription, pay attention to step #4 below.
-
Visit https://apps.azureiotcentral.com and click on the "Build" button in the left menu.
-
You are invited to select an industry and app template or to create a new custom app. At this point, you can navigate through the various industries and templates to see what's available. These templates offer a starting point that implements actual common scenarios in these vertical industries.
For this workshop, we want you to experience how to build your very own app from scratch. Feel free to come back later and experience some pre-configured templates.
On the next screen, select "Custom Apps."[!NOTE] Note that you can only have one free trial application, so if you want to create a second application or have your application persist, you will have to use an Azure Subscription (which you can create for free visiting https://aka.ms/aft-iot)
-
Sign in with a Microsoft Account (you can create one if you don't have one already, it's a pretty straight forward process). The sign-in is required so you can easily find your applications in the future. At this point, you can only use a Microsoft account. If you have an Azure subscription you want to deploy your app into, use the email registered with this subscription.
-
Fill in the various fields and remember to select "7-day free trial" if you don't have an Azure subscription. If you have a subscription you want to use, enter the corresponding Directory and Subscription.
[!NOTE] The name of your application has to be unique. The recommendation is to use your name (or your cat's name if you have one) as a prefix. Or just make something up that is unique to you!
[!NOTE] The personal information you are asked to fill in is only to verify you are a human. As per the privacy statement linked to from the page and as indicated above the "Create" button, it's an opt-in if you want Microsoft to contact you later.
-
Once all fields are filled, click on "Create" and let the magic happen.
Feel free to navigate your application to discover the different pages. You can also watch this short video below that will walk you through the app.
IoT Plug and Play is a feature Azure IoT developed on top of the Digital Twins Definition Model. You can learn what IoT PnP is by watching this video (11min long) and/or reading this introductory documentation page.
DTDL is certainly the most interesting part of IoT Plug and Play as it is the backbone that makes it possible for a device manufacturer to publish their devices' capability models to a public (or private) repository, and for a cloud application developer to easily integrate these devices and their data into their apps. Let's see how this works.
-
Go to the Device Templates page clicking in the menu or on the tile.
-
Let's pick a Plug and Play device from the catalog (here I am selecting the Equipment Vibration Monitoring Solution, but you can check out other devices as well). All the devices listed below have been going through the Azure IoT certification program. It allows our partners to showcase their devices in a broad catalog our customers like to pick devices from, with the assurance that they will seamlessly connect to their Azure IoT based solutions.
Once you have selected the template, click on "Next: Customize" then on "Create."
This new device template will be added to your application. You can see the capabilities the device exposes as well as the Views that have been pre-configured as part of the device model:
-
We don't have this device, so we can't test how things are looking with a real device, but the fact that this is an IoT Plug and Play device allows IoT Central to simulate a device of that type. Let's go ahead a create a simulator.
-
Select the Devices page in the left menu.
-
Select the Equipment Vibration Monitoring Solution device Type.
-
Click on "New."
-
Toggle "Simulated" to On.
-
Click on "Create."
-
You just created a new simulator of type Equipment Vibration Monitoring Solution. Select it in the devices clicking on its name to bring up its dashboard. After a few seconds, the simulator will kick in, and the dashboard will start displaying telemetry. Not a single line of code and IoT Central was able to understand what the device is saying.
Now that we have seen how importing an actual Plug and Play device that has already been published in the catalog, let's take a look at how you can import the model of a device that is not published up there. As a matter of fact, the SenseCap TH Sensor you have is not certified for IoT Plug and Play, but that won't prevent us from taking advantage of Plug and Play. Let's create a Device Capability Model file in the DTDL format real quick and then import it in our IoT Central application.
As a device manufacturer, the process would consist in creating a Device Model using the DTDL format, then publish this model to your company repository. After going through the certification process, your device model would then publicly appear in the IoT Central catalog. If you want to learn more about all these steps, check out our documentation. For the sake of the workshop, let's just manually import a model.
-
Download the following file: SenseCapTHSensorModel.json.
-
In the IoT Central application, go to the Devices Templates page and click on "New."
-
Select "IoT Device" then "Next: Customize."
-
Click on "Next: Review" then on "Create."
-
Enter the device template name SenseCap TH Sensor and hit Enter.
-
On the next screen, select "Import capability model."
-
Select the JSON file you just downloaded. A new model has now been imported into your application. Let's now create a view!
[!NOTE] The views cannot be added to a Plug and Play Device Capability Model as these are specific to IoT Central. When certifying and publishing a PnP device to the public repository, you have the option to add views to what is called the Device Solution Model.
-
Go to the Views page and click on "Generate default views."
-
Then click on "Generate default dashboard(s) view."
-
You can verify that the view is as you like, adapt tiles sizes, style, and position to adapt the dashboard to your user's needs. You'll notice that the default overview dashboard has one of the tiles a bit off, that's a known bug of the preview :-). Once you are done customizing your view for the TH Sensor, click on "Save" then "Publish" to validate the device model version (device models can be edited and will automatically be versioned when you make changes and republish a revised model to the app).
As indicated earlier, we are using the open-source IoT Central device bridge. In order to configure the bridge to forward telemetry from The Things Network to your Azure IoT Central application, we have already setup our TTN tenant to format the payload and setup a WebHook integration to trigger the bridge. For the bridge to be authorized to connect to your application to provision the device and send telemetry, we need your application's credentials.
-
In your IoT Central application, go to the "Administration" page and select "Device Connection."
-
Take note of the ID scope, then click on "View Keys" below and copy the primary key.
-
Take note of your SenseCap TH Sensor EUI.
-
To configure the bridge for the right mapping of your device to your Azure IoT Central application we created a Slack App. Join the Workshop Slack Channel, then open the Slack Bot app and enter the below information:
- Device EUI
- App ID Scope
- App primary key
-
Once the bridge is setup to connect to your application, it will provision a new device with the same ID as the EUI in TTN. Furthermore, thanks to Plug and Play, the device will share with the application what device model to use. This way the application will know to associate this new device to the model you just uploaded in the application importing the JSON file. Then it will start sending telemetry respecting the format defined by the Device Capability Model.
Congratulations, you have successfully connected your LoRaWAN device to Azure IoT Central.
If you reached this point in the workshop and have some time to spare, we invite you to navigate in the IoT Central application and find by yourself how you can setup an alert and send a message each time the temperature (or humidity) passes a certain threshold. Then blow on the sensor to trigger the alert!