This project's code utilizes the Azure IoT Library which currently does not work with AirLift hardware, such as the Adafruit PyPortal. As a result, this project does not currently work (but may in the future).
For a more updated guide using CircuitPython and Microsoft Azure IoT, visit https://learn.adafruit.com/getting-started-with-microsoft-azure-and-circuitpython
Azure IoT Central
Azure IoT Central is an IoT platform allowing you to quickly create an IoT application that gathers data from devices and displays it on a dashboard. It also has many more capabilities including being able to synchronize data to a device, command the device to perform an action, export data to a range of other Azure services, and set up rules that can be triggered when data breaches certain ranges.
Azure Subscription
To use Azure IoT Central it is recommended to have an Azure subscription. If you don't already have an Azure Subscription, you can sign up for free.
- Azure for Students - If you are a student aged 18 or over you can sign up for a free Azure for Students account at azure.microsoft.com/free/students. This will give you US$100 of Azure credit and 12 months of free tiers of various Azure services, along with some services offering free tiers for life. This can be renewed every 12 months that you remain a student.
- Azure free account - Sign up for an Azure free subscription at azure.microsoft.com/free. This will give you US$200 of credit for the first 30 days along with 12 months of free tiers of various Azure services, along with some services offering free tiers for life. You will need a credit card for verification purposes, but your card will NOT be charged until you explicitly convert to a pay-as-you-go account, if you run out of credit your services will be disabled instead of you receiving a bill.
Azure IoT Central application
To get started with Azure IoT Central, you need to create an IoT Central application. Applications manage the IoT devices they are connected to, as well as defining what the capabilities of the devices are - for example what telemetry values they might send. Applications can also define dashboards for devices to visualize the data they send.
The simplest way to create an application is to copy one from an existing application template. Click the button below to launch Azure IoT Central and create a pre-defined application for this project.
You will need to log in with a Microsoft account. If you have an Azure subscription, use the account that was used to create the Azure subscription. If you don't have a Microsoft account, there is an option to create one. You can create one with any email address.
Once you have logged in, you will be presented with a template for a new application with some fields to fill in.
-
Application name: Set this to a name that makes sense for your application, for example
PyPortal Plant Monitor
. -
URL: Set this to a unique URL for your app. The final app URL will end with
.azureiotcentral.com
. This value needs to be globally unique, so you can leave it as the default value that is created, or try to find a unique value of your own, for example by including your name.
Select the pricing plan you want to use.
For the Free plan you don't need an Azure subscription, but you will need to provide a phone number for verification. Free plans expire after 7 days,
For the S plans, you can have up to 2 devices for free, and will need an Azure subscription. If you exceed the message limits then you won't be charged more, instead the messages will be lost.
To get more details on pricing, including the cost to use more than 2 devices, read the Azure IoT Central Pricing docs.
If you select the free plan, you will need to provide some contact information. Enter your name, phone number and the region closest to you.
The phone number will be verified to ensure you are not a bot. The region will be used to work out where in the world to deploy your application so that it is as close to you as possible.
If you select a standard plan, you will need to select your Azure directory and subscription. If you only have one subscription then the directory and subscription will be pre-filled for you. If you have access to more then select the one you want to use.
Then select the location closest to you. The location will be used to work out where in the world to deploy your application so that it is as close to you as possible.
Once the form is filled out, select the Create button.
Azure IoT Central will provision your application, then load it.
Configure the PyPortal as a device
The IoT Central application that was created defines a device template for the PyPortal - a description of the telemetry data that a device can send as well as a dashboard to visualize that data. This device template lists two possible telemetry values - temperature and soil moisture. The dashboard shows these values by listing the last received value, as well as a graph of values over time.
To connect a PyPortal, you need to create a device in IoT Central that uses the device template.
From the side menu, select Devices. This will show a list of device templates, so select PyPortal Plant Monitor. Then select + New.
In the Create a new device dialog, enter the details for the device.
- Template type: This is already set to the PyPortal template
- Device name: Give the device a name that makes sense to you
- Device ID: Give the device a unique ID
- Simulate this device: Set this to No. IoT Central can create simulated devices to test out your application, and these send dummy data.
Then select Create.
The device will be created and show up in the Devices list.
Select the device from the Devices list, and it will show up with a dashboard, with fields for the temperature and soil moisture data showing Waiting for data.
The final step is to get connection information for the device. This is a set of fields that are needed by the the device to connect to IoT Central and authenticate itself as the device in question.
Select the Connect button in the top corner.
From this dialog, take a copy of the ID scope, the Device ID and the Primary key.
Page last edited April 30, 2024
Text editor powered by tinymce.