Azure IoT and Raspberry Pi - How to Get Started

Raspberry Pi-based compute modules are often used as edge devices to send signal and other sensor-derived data (temperature and humidity data) to the cloud using Azure IoT Edge and IoT Hub. Azure CLI and Azure Portal to deploy the Azure IoT Edge are the paths used for this use case.

The basics of how to connect a Raspberry Pi device to IoT Hub are described in the cited Microsoft Documentation.

The Raspberry Pi Forum carries an actual use case for handling signal data between an edge device and IoT Hub. This step by step tutorial is based around a Raspberry Pi 3 Model B+ in use with a light emitting diode panel in this described use case with the objective of sending signals to the diode panel from the cloud. The prerequisites for this set up are a ​​Raspberry Pi 3 Model B+, an Azure account, Azure CLI and the Azure IoT CLI extension. We are citing and highlighting this use case here.

Azure IoT in the project

First, a device identifier needs to be created and then it needs to be authenticated in IoT Hub. The use of the Add Edge Enabled option connects the Raspberry Pi to the Azure IoT Edge. The latest version of Azure CLI also needs to be installed so that the appropriate commands can be run.

Then a gateway for connecting all the edge devices to Azure IoT has to be created. Then identifiers need to be created for the Raspberry Pi and a device. After this, a specific device connection string is created which should be recorded for later use.

Raspberry Pi in the project

With Azure IoT Edge modules working as containers, the Raspberry Pi is connected to both Azure IoT Hub and Azure IoT Edge. Then, Docker should be installed on the Raspberry Pi followed by the Azure IoT Edge runtime daemon.

Next, the device should be connected to Azure IoT Hub followed by a restart of the IoT Edge daemon and status check. When all this has been completed successfully, an Azure IoT module can be deployed for managing the IoT device, in this case the light-emitting diode panel. Once the Azure IoT custom module is deployed through the Azure portal, a container can be deployed as a module through it. This assumes that a Docker image has already been created and saved in the Docker Hub. From the IoT Edge Custom Modules section, the module can be named and the container can be run.

OTA updates for Azure devices based on Raspberry Pi

Mender integrates for OTA updates with both Azure IoT Hub for device credentials sharing and supports the preparation of the Raspberry Pi with a Raspberry OS distribution.

The best place to do a test of the Azure - Mender integration for OTA software updates to devices in the IoT Hub is to sign up for a new Mender Enterprise Free trial and all features and add-ons are available for 12 months for free; and refer to the Github documentation on the existing integration.

We are currently working on making major enhancements to the Azure IoT Hub - Mender integration. This will help Mender users get more efficiency, productivity and insights from device provisioning and inspection, from using the two systems together.

If you would like a sneak preview of these upcoming integration improvements, please visit our preview page and leave your email address for updates.

To learn about device updating and device provisioning in Azure IoT, check our the following articles:

Recent articles

Transforming business: It’s “All On” for the future of IoT | Mender

Transforming business: It’s “All On” for the future of IoT

Insights from CES 2024 Billed as “the most powerful tech event in the world,” CES 2024 brought together more than 135 thousand attendees and four thousand
Full speed ahead: The software-defined vehicle of the future | Mender

Full speed ahead: The software-defined vehicle of the future

Distinguished panelists discuss infotainment and entertainment services for the software-defined vehicle. Automotive OEMs must innovate to move towards a s
The Future of the Embedded Linux Ecosystem | Mender

The Future of the Embedded Linux Ecosystem

Insights from the Linux Plumbers Conference 2023 The global Linux market is forecasted to reach $15.64 trillion by 2027, and commands usage among nearly ha
View more articles

Learn more about Mender

Explore our Resource Center to discover more about how Mender empowers both you and your customers with secure and reliable over-the-air updates for IoT devices.