Scale an Azure Percept DK configuration to multiple devices
Published Sep 13 2021 09:00 AM 1,780 Views
Brass Contributor

Azure Percept DK is an easy-to-use platform for creating edge AI solutions. It combines different Azure services (e.g., Azure Cognitive Services and Machine Learning) to deliver real-time audio and vision insights. The device comes pre-built with Azure Percept Studio, a service which makes deploying on this device even easier to do. To find out more about the Azure Percept DK visit this page.

 

Previously, we successfully managed deploying a custom azure stream analytics edge module on the Azure Percept DK. Now, our question was – how do we replicate the modules with their configuration on multiple Azure Percept DK at large scale? One way is to deploy and configure each module on devices separately - but this would be very time consuming. The answer to this is: Azure IoT Edge automatic deployments.

 

Azure IoT Edge provides two different methods to configure modules for IoT Edge devices. The method we are outlining today is to create a deployment manifest and then apply the configuration to a particular device by its name. The configuration can be applied on multiple devices at the same time by using device twin tags.

 

All you need to do is to provide the device connection string (from IoT Hub) to your end Azure Percept DK user. You can go through the Azure Percept DK setup and use this connection string to get connected to Azure IoT hub. The reference architecture containing the AzureEye, StreamAnalytics, HostIp, ImageCapturing and WebStream modules is showed in the diagram below:

 

Sargithan_Senthil_1-1631451963726.jpeg

 

We can talk hours about the features of Azure Percept DK, but now it’s time to get things working. In order to get started, log onto the Azure portal, navigate to your IoT Hub resource and follow the below instructions:

 

  1. In IoT Hub main page, under Automatic Device Management section click on ‘IoT Edge’
  2. Select ‘IoT Edge Deployments’ tab and click on ‘Add Deployment’
  3. Specify the deployment name and add labels if needed

Sargithan_Senthil_2-1631451963707.png

 

4. Go on the ‘modules’ tab

 

5. Click on Runtime Settings button and configure the Edge Agent and Edge Hub, if not already configured by default (configuration template available at the end of the article)

 

edge agent.PNG

 

edgehub.PNG

 

6. Under IoT Edge Modules click on add and select ‘IoT Edge Module’. Give it a name, in this case: azureeyemodule and paste the Image URI under ‘Module Settings’ tab (links available at the end of the document)

Sargithan_Senthil_3-1631451963710.png

 

7. Select ‘Container Create Option’ tab and paste the Docker container configuration

 

Sargithan_Senthil_4-1631451963712.png

 

8. Select the ‘Module Twin Settings’ tab and paste the module twin desired properties. Set the property to “properties.desired”

Sargithan_Senthil_5-1631451963715.png

9. Save the newly created IoT Edge Module by selecting the ‘add’ button

 

10. If deploying ASA Edge follow this step, otherwise skip this step: Add the Azure Stream Analytics Edge module by selecting the ‘Azure Stream Analytics’ Module option, select the Edge Job you want to deploy and click ‘Save’

 

Sargithan_Senthil_6-1631451963730.png

 

11. Add the ImageCapturingModule by following the same steps shown for azureyeemodule

 

Sargithan_Senthil_22-1631452367759.png

 

12. Select the ‘Environment Variables’ tab and specify 3 variables as shown in the screenshot below

Sargithan_Senthil_23-1631452399029.png

13. Press on ‘Add’ to save the module

 

14. Add the HostIpModule by following the same steps as for the ImageCapturingModule

Sargithan_Senthil_24-1631452505829.png

 

 

15. Select ‘Container Create Option’ tab and paste the Docker container configuration

 

Sargithan_Senthil_25-1631452538523.png

 

16. Click ‘Add’

 

17. Add the WebStreamModule by following the same steps as shown above

 

Sargithan_Senthil_26-1631452601495.png

 

 

Sargithan_Senthil_27-1631452640364.png

 

Sargithan_Senthil_28-1631452657741.png

 

18. Click ‘Add’ to save the module

 

19. Select the ‘Routes’ tab to specify how the device will route the data (we are specifying two routes – one route from azureeyemodule to the ASA job and the second route from ASA job to IoT Hub). In case you are planning to receive telemetry from the azureeyemodule only, use the third route only which is shown below (AzureEyeModuleToIoTHub)

 

routes.article.PNG

20. Optionally, you can specify some metrics to monitor IoT Edge deployments. In our case we have specified one metric to state if the device has been successfully configured

 

Sargithan_Senthil_31-1631452847182.png

 

21. Click on ‘Target Devices’ tab and specify the priority number for the deployment (higher values indicate higher priority) and the target condition by specifying the device/s you want to apply the deployment manifest on (in our case deviceid = ‘Percept_Excalibur’). You can click on view devices to check if the target condition is correct

 

Sargithan_Senthil_32-1631452879816.png

22. Select ‘Review + create’ tab – if the validation passed, you are ready to create the deployment manifest by clicking on the create button

 

Sargithan_Senthil_33-1631452959323.png

 

23. Now you can get the IoT Edge Device Connection string, using Azure IoT Hub, and pass it on to the Azure Percept DK user. The user will need to configure the Azure Percept DK to use the connection string

 

24. You should see the newly created deployment listed in ‘IoT Edge Deployments’ tab – wait a few minutes for the deployment manifest to be applied to the target device

 

 

Sargithan_Senthil_35-1631453067468.png

 

25. If successfully, the system metrics will report success

 

Sargithan_Senthil_37-1631453124423.png

 

26. The modules should be deployed on the device up and running showing no errors

 

Sargithan_Senthil_38-1631453158983.png

 

 

--------------------------------------------------------------------------------------------------------------------------------------------------------

 

Edge deployment configuration template:

Edge Hub settings

Image URI: mcr.microsoft.com/azureiotedge-hub:1.1

Environment variables: 

OptimizeForPerformance (Text) - False
mqttSettings__ThreadCount (Text) - 4
SslProtocols (Text) - tls1.2

 

Container Create Options:

 

{
    "HostConfig": {
        "PortBindings": {
            "443/tcp": [
                {
                    "HostPort": "443"
                }
            ],
            "5671/tcp": [
                {
                    "HostPort": "5671"
                }
            ],
            "8883/tcp": [
                {
                    "HostPort": "8883"
                }
            ]
        }
    }
}

 

 

Edge Agent settings

Image URI: mcr.microsoft.com/azureiotedge-agent:1.0

Environment Variables:

BackupConfigFilePath (Text) - /tmp/edgeAgent/backup.json

 

Azureeyemodule settings

IoT Edge Module Name: azureeyemodule

Image URI: mcr.microsoft.com/azureedgedevices/azureeyemodule:preload-devkit

 

Container Create Options:

 

{ 
    "ExposedPorts": { 
        "8554/tcp": {} 
    }, 
    "HostConfig": { 
        "Binds": [ 
            "/dev/bus/usb:/dev/bus/usb" 
        ], 
        "DeviceCgroupRules": [ 
            "c 189:* rmw" 
        ], 
        "PortBindings": { 
            "8554/tcp": [ 
                { 
                    "HostPort": "8554" 
                } 
            ] 
        } 
    } 
} 

 

 

Module Twin Settings:

 

{ 
    "ExposedPorts": { 
        "8554/tcp": {} 
    }, 
    "HostConfig": { 
        "Binds": [ 
            "/dev/bus/usb:/dev/bus/usb" 
        ], 
        "DeviceCgroupRules": [ 
            "c 189:* rmw" 
        ], 
        "PortBindings": { 
            "8554/tcp": [ 
                { 
                    "HostPort": "8554" 
                } 
            ] 
        } 
    } 
} 

 

 

ImageCapturingModule

IoT Edge Module Name: ImageCapturingModule

Image URI: mcr.microsoft.com/azureedgedevices/imagecapturingmodule:latest-arm64v8

Environment Variables:

RTSP_IP – azureeyemodule

RTSP_PORT – 8554

RTSP_PATH – raw

 

HostIpModule

IoT Edge Module Name: HostIpModule

Image URI: mcr.microsoft.com/azureedgedevices/hostipmodule:latest-arm64v8

 

Container Create Options:

 

{ 
    "NetworkingConfig": { 
        "EndpointsConfig": { 
            "host": {} 
        } 
    }, 
    "HostConfig": { 
        "NetworkMode": "host" 
    } 
}

 

 

WebStreamModule

IoT Edge Module Name: WebStreamModule

Image URI: mcr.microsoft.com/azureedgedevices/webstreammodule:preload-devkit

Environment Variables:

RTSP_IP – azureeyemodule

RTSP_PORT – 8554

RTSP_PATH – raw

 

Container Create Options:

 

{ 
    "ExposedPorts": { 
        "2999/tcp": {}, 
        "3000/tcp": {}, 
        "3002/tcp": {}, 
        "3004/tcp": {}, 
        "3006/tcp": {}, 
        "3008/tcp": {}, 
        "3010/tcp": {} 
    }, 
    "HostConfig": { 
        "PortBindings": { 
            "2999/tcp": [ 
                { 
                    "HostPort": "2999" 
                } 
            ], 
            "3000/tcp": [ 
                { 
                    "HostPort": "3000" 
                } 
            ], 
            "3002/tcp": [ 
                { 
                    "HostPort": "3002" 
                } 
            ], 
            "3004/tcp": [ 
                { 
                    "HostPort": "3004" 
                } 
            ], 
            "3006/tcp": [ 
                { 
                    "HostPort": "3006" 
                } 
            ], 
            "3008/tcp": [ 
                { 
                    "HostPort": "3008" 
                } 
            ], 
            "3010/tcp": [ 
                { 
                    "HostPort": "3010" 
                } 
            ] 
        } 
    } 
} 

 

 

Deployment routes

 

{
    "routes": {
        "telemetrytoAsa": "FROM  /messages/modules/azureeyemodule/* INTO BrokeredEndpoint(\"/modules/perceptasa/inputs/edgeinput\")",
        "asatoiothub": "FROM /messages/modules/perceptasa/* INTO $upstream",
		"AzureEyeModuleToIoTHub": "FROM /messages/modules/azureeyemodule/outputs/* INTO $upstream"
    }
}

 

--------------------------------------------------------------------------------------------------------------------------------------------------------

Now Try out Azure Percept yourself

 

To get started on building your own solutions with Azure Percept, it’s easy to purchase a developer kit to try out pilot projects before deciding to deploy at scale. You also can visit the Azure Percept YouTube channel for videos about getting started with the developer kit.

Version history
Last update:
‎Sep 14 2021 07:58 AM
Updated by: