Plug n Play: Plug the device and play around

Biplab Sah
5 min readSep 19, 2021

--

IoT — “Internet of Things” over the last few years has been one of the most discussed technologies wherein most of the big and small technology companies have put their stocks on it. IoT solution for any digital transformation is typically about two big components — device and computing platform (mostly cloud). As IoT proved to be very beneficial in multiple aspects like device management, fault tolerance, productivity growth, easy assembly up-gradation, and many more, there’s a rush to make legacy system IoT enabled. The industry is very focused on integrating devices and the cloud which at this moment is very pinpointed i.e. solutions are developed to focus on integrating one kind of a device family or identical system to the cloud. When this kind of solution is scaled up to support different variants of devices or systems, it results in a lot of engineering effort and re-architecting at both devices as well as the platform end. To address this issue, Azure came up with a unique service — IoT Plug and Play, which enables faster scaling of solutions through a seamless device-to-cloud integration experience. It has a design that goes without tight coupling and one-to-one integration of device software and platform software.

IoT Plug and Play (PnP)

“IoT Plug and Play enables solution builders to integrate smart devices with their solutions without any manual configuration. At the core of IoT Plug and Play, is a device model that a device uses to advertise its capabilities to an IoT Plug and Play-enabled application”

- https://docs.microsoft.com/en-us/azure/iot-pnp/overview-iot-plug-and-play

So, if we simplify this, IoT Plug and Play is based on an open modeling language DTDL (Digital Twin Definition Language) that allows device builders to declare their IoT device capabilities as a device model. The DTDL based model is then used by solution builders to develop a solution that understands that device using the device model, all without writing any embedded code. The goal is to fasten the integration of devices belonging to different device families, each of which has a unique model Id, and platform solution on Azure without the need for manual configuration.

Device models are structured as a set of interfaces comprising of properties, commands, and telemetry. Properties are either read-only or modifiable to include details like the state of a device like a fan speed or the target temperature. Telemetry is the data emitted by the device like sensor readings. Commands are the functions or operations which can be performed on a device like a reboot operation. Every model and interface consist of a unique Id and can be reused across devices to facilitate collaboration and speed development. A basic workflow of IoT PnP is depicted in Fig I.

Fig I: Azure IoT Play & Plug Block diagram.

Microsoft welcomes collaboration with customers and industry partners keeping both IoT PnP and DTDL open to the community. Additionally, IoT PnP and DTDL come free of cost. Standard rates for IoT Hub, Azure IoT Central, and other Azure services which will be peripherals for IoT PnP will remain as per the Azure costing. DTDL is based on open W3C standards such as JSON-LD (JavaScript Object Notation for Linked Data) and RDF (Resource Description Framework) which allows easier adoption across services and tools.

As of now, IoT PnP is in Public Preview and is supported by IoT Hub in all regions with standard or free tiers. Azure IoT Hub and Azure IoT central support for IoT PnP is using DTDL preview V1 and Azure Digital Twins is using DTDL V2. Microsoft provides a public Device Model Repository (DMR) where the device model can be published and consumed with characteristics like curated model (Validated by Microsoft using GitHub PR), Immutability, and Hyper-scale. One can also use the same DMR pattern to create a custom DMR in any storage medium. Currently, Microsoft provides production-ready SDKs for both devices and services in C,.NET, Java, Python, and Node with communication over MQTT protocol.

IoT Plug and Play bridge

IoT PnP bridge is an open-source application code written in C language and includes Azure IoT device SDK for C and supports of some peripherals by default like Bluetooth, Camera, Modbus, MQTT, Serial, Window USB. One can create a custom adapter also with the help of primitive adapters. The adapters to the bridge are defined in the adapter manifest. The configuration enables the bridge adapter to enable full device to digital twin communication.

i. Assists in establishing a communication channel directly.

ii. Monitors availability of communication channels through device watcher.

The Bridge can run as a standalone executable on any IoT device, industrial PC or gateway running Windows 10, or Linux. It can also be deployed as an IoT edge module on Linux based platform.

Device Certification

Azure PnP currently provides device certification for Microsoft Partner Network members through Azure Certified Device Portal. Plug and Play device certification needs to meet the following requirements:

1. Device Model should compliance with the Digital Twin Definition Language (DTDL) version 2.

2. Should support Device Provisioning Service (DPS).

  1. Validated product truth on certified devices

In the development phase, one can use Azure CLI to test the compatibility of the/a device using extension az IoT product. Once device is certified using portal, the device then will be published in Azure Certified Device catalog.

PnP Device Builder

1. Creating device models using DTDL via any IDE like Visual Studio or Code with extensions and publishing model to model repository.

2. Implementing code using one of the Azure IoT device SDKs on an IoT device. It lets devices to connect securely to an IoT Hub via DPS (Device Provisioning Service) or connection strings.

3. To enable Model ID registration, IoT Hub accepts a new parameter in the MQTT Connection packet with the Model ID sent by the device and makes this Model ID available to cloud applications.

4. Device builders can certify their devices using Azure Certification Portal (defined in the end) for solution builders to get the guarantee that devices are indeed supporting Plug and Play.

PnP Solution Builder

  1. Solution builders can retrieve Model ID from IoT hub that device registered.
  2. Use the Model ID to retrieve model and interfaces from the model repository.
  3. Solutions can dynamically adjust their user interface depending on the devices connecting using the specified model.
  4. Can use information from the interface to read and write properties, and simultaneously execute commands.

References

· IoT Plug and Play preview blog.

· IoT Plug and Play documentation.

· Certification tools:

o Command line.

o Azure Certified Device submission portal.

· Azure Certified for IoT device catalog.

· IoT Show for IoT Plug and Play.

· IoT Plug and Play certification tutorial.

--

--

Biplab Sah
Biplab Sah

Written by Biplab Sah

Making devices and human smart.

No responses yet