IoT: How to Implement a Hybrid Project?

Post co-written by Taha Snoussi and Yann Bilissor
As part of this month’s focus on hybridization, we will first look at a few issues related to the Internet of Things (IoT) project management in general and, more specifically, how an IoT fleet’s compute (processing power) can be used. In some fields, like artificial intelligence (AI), people often ask if it’s better to run machine learning models in the cloud or directly on our devices. This post will explain the basics of IoT project management in Azure and how to lay the groundwork for hosting an app that controls an IoT fleet. In Azure, there are different ways to handle projects with one or more IoT devices. These vary depending on the device type, the size and stage of the project, and how the company is organized, among other things.
As part of an IoT device project that Cellenza’s experts worked on, we chose the platform mode managed by the company’s IT team for the Azure backends. This bold choice, driven by the company’s organizational patterns, resulted in the IoT project management solution we are going to talk about in this article.
We use our global IoT platform in full continuous integration/continuous deployment (CI/CD) mode and via Azure DevOps. This platform is used throughout the company, so all IoT device projects we support share it. This platform offers the following Azure services, among others:
- Azure IoT Hub
- Azure Device Positioning Service (DPS)
- Azure Digital Twins
In the past, when IoT devices used these services in a free-running (uncontrolled) mode, the results were mixed, making them difficult to manage.
We have chosen to control this usage in our IoT projects.
Architecture
Here is how the architecture has been simplified:
Git REPO Template
To standardize use of our platform, we’ve created a set of Git repository templates that developers can use to get up and running quickly and control their adoption of our global IoT platform. These GIT REPOs each have a Readme file with instructions on how to use them. They also manage the development, validation, and production environments.
The components created by these pipelines consistently inherit the project name. The code that retrieves the project name in the pipeline is:
project: ${{lower(variables['System.TeamProject'])}}
Provisioning in Azure DPS
The REPO contains the Azure DevOps pipeline that allows the automated provisioning of a new IoT device with the data required for the seamless operation of the global IoT platform.
Adding an IoT Device Model in Azure Digital Twins
The REPO contains a simplified model of an IoT device in JSON format. It also provides examples of sensor models and the pipeline for deploying them in Azure Digital Twins.
Building Linux Images with IoT Edge Runtime
The REPO contains the scripts and configurations that a developer needs to compile an image that can run independently on an IoT device from a Rasbpian or Ubuntu image. The REPO provides 32 and 64-bit ARM and AMD configuration settings.
Once the pipeline is set up, it provides a link to download the generated image in .xz format.
Building The IoT Edge-Compatible Project’s Specific Module
The REPO contains all the sources for a C#-built IoT Edge module, allowing developers to start creating a specific one quickly. The developer has to configure the installation of the Linux host driver files to interact with the IoT device.
IoT Edge Deployment Manifest
The Global IoT Platform supplies the IoT device project with modules embedded in the IoT Edge deployment manifest in the REPO template. These modules facilitate the instrumentation of devices connected to the platform. The developer needs to add modules specific to the IoT device being built to the deployment manifest.
The pipeline for deploying the manifest in the Azure IoT hub is also in the REPO. Once the IoT device is turned on, it will automatically set itself up based on the configuration deployed. It is then ready to use.
Developer Guide
To start a new use case in an IoT device project, a developer must do the following:
- Create an Azure DevOps project with the Git REPO template. The IoT device module in Azure Digital Twins has the same name as the project.
- Configure the IoT device model in the specified REPO and its deployment in Azure Digital Twins.
- Run the Linux image build pipeline.
- Retrieve the built image and copy it to the SD card configured to start the IoT device.
- Develop an IoT Edge module using the Git REPO template.
- Configure the module in the specified REPO and deploy it in the Azure IoT hub through its pipeline.
Upon completing these steps, the device is activated with the selected modules, and the global IoT receives its telemetry data.
More about Hybridization
Now that we’ve set up the development framework for an IoT Edge project that we talked about at the beginning of this post, especially by solving the main problems with managing the code, packaging, and module releases in Azure, you can take this further by, for example, deploying an AI model that will run directly on the device without API calls. This way, you can avoid network problems like latency or unavailable servers. This makes your IoT products more responsive.
And, if you’d like to discuss the subject, don’t hesitate to contact our experts or leave a comment below!
Interested in the subject? Read our posts our hybridization: