Connect Edge Devices to Azure* IoT

Published: 11/20/2020  

Last Updated: 01/11/2022

Overview

Install a web-based application that provides an Out of Box Experience to securely connect your Intel device to Azure* IoT Hub or Azure* IoT Central†. The web application creates Azure IoT Resources and enables configuration and monitoring of Edge AI and use case deployments.

Select Configure & Download to download the use case.  

Configure & Download



Recommended Hardware
The below hardware is recommended for use with this use case. See the Recommended Hardware page for other suggestions. 


Connecting to Azure IoT Hub or Azure IoT Central 

If you have your own Platform-as-a-Service, use the Intel Device connected to IoT Hub to complete the edge-to-cloud IoT Solution. 

If you do not know where to start on the Cloud, you can use Microsoft’s Software-as-a-Service Azure IoT Central platform to quickly connect Intel device to visualize, maintain and deploy your IoT solution. 

Read the 8 attributes of successful IoT solutions for more information on when to use Azure IoT Hub or Azure IoT Central. 


Target System Requirements 

  • Intel® CPU Processors 
    • Intel® Atom* processor with Intel® SSE4.1 support 
    • Intel® Pentium® processor N4200/5, N3350/5, N3450/5 with Intel® HD Graphics 
    • 6th - 11th generation Intel® Core™ processors 
    • Intel® Xeon® processor E3, E5, and E7 family  
    • 2nd Generation Intel® Xeon® Scalable Processors  
    • 3rd Generation Intel® Xeon® Scalable Processors 
  • At least 4 GB RAM. 
  • At least 64 GB hard drive. 
  • An Internet connection. 
  • Ubuntu* 18.04.3 LTS Kernel 5.0 

Knowledge/Experience 

You should be or you are expected to be familiar with executing Linux* commands. 


How It Works 

The Connect Intel Devices to Azure IoT* web application deploys Azure IoT Edge modules to edge devices with the following steps: 

  1. Setup Device. 
  2. Create and setup Azure IoT Resources:  
    • Resource Group (RG): A new approach to group a collection of assets in logical groups for easy, or even automatic provisioning, monitoring, and access control, and for more effective management of their costs. 
    • Azure IoT Central: Microsoft* IoT application development platform that connects IoT devices to the cloud. Provides basic pre-integrated Azure Services such as device provisioning, streaming analytics and time series insights. Use Microsoft’s Software-as-a-Service Azure IoT Central platform to quickly connect an Intel device to visualize, maintain and deploy your IoT solution.  
    • Azure IoT Hub: Microsoft’s IoT connector to the cloud. It enables reliable and secure bi-directional communications between millions of IoT devices and a solution back end. If you have your own Platform-as-a-Service (PaaS), use an Intel device connected to Azure IoT Hub to complete the edge-to-cloud IoT Solution.  
    • IoT Edge Device: An IoT Edge is a smart device equipped with compute power and designed to execute services in the field.  
  3. Configure config.yaml for secure connection with connection string. 
  4. Restart the IoT Edge daemon. 
  5. Set module in Azure portal and then deploy. 

Once the above-mentioned steps are complete, the Edge device is ready to deploy IoT modules. The application comes with two sample deployment modules: 

  • SimulatedTemperature, an Azure Marketplace application. 
  • PeopleCounter, an OpenVINOTM toolkit reference application. 

Get Started 

Step 1: Install the Use Case

Select Configure & Download to download the use case and then follow the steps below to install it. 

Configure & Download 

During installation, you will be prompted to enter your product key. This key is in the email you would have received from the Intel® Registration Center. Contact Support Forum if you do not have this email message. 

The steps below explain how to: 

  • Prepare your target system. 
  • Copy the package. 
  • Complete the installation steps. 

Step 2: Prepare the Target System 

Make sure your target system has a fresh installation of Ubuntu, if you need help installing Ubuntu follow these steps: 

  1. Download the Ubuntu Desktop ISO file to your developer workstation. 

  1. Create a bootable flash drive using an imaging application, such as Startup Disk Creator, available on Ubuntu. 

  1. After flashing the USB drive, power off your target system, insert the USB drive, and power on the target system. 
    If the target system doesn't boot from the USB drive, change the boot priority in the system BIOS. 

  1. Follow the prompts to install Ubuntu with default configurations. For detailed instructions, see the Ubuntu guide

  1. Power down your target system and remove the USB drive. 

  1. Power up the target system. You will see Ubuntu Desktop is successfully installed. 

Step 3: Copy the connect_devices_to_azure_iot.zip File to the Target System 

In this step you copy the connect_devices_to_azure_iot to your Target System. 

1. Copy the connect_devices_to_azure_iot.zip file from the developer workstation to the Home directory on your target system. You can use a USB flash drive to copy the file. The icon looks like this: 

Step 4: Extract the Software 

In this step you extract connect_devices_to_azure_iot.zip. You need to be on the target system to complete these steps. 

  1. Make sure you have a working Internet connection. 

  1. Open a new terminal. 

  1. Extract the package: 
    unzip connect_devices_to_azure_iot.zip 

NOTE: If you download the connect_devices_to_azure_iot.zip more than once, each download beyond the first will be appended by a number. 

  1. (Optional) Use the link in the readme file to open this Get Started Guide on the target system for an easy way to copy and paste commands. 

Step 5: Install the connect_devices_to_azure_iot 

You will now run a script that will download components and install connect_devices_to_azure_iot on your target system. 

The software installation will take approximately 30 mins. The completion time depends on your target system and Internet connection. 

  1. Run these commands: 

    cd connect_devices_to_azure_iot / 
    
    chmod 775 edgesoftware 
    
    ./edgesoftware install 

     

  1. Type the product key at the prompt:

 

  1. Based on components selected and system configuration, you might be prompted for additional actions. For example, if your system is behind a proxy, you are asked to enter proxy settings. 
    When the installation is complete, you see the message Installation of package complete and the installation status of each module. 

 

NOTE: Versions for Intel® Distribution of OpenVINO™ toolkit will vary from what is shown above. 

4. After successful installation, a shortcut will be available on the Desktop. 

 

Step 6: Build People Counter Docker Image

In the next series of steps, you are going to build People Counter docker image. Once the image is created, it will be pushed into the Azure Container Registry.

1. For creating an Azure container registry, use the following link: Creating a container registry.

2. Go to ~/Desktop/Connect_Edge_Devices_to_Azure_IoT​/Cloud/People_Counter_App folder in your machine.

3. Build the People Counter docker images:

sudo docker build . -t <image URL>:<tag> 

[ Ex: docker build . -t  abc.azurecr.io/peoplecounter:1.0 ] 

     NOTE:
a. For creating image URL, you need login server details of your container registry. Go to Azure portal > container registry > choose your container registry > Access keys.  Make a note of 'Login Server' details to create image URL.
b. Image URL should correspond to your Azure container registry. For example, abc.azurecr.io/peoplecounter:1.0. Where abc.azurecr.io is the login server address of your container registry, peoplecounter is your repository and 1.0 is the image tag.
c. Make a note of your image URL for further steps.
d. Building Docker image will take 10-25 minutes depending on your internet connection speed.

 4. Login to your repository to pull the image:

sudo docker login -u <Azure CR username> -p <Azure CR password>  <Azure CR login>

NOTE: CR is the Container Registry.

Example: sudo docker login -u XXXXX -p XXXXXXXXXXXXXPb8l XXXXX.azurecr.io

5. Go to Azure portal > container registry > choose your container registry >  Access Keys. Enable Admin user and get the details of Container registry and please make a note of Username, password and Login server for further steps.

6. Push the application image to your Azure container registry:

sudo docker push <image URL>:<tag>

Example: sudo docker push abc.azurecr.io/peoplecounter:1.0

Step 7: Prepare the Deployment Manifest 

In the next series of steps, you prepare the deployment manifest file. Deployment manifest is used to configure and deploy modules to IoT Edge device from Azure IoT Hub/IoT Central. 

1. Go to ~/Desktop/Connect_Edge_Devices_to_Azure_IoT/Cloud/Deployment_Manifest in your target system and open the deployment.json file. 

2. Provide the People Counter Docker image URL (line no.8). 

Example: abc.azurecr.io/peoplecounter:1.0 

3. Replace container registry name (line no.32), login server (address: line no.33), password (line no.34) and username (line no.35) of your container registry created in previous step. 

NOTE:  Give full image url with tag. [ Example: abc.azurecr.io/peoplecounter:1.0

4. Go to Azure portal -> container registry -> choose your container registry ->   Access Keys. Get the details of container registry Username, login and password

5. Optional Steps: 

  • Change Video Source: Set the value of VIDEO_INPUT environment variable in line no. 20
Type Value Remark
Video FIle  /home/application1/resources/<video file> Make sure you have placed video file inside /application1/resources folder before building docker image.
USB Camera CAM Make sure physical camera is connected to system
RTSP Stream RTSP URL Example: rtsp://10.0.4.165:554/media/camera-300s.mkv

 

 

 

 

  • Change Inference Device: Set the value of DEVICE environment variable in line no. 23. Supported hardware devices are CPU, GPU, HDDL* and MYRIAD* 

NOTE: HDDL-R and MYRIAD are not tested and validated, so this may not work.  

  • Set Display Environment Variable: Value of DISPLAY environment variable (line no.17) of container should be same as that of host machine. 
  • Change Restart Policy:  Set restart policy (line no.13) of people counter module. Allowed values are always/never/on-failure/on-unhealthy.

Step 8: Start the Web UI

1. Navigate to Connect_Edge_Devices_to_Azure_IoT in the folder on the desktop and run the commands in terminal as shown below:

chmod 777 trigger.sh 

./trigger.sh

2. The application will start in the default browser and you will see the screen as shown below:

 

Step 9: Create a Microsoft Azure Account 

1. If you do not have a Microsoft Azure account, click on the sign-up link provided in the web page and create an account. 

2. If you do have an account, or after you have created an account, click Next to proceed and follow the below steps:

NOTE: Make sure your subscription is registered to “Microsoft.Devices”. Please follow this Azure link

 3. Follow as mentioned in the screen below: 

  

4. Copy the code from the terminal as shown below and proceed with the steps in the browser. 

5. After signing in, close the page and return to the Connect Edge Devices to Azure IoT page to proceed with Azure login.

6. Choose your platform: 

  • Follow Connect to Azure IoT Hub for IoT Hub. 
  • Follow Connect to Azure IoT Central for IoT Central. 

 


Connect to Azure IoT Hub

1. Choose IoT Hub. Click Next. If the root user has password then, go back to the terminal and enter the root user password. 

2. If you want to create a new resource group (RG), select Create new, or select Choose existing to proceed with an existing RG. 

3. To create an RG, enter an RG Name choose a region from the dropdown. Click Create.   

4. Enter an IoT Hub Name. Click Create

5. Enter an IoT Edge Device Name. Click Create

Your hardware is now configured with Resource group, IoT Hub and IoT Edge. A connection has been made between your hardware and Microsoft Azure.  

6. Click Exit to exit from the application or Next to proceed further to deploy a module. 

7. Select a module to deploy from the dropdown. Click Deploy

8. Once the module is deployed, follow the steps mentioned in the below screen to see the result in Azure shell. 

​Inference results on Edge device render onto display and you will see a screen like the below: 

NOTE: These are for CPU only. Performance is dependent on the generation of CPU. Overall performance will depend on the target hardware you choose. To offload CPU and run inference on iGPU or accelerator card, look for additional instructions. People counter application uses pedestrian-detection-adas-0002 from Intel® Distribution of OpenVINO™ toolkit zoo model for inference.   

Results in Azure shell will be like the screen below: 

 

Troubleshooting 

People Counter Module Failed 

People counter module with status failed after successful deployment. 

Try restarting people counter module by running command below: 

iotedge restart peopleCounter

If the people counter module is still failing, make sure of the following: 

  • Video source is working  
  • Inference device is enabled in the system 

Check the logs of container by running command below for details: 

lotedge logs peopleCounter

No Results in Azure Shell 

After deployment, if the module is in running state and if you are not able to see results in Azure shell. 

  • Reason: Your network would be blocking to send results to cloud. 
  • Solution: Connect to a different network and redeploy the module. 

Open Network Connection Failure 

When you are running the application in open network and after deployment, if you are unable to connect to https://shell.azure.com/.

  • Reason: Your account does not have access to login to Microsoft Azure from an open network. 
  • Solution: Use a different device that is connected to a required network to login to Microsoft Azure. 

Connect to Azure IoT Central

To create an Azure IoT Central, after the Getting Started section above, choose the Azure IoT Central Platform. Click Next. If the root user has a password, go back to the terminal and enter the root password.  

Step 1: Create Device Template 

This section will cover how to create a device template for People Counter application. In following steps, you are going to create a device template using provided DCM json file, create view for telemetry, upload deployment manifest and publish the device template. 

1. Go to IoT central application that you created in Step 1: Create IoT Central Application, then navigate to Device templates and choose +New

2. On the select template type page, choose the Azure IoT Edge tile. Then select Next:Customize

3. On the Upload an Azure IoT Edge deployment manifest page, provide a name to device template and select Next: Review

NOTE:
1. Skip uploading of deployment manifest file in this step
2. No need to select the check box for Gateway device with downstream devices

 

4. On Review page, select Create

5. Click on Import a model and upload the capability model People_Counter_DCM.json (Available inside ~/Desktop/Connect_Edge_Devices_to_Azure_IoT/Cloud/Device_Template folder). 

6. To create a view, click on ‘Views’ and choose ‘Visualizing the Device’

  • Under ‘Add a tile’ section, choose ‘Start with device’
  • For line graph: 
    • Choose ‘People Count’ under telemetry section.  
    • Click on Add tile and Save
  • For Last known value: 
    • Choose ‘People Count’ under telemetry section.  
    • Click on Add tile.  
    • On right panel, click on ‘Change Visualization’ icon and choose ‘Last Known Value’ from options. 
  • Click on Save button to save the views

7. Click on ’Edit manifest’ and choose the replace option to upload the deployment.json (Available inside ~/Desktop/Connect_Edge_Devices_to_Azure_IoT/Cloud/Deployment_Manifest folder). Click on Save to save the changes. 

8. Click on ‘publish’ tab on top right corner and click on ‘publish’ button to publish your device template. 

Step 2: Add Device to Template 

In the next series of steps, you are going to attach an edge device to published people counter device template.To add a new device to your template, follow the steps below: 

1. In your IoT Central Application, navigate to Devices page and choose the template you created in the previous step. 

2. Click on ‘+ New’ to add new device to template. 

3. Provide the required details and click Create. (Refer to the screenshot below). 

  • Make sure you choose the right device template from drop-down box. 
  • Give a display name to your Device.  
  • Provide a Device ID and make of note of Device ID. 
  • Do not enable ‘Simulate this device’ option. 

Step 3: Generate API Token 

In next series of steps, you are going to generate API token. API token is used to fetch device connection parameters.  Please make a note of API token.

1. In your IoT Central Application, navigate to Administration page and choose API tokens

2. Click on ‘+ Generate token’. 

3. Provide the required details and click on Generate.  

4. Provide Token name and choose the ‘Administrator’ role.

5. API token is generated. Please make sure you copy that token. 

Step 4: Get IoT Central APP Sub-Domain Name 

In next series of steps, you are going to get subdomain URL of your Azure IoT Central dashboard.

1. In your IoT Central Application, navigate to Administration page and choose Your application. 

2. Make a note of subdomain URL (first part of Application URL) to configure OOBE app. 

Step 5: Configure Out Of Box Experience (OOBE) Application  

Once you have completed steps above, please provide the details below to OOBE application as shown in the image and click Next. If the root user has a password, then go back to the terminal and enter the root user password. 

  • App Name: Your IoT Central Application sub-domain name. 
  • API Token: API token of your IoT Central application. 
  • Device ID: Device ID of device you attached to device template. 

Step 6: Monitor Data 

The people counter application is now deployed in edge machine. Once the ‘peopleCounter’ start running as edge module, please go to your IoT Central dashboard (Dashboard link will be available in OOBE web page) and navigate to your Device then click View tab to monitor data.

Azure IoT Central Dashboard View

Inference Results on Edge 

NOTE: These are for CPU only and performance is dependent on the generation of CPU. Overall performance will depend on the target hardware you choose. To offload CPU and run inference on iGPU or accelerator card, look for additional instructions.  

Troubleshooting 

People Counter Module Failed 

People counter module with status failed after successful deployment. 

Try restarting people counter module by running command below: 

iotedge restart peopleCounter

If the people counter module is still failing, make sure of the following: 

  • Video source is working  
  • Inference device is enabled in the system 

Check the logs of container by running command below for details: 

lotedge logs peopleCounter

No Results in Azure IoT Central Dashboard 

After deployment, if the module is in running state and if you are not able to view results in Azure IoT Central Dashboard. 

  • Reason: Your network is blocking to send results to cloud. 
  • Solution: Connect to a different network and redeploy the module. 

Additional Examples Using Azure IoT Central

Multi-Camera Detection of Social Distancing

In this section, you will create an Azure IoT Central dashboard for Multi-Camera Detection of Social Distancing, run standalone Python* code to fetch telemetry data from InfluxDB*, and send data to the Azure IoT Central dashboard for visualizing telemetry data. You can utilize the rest of the Azure IoT Central services to meet your needs. You will be able to run this application in both the Ubuntu* Linux* and Azure IoT Edge for Linux on Windows* (EFLOW) environments. 

Prerequisites

Before you continue, you must complete the following:

NOTE: You are not required to run the web app or any additional steps for the installation (i.e., you are just installing to access the scripts).

NOTE: These steps will result in building containers for the Linux environment. To build containers for the EFLOW environment, refer to the Deployment in Windows Environment section.

 

Deployment in Linux Environment 

 

Visualization in Grafana

To view the inference results in your local Grafana dashboard, follow the Visualize the Map UI on Grafana instructions in the Multi-Camera Detection of Social Distancing reference implementation. 

 
Visualization in Azure IoT Central

To view the inference results in the IoT Central dashboard, follow the Visualization in Azure IoT Central instructions later in this guide.
 

Deployment in Windows EFLOW Environment

Azure IoT Edge for Linux on Windows (EFLOW) works by running a Linux virtual machine on a Windows device. The Linux virtual machine comes pre-installed with the IoT Edge runtime. Any IoT Edge modules deployed to the device runs inside the virtual machine. Meanwhile, Windows applications running on the Windows host device can communicate with the modules running in the Linux virtual machine.

EFLOW enables users to run production Linux-based cloud-native workloads on Windows IoT device, while providing only server mode access to VM and no GUI support.

Prerequisites

 

Build Multi-Camera Detection of Social Distancing Docker Images

Since container images are not readily available for Multi-Camera Detection of Social Distancing, this section will provide details to create and upload the container images to Azure Container Registry. To make the Multi-Camera Detection of Social Distancing reference implementation’s containers work with Microsoft EFLOW, modify Docker file for Smart City container and build new Docker image as described below.

  1. Go to the reference implementation installation folder by executing the command: 
    cd <MCSD_INSTALL_PATH>/MultiCamera_Detection_of_Social_Distancing_<version>/Social_Distancing_Detection_for_Retail_Settings/mcss-covid19/app
  2. Copy the resource folder from <MCSD_install_path>/mcss-covid19/ folder to <MCSD_install_path>/mcss-covid19/app folder:
    cp -r ../resources/ .

     
  3. Open Dockerfile in text editor and make these changes:
    Add instructions to copy resource folder and configuration.env file: 
    COPY resources app/resources
    COPY configuration.env /app/configuration.env 
    After adding instructions, it should look similar to the following: 


     
  4. Disable display output window to make compatible with Microsoft EFLOW:  
    cd <MCSD_INSTALL_PATH>/MultiCamera_Detection_of_Social_Distancing_<version>/Social_Distancing_Detection_for_Retail_Settings/mcss-covid19/app/application/
    Open run.sh script in a text editor and add --no_show argument in CMD as shown below: 


    Once the changes are done, go to the app folder to build the Docker images:
    cd ..
  5. Build the updated Dockerfile using the below command:
    sudo docker build . -t mcss-covid19_solution:latest

 

Push Multi-Camera Detection of Social Distancing Docker Images to ACR

Follow the steps below to push Multi-Camera Detection of Social Distancing Docker images to ACR.


1. To create an Azure Container Registry (ACR), use the following link: Creating a container registry.
2. Go to Azure portal > container registry > choose your container registry > Access keys
    Enable Admin user, get the details of container registry and please make a note of username, password, and login server for further steps. 
3. Login to your Azure container registry: 

sudo docker login -u <ACR username> -p <ACR password> <ACR login server> 


4. Tag all Multi-Camera Detection of Social Distancing Docker images:

sudo docker tag mcss-covid19_solution:latest <ACR login server>/mcss-covid19_solution:latest
sudo docker tag mcss-covid19_grafana:latest <ACR login server>/mcss-covid19_grafana:latest 
sudo docker tag mcss-covid19_influxdb:latest <ACR login server>/mcss-covid19_influxdb:latest


5. Push all Multi-Camera Detection of Social Distancing Docker images to ACR:

sudo docker push <ACR login server>/mcss-covid19_solution:latest
sudo docker push <ACR login server>/mcss-covid19_grafana:latest
sudo docker push <ACR login server>/mcss-covid19_influxdb:latest 


If you have not done so already, install Connect Edge Devices to Azure* IoT (See Step 5: Install the connect_devices_to_azure_iot).

 

Build Connect Edge Devices to Azure IoT Docker Images

To make the Connect Edge Devices to Azure IoT work with Azure EFLOW, build it as container. 


1. Go to Connect_Edge_Devices_to_Azure_IoT folder in Desktop:

cd ~/Desktop/Connect_Edge_Devices_to_Azure_IoT 


2. Build Docker image:

sudo docker build . -t connect-edge-devices-to-azure-iot:latest 

 

Push Connect Edge Devices to Azure IoT Docker Images to ACR 

Follow the steps below to push Connect Edge Devices to Azure IoT Docker images to ACR.
1. Tag Connect Edge devices to Azure IoT container:

sudo docker tag connect-edge-devices-to-azure-iot:latest <ACR login server>/connect-edge-devices-to-azure-iot:latest 


2. Push the container to ACR:

sudo docker push <ACR login server>/connect-edge-devices-to-azure-iot:latest

 

Set Up Azure Resources for Deployment  

Before deploying the Multi-Camera Detection of Social Distancing Reference Implementation and Connect Edge devices to Azure IoT modules on EFLOW, you must complete the following steps. 

Create Azure IoT Hub

1. Follow the Create an IoT hub using the Azure portal instructions.
2. In your Azure Portal, go to your IoT Hub.
3. Under Automatic Device Management from the menu on the left, select IoT Edge.
4. Click on Add IoT Edge Device to create a new edge device for EFLOW VM. Provide a device ID and click the Save button.

5. Select the device ID of the target device you just created. Make a note of primary connection string for future reference.

 

Create Microsoft EFLOW device

To create an EFLOW device, follow the Microsoft installation guide
During the provisioning step, choose manual provisioning and provide the connection string of your IoT hub.

Deploy Reference solution in EFLOW

For deploying IoT modules which are pushed into ACR, follow the steps below.
1. Go to IoT device that is created in IoT hub in previous step, select the Module Settings tab.
2. On the container registry credential, provide the details of your Azure Container Registry that you have created in previous section. The username, password, and login server address can be found in your registry, under Settings in the Access keys section.
3. On the IoT Edge Modules, choose Add and select to add an IoT Edge Module. We need to add all the MCSS containers as IoT edge Module to IoT Edge Deployment to EFLOW VM. 

The edge modules listed below are added by referencing to MCSS RIs docker compose file along with Connect Edge devices to Azure IoT. 

Container Edge Module Name Startup Order Image URI
influx DB mcss-influxdb 1 As per docker image URI in ACR
grafana mcss-grafana 2 As per docker image URI in ACR
mcss-covid19 mcss-application 3 As per docker image URI in ACR
connect Edge Devices to Azure IoT connect_edge_devices_to_azure_iot 4 As per docker image URI in ACR

 

The dialog will look similar to: 

4. The mcss-application, influxdb, and grafana modules will need to have some more information under the Environment Variables and Container Create Options tabs:

  • The mcss-application container has several environment variables that need to be added for the container to run in the EFLOW environment. 
     
    Environment Variable Type Value
    display Text $DISPLAY
    DEVICE1 Text CPU
    PERSON_DETECTOR Text /intel/person-detection-retail-0013/FP32/person-detection-retail-0013.xml
    MODEL1_INPUT_HEIGHT Text 480
    MODEL1_INPUT_WIDTH Text 816
    WIDTH Text 1280
    HEIGHT Text 720
    NUM_THREADS Text 3
    START_QUEUE_SIZE Text 10
    NUM_SOURCES Text 1
    NUM_CHANNELS Text 2
    MIN_SOCIAL_DIST1 Text 80
    DECODE_DEVICE Text CPU
    INPUT_SOURCE1 Text /app/resources/Pexels Videos 2670.mp4
     


    After updating the environment variables in IoT Edge Module, the screen will look similar to: 

     

  • The mcss-application container will have port bindings and volume mount that need to be accessed by container. Update these settings as per the docker-compose.yml file under the Container Create Options.
    Refer to the code snippet and screenshot below for details. 

    Container Create Options

    {
        "NetworkingConfig": {
            "EndpointsConfig": {
                "host": {}
            }
        },
        "HostConfig": {
            "Devices": [
                {
                    "PathOnHost": "/dev/",
                    "PathInContainer": "/dev/",
                    "CgroupPermissions": "rwm"
                }
            ],
            "NetworkMode": "host",
            "Binds": [
                "/dev:/dev",
                "/var/tmp:/var/tmp"
            ]
        }
    } 


    After updating the above details, it should look similar to: 

  • The influxdb container has several environment variables that need to be added for the container to run in the EFLOW environment. 

    Environment Variable Type Value
    INFLUX_USER Text admin
    INFLUX_PASSWORD Text admin
    INFLUX_DB Text McssCovid
    INFLUXDB_HTTP_ENABLED Text true
      

    After updating the environment variables in IoT Edge Module, the screen will look similar to: 

    The influxdb container will have port bindings that need to be accessed by container. Update these settings as per the docker-compose.yml file under the Container Create Options.
    Refer to the code snippet and screenshot below for details. 

    Container Create Options

    {
        "HostConfig": {
            "PortBindings": {
                "8086/tcp": [
                    {
                        "HostPort": "8086"
                    }
                ]
            }
        }
    } 


    After updating the above details, it should look similar to: 

     

  • The grafana container has several environment variables that need to be added for the container to run in the EFLOW environment. 

    Environment Variable Type Value
    GF_SECURITY_ADMIN_USER Text admin
    GF_SECURITY_ADMIN_PASSWORD Text admin
      

    After updating the environment variables in IoT Edge Module, the screen will look similar to: 

    The grafana container will have port bindings that need to be accessed by container. Update these settings as per the docker-compose.yml file under the Container Create Options.
    Refer to the code snippet and screenshot below for details. 

    Container Create Options

    {
        "HostConfig": {
            "PortBindings": {
                "3000/tcp": [
                    {
                        "HostPort": "3000"
                    }
                ]
            }
        }
    } 


    After updating the above details, it should look similar to: 

5. Once validation is done, click on Create to deploy the modules in EFLOW.  

Monitoring Edge Device

Using Windows Admin Center

After successful setup/deployment of EFLOW, you can connect to your EFLOW VM from Windows Admin Center and see the status of your edge modules as shown below:

NOTE:  Make a note of the IP address for viewing Grafana Dashboard.

 

Using Windows PowerShell

  1. Connect to your EFLOW VM from windows machine by executing this command in PowerShell: 
    Connect-EflowVM

     

  2. Run the below command to see the deployed list of edge modules:

    sudo iotedge list


    You should see output similar to: 

     

  3. To check the logs of edge modules, execute the command:

    sudo iotedge logs <edge module name>

     

 

Visualization in Grafana

To view the inference results in your local Grafana dashboard, open a browser on the Windows machine that hosts the EFLOW VM and navigate to: <EFLOW VM IP address>:3000

  1. Log in with User as admin and password as admin.
  2. To get the data from influxDB, click on Settings icon from left panel > click data sources > click Mcss Covid
  3. Under HTTP section, update the URL to http://mcss-influxdb:8086 
  4. Under InfluxDB Details section, provide database as McssCovid.
  5. Click on Save and Test.
  6. Go to Home and select Multi Camera Covid19 solution to open the main dashboard. 

     

 

Visualization in Azure IoT Central 

This section contains instructions for both Linux and EFLOW. 

 

Step 1: Create Azure IoT Central Dashboard
  1. To create an Azure IoT Central dashboard, follow these instructions.
     

 

Step 2: Create Device Template
  1. To create a device template, follow these steps:
    • Go to the Azure IoT Central application that you created in step 1, then navigate to Device templates and choose +New.
    • On the Select template type page, choose the IoT Device tile. Then select Next: Customize
       
    • On the Customize page, provide a name for the device template and select Next: Review.
      NOTE: You do not need to select the check box for Gateway device with downstream devices.  
    • On the Review page, select Create.  
  2. Click on Import a model and upload the capability model MCSD_DCM.json
    The typical path is: ~/Desktop/Connect_Edge_Devices_to_Azure_IoT/MCSD_IoT_Central/
  3. To create an overall view, click Views and choose Visualizing the Device. Provide a View Name, for example, View-Overall and add the following tiles to the view. Click on Start with devices and choose telemetry names from the drop-down.    
     
    SI No. Telemetry Name Visualizing Panel Size 
    1 Total People Count Line Chart 2x2
    2 Total Social Distance Violation Line Chart 2x2
    3 Total People Count Heat Map 2x2
    4 Total Social Distance Violation Heat Map 2x2
    5 Total People Count, 
    Total Social Distance Violation
    Pie Chart 2x2
    6 Total People Count,
    Total Social Distance Violation
    Bar Chart 2x2
    7 Total People Count, 
    Total Social Distance Violation
    KPI 2x2
    8 Total People Count Last Known Value 2x1
    9 Total Social Distance Violation Last Known Value 2x1

     

     

     

     

     

     

     

     

     

     




     
  4. To create a channel-wise view, click Views and choose Visualizing the Device. Provide a View Name, for example, Channel View and add the following tiles to the view. Click on Start with devices and choose telemetry names from the drop-down. 
     
    SI No. Telemetry Name Visualizing Panel Size 
    1 People Count - Channel 01 Last Known Value 2x2
    2 People Count - Channel 02 Last Known Value 2x2
    3 Social Distance Violation - Channel 01 Last Known Value 3x2
    4 Social Distance Violation - Channel 02 Last Known Value 3x2
    5 People Count - Channel 01,
    Social Distance Violation - Channel 01
    Pie Chart 2x2
    6 People Count - Channel 02,
    Social Distance Violation - Channel 02
    Pie Chart 2x2
    7 People Count - Channel 01,
    People Count - Channel 02
    Bar Chart 2x2
    8 Social Distance Violation - Channel 01,
    Social Distance Violation - Channel 02
    Bar Chart 2x2


     

     

     

     

     

     

     

     

     

     

     





     
  5. Click Publish on the top panel. When prompted, click the Publish button to publish your device template.

 

Step 3: Add Device to Device Template 

In the next series of steps, you will attach an edge device to your published Multi-Cam device template.

  1. In your Azure IoT Central application, navigate to the Devices page and choose the template you created in the previous step.
  2. Click on + New to add the new device to the template.
  3. Provide the required details and click Create (refer to the screenshot below). 
    • Make sure you choose the right device template from the drop-down box.
    • Give a display name to your device. 
    • Provide a device ID. 
    • Do not enable the Simulate this device option.

 

Step 4: Get Device Connection Parameters

In the next series of steps, you will view device connection parameters of the Azure IoT Central device.

  1. On the Device page, select the device you created in the previous step.
  2. Select Connect.
  3. Make a note of the ID Scope, Device ID, and Primary Key values. 

     
Step 5: Run Program to Connect to Azure Dashboard

This section describes how to run a program that fetches data from the InfluxDB and sends the data to the Azure IoT Central dashboard. There are different steps for Linux and for EFLOW.

 

Step 5.1: Run Program on Linux

  1. Go to the MCSD_IoT_Central directory: 
    cd ~/Desktop/Connect_Edge_Devices_to_Azure_IoT/MCSD_IoT_Central/
  2. Enter the command below using the parameters from the previous step. 
    chmod +x connect.sh
    ./connect.sh -s <ID SCOPE> -d <DEVICE ID> -k <PRIMARY KEY> 

    You will see output simillar to: 

 

NOTE: Use device Scope ID, Device ID and Primary Key obtained from the previous step. 
You can run the reference implementation in parallel to send live data.  
The same script can be used with similar reference implementations for sending data from InfluxDB to Azure IoT central with slight modifications in Python script and device template.

 

Step 5.2: Run Program on EFLOW

  1. Go to the connect_edge_devices_to_azure_iot module in IoT hub that was created in the previous section.
    {
        "CMD": [
            "python3","Connect_Edge_Devices_to_Azure_IoT/MCSD_IoT_Central/send_telemetry.py",
            "-s",
            "<SCOPE ID>",
            "-d",
            "<DEVICE ID>",
            "-k",
            "<PRIMARY KEY>",
            "-o",
            "eflow"
        ]
    } 

    After updating the details above, it should look similar to: 



     

  2. After adding all the required modules, click on Review + Create to proceed to the validation page.


     

  3. Once validation is done, click on Create to deploy the modules in EFLOW.

 

Step 6: Monitor Data in Azure IoT Central Dashboard

In the following series of steps, you will monitor data exported to your Azure IoT Central dashboard.

  1. Go to your Azure IoT Central dashboard. 
  2. Navigate to Devices and choose the device template you created for Multi-Camera.
     
  3. Click your device, then click the View-Channel tab to display channel-wise telemetry data in the dashboard as shown in the following image:
  4. Click the View-Overall tab to display overall telemetry data in the dashboard as shown in the following image: 


 

Rotor Bearing Defect Detector Reference Implementation

In this section, you will create an Azure IoT Central dashboard for a reference implementation, run standalone Python code to fetch telemetry data from InfluxDB, and send data to the Azure IoT Central dashboard for visualizing telemetry data.  You will also find steps to perform Analytics, set up Azure Event Hub, and visualize vibration data using Time Series Insights. You can utilize the rest of the Azure IoT Central services to meet your needs. 

Prerequisites

Before you continue, you must complete the following:

1. Stop below services if it’s running in system: 

IoT Edge Daemon: 

sudo systemctl stop iotedge

InfluxDB: 

sudo systemctl stop influxd

Mosquitto* MQTT broker: 

sudo systemctl stop mosquitto

Grafana*:  

sudo systemctl stop grafana-server

2. If you have not done so already, install Connect Edge Device to Azure* IoT (See Step 5: Install the connect_devices_to_azure_iot).  

NOTE: You are not required to run the web app or any additional steps for the installation (i.e., you are just installing to access the scripts).

3. Complete the steps to install and run the Rotor Bearing Defect Detector reference implementation. 

Development Mode

NOTE: These instructions can also be found in the Rotor Bearing Defect Detector Documenation in the Customize Application section.  

By default, the application starts to run in Production Mode when the package installation is completed. If you run into any issues in Production Mode, follow the instructions below to change to Development Mode. After successfully installing the reference implementation, follow the steps below to run the application in Development Mode:

1. To switch to Development mode, navigate to the Edge Insights for Industrial /build directory: 

cd <install_directory>/Rotor_Bearing_Defect_Detector_<version>/IEdgeInsights/build

2. Follow below steps to edit .env file: 

vim .env

3. Go to line no.26 and change value of DEV_MODE=true

NOTE:  Edge Insights for Industrial (EII) software package was previously named Edge Insights Software (EIS) and some screenshots may still refer to EIS.  


 

4. Save the file. 

5. Run the following commands to customize the application.

python3.6 eis_builder.py -f time-series.yml
cd provision
sudo ./provision_eis.sh ../docker-compose.yml
cd ..
docker-compose build
docker run --rm -d -p 1883:1883 --name mosquitto_1883 trafex/alpine-mosquitto
docker-compose up

NOTE: If you run into any permission issues while executing Docker commands, execute the commands above as root user. 

NOTE: If executing command to start Mosquitto container results in container name conflict error, please run the command below and try again:  

sudo docker stop $(sudo docker ps -q --filter expose=1883)

Step 1: Create Azure IoT Central Dashboard

To create an Azure IoT Central dashboard, follow these instructions. (Skip this step if you already have an IoT Central Application).
 

 

Step 2: Create Device Template

  1. To create a device template, follow these steps:
    • Go to the Azure IoT Central application that you created in step 1, then navigate to Device templates and choose +New.
    • On the Select template type page, choose the IoT Device tile. Then select Next: Customize

 

2. On the Customize page, provide a name for the device template and select Next: Review.
NOTE: You do not need to select the check box for Gateway device with downstream devices.  

3. On the Review page, select Create.  

4. Click on Import a model and upload the capability model RBD_DCM.json
The typical path is: ~/Desktop/Connect_Edge_Devices_to_Azure_IoT/RBD_IoT_Central/

5. To create a channel-wise view, click Views and choose Visualizing the Device. Add the following tiles to the view. Click on Start with devices and choose telemetry names from the drop-down.  

SI No. Telemetry Name Visualizing Panel Size
1 Vibration Signal Line Chart 3x3
2 Inference Result Last Known Value 2x1
3 Inference Result Pie chart 2x2
4 Inference Index Line Chart** 2x2


 

 

 

 

 

** Select Display Range as ‘last 100 value' in chart configure options.

6. Click Publish on the top panel. When prompted, click the Publish button to publish your device template.

Step 3: Add Device to Device Template

  1. In your Azure IoT Central application, navigate to the Devices page and choose the template you created in the previous step.
  2. Click on + New to add the new device to the template.
  3. Provide the required details and click Create (refer to the screenshot below). 
  • Make sure you choose the right device template from the drop-down box.
  • Give a display name to your device. 
  • Provide a device ID. 
  • Do not enable the Simulate this device option.

 

Step 4: Get Device Connection Parameters

  1. View and record the device connection parameters of the Azure IoT Central device.
  2. On the Device page, select the device you created in the previous step.
  3. Select Connect.
  4. Make a note of the ID Scope, Device ID, and Primary Key values. 


 

Step 5: Run Program to Connect to Azure Dashboard

Run a program that fetches data from the InfluxDB and sends the data to the Azure IoT Central dashboard. 

1. Go to the RBD_IoT_Central directory: 

cd ~/Desktop/Connect_Edge_Devices_to_Azure_IoT/RBD_IoT_Central/

2. Enter the command below using the parameters from the previous step. 

chmod +x connect.sh 
./connect.sh -s <SCOPE ID> -d <DEVICE ID> -k <PRIMARY KEY> -m <true/false> 

3. Please use device Scope ID, Device ID and Primary Key obtained from previous step. Pass the value of argument ‘m’ per the table below:

RBD RI Installation Mode Value
Development Mode true (default)
Production Mode false

 

 

 

NOTE: You can run the reference implementation in parallel to send live data.  
The same script can be used with similar reference implemenations for sending data from InfluxDB to Azure IoT Central with slight modifications in Python script and device template. 

 

Step 6: Monitor Data in Azure IoT Central Dashboard

1. Go to your Azure IoT Central dashboard. 

2. Navigate to Devices and choose the device template you created for RBD.

3. Click your device, then click the View tab to display channel-wise telemetry data in the dashboard as shown in the following image. The Inference Result displays the current condition based on the vibration data.

 

 

 

 

Step 7: Data Analytics in Azure IoT Central Dashboard  

In following series of steps, you will use analytics to analyze device data. 

  1. Go to your Azure IoT Central dashboard.  
  2. Navigate to Analytics.  
  3. Choose the device group (RBD device template name) from drop down list that contains devices you want to analyze. 
  4. Under telemetry section, choose one of the telemetry (Vibration Signal/Inference Result/Inference Index) from dropdown list.
  5. Click on Analyze

Connect to Azure Time Series Insight 

In following series of steps, you are going to export device data to Azure Time Series Insight.  

Step 1: Create Azure Event Hub  

You can configure an Azure IoT Central application to continuously export telemetry to an event hub. In this section, you create an event hub to receive telemetry from your Azure IoT Central application.  

  1. To create an Azure Event Hub namespace, please follow the instructions (Only create event hub namespace) at Create an Event Hubs Namespace
  2. In the Azure portal, navigate to your Event Hubs namespace and select + Event Hub
  3. Name your event hub rbd-hub. 
  4. In the list of event hubs in your namespace, select rbd-hub.  
  5. Then choose Shared access policies
  6. Select + Add. Create a policy named rbdPolicy with the Manage claims. 
  7. When the policy is ready, select it in the list, and then copy the Connection string-primary key value. 
  8. Make a note of this connection string; you use it later when you export data from Azure IoT Central. 

Step 2: Exporting Data to Event Hub 

In following series of steps, you will use analytics to analyze device data. 

1. Navigate to the Data export page, then select Destinations

2. Select + New destination

3. Use the values in the following table to create a destination: 

Settings  Value 
Destination name  RBD Event Hub
Destination type  Azure Event Hubs 
Connection string  The event hub connection string you made a note of previously 

4. Select Save.

5. To create the export definition: 

  • Navigate to the Data export page and select + New Export
  • Use the values in the following table to configure the export: 
Settings  Value 
Export Name  RBD Event Hub Export 
Enabled  On 
Type of data to export 

Choose Telemetry and then select +Filter and select below values: 

  • Name: Device Template 
  • Operator: Equals
  • Value: Choose Rotor Bearing Defect Detector device template from the dropdown list. 
Destinations  Select +Destination, then select RBD Event Hub 

 

6. Select Save

Step 3: Create a Time Series Insight Environment 

Follow these steps to create an environment: 

  1. Sign in to the Azure portal. 
  2. Click on Create a resource.
  3. Type Time Series Insights in the Search box and press Enter, then click on Create button. 
  4. In the Subscription dropdown, you should already have one subscription selected. 
  5. In the Resource group dropdown, select the resource group. 
  6. In the Environment name field, specify a unique name. 
  7. In the Location dropdown, select the location closest to you. 
  8. In the Tier dropdown, select Gen 1(S1) to use Time Series Insights V1. 
  9. Click on Next: Event Source. 

We'll now configure the data source used by Time Series Insights to populate the database. On Event Source tab of the Create Time Series Insights environment, do the following: 

  1. In the Source type selector, Select Event Hub
  2. In the Name field, type a unique name. 
  3. In the Subscription dropdown, leave the default Subscription. 
  4. In the Event Hub namespace dropdown, select the Event Hub namespace created at the previous step  
  5. In the Event Hub name dropdown, select the Event Hub created at the previous step (rbd_hub). 
  6. In the Event Hub access policy name dropdown, select rbdPolicy
  7. In the Event Hub consumer group dropdown, Click on Add and provide a new to consumer group. 
  8. Click on Review + Create

Deployment of Time Series Insights will take a couple of minutes to complete. 

Step 4: Monitoring Data in Time Series Insights Explorer 

1. In the search box at the top of the portal, type Time Series Insights and click on the appropriate result in the Services category. 

2. Click on the name of your Time Series Insights environment you've created in the previous unit. 

3. In the Time Series Insights page, click on Go to TSI Explorer button at the top. Your browser will now open a new window with Time Series Insights main page. 

4. In Explorer dashboard, navigate to Analyze tab and enable Auto Refresh.  

5. Click on Add new query.  

6. In Measure dropdown, select telemetry.vibration or telemetry.index. Now your time series data will start getting populated in dashboard.

Intelligent Traffic Management Reference Implementation

In this section, you will create an Azure IoT Central dashboard for the Intelligent Traffic Management reference implementation, run standalone Python code to fetch telemetry data from InfluxDB, and send data to the Azure IoT Central dashboard for visualizing telemetry data. You can utilize the rest of the Azure IoT Central services to meet your needs. You will be able to run this application in both the Ubuntu* Linux* and Azure IoT Edge for Linux on Windows* (EFLOW) environments.

 

Prerequisites

Before you continue, you must complete the following:

NOTE: You are not required to run the web app or any additional steps for the installation (i.e., you are just installing to access the scripts).

NOTE: These steps will result in building containers for the Linux environment. To build containers for the EFLOW environment, refer to the Deployment in Windows Environment section.

 

Deployment in Linux Environment

 

Visualization in Grafana

To view the inference results in your local Grafana dashboard, follow the Visualize the Map UI on Grafana instructions in the Intelligent Traffic Management Reference Implementation

 
Visualization in Azure IoT Central

To view the inference results in the IoT Central dashboard, follow the Visualization in Azure IoT Central instructions later in this guide.
 

Deployment in Windows EFLOW Environment

Azure IoT Edge for Linux on Windows (EFLOW) works by running a Linux virtual machine on a Windows device. The Linux virtual machine comes pre-installed with the IoT Edge runtime. Any IoT Edge modules deployed to the device runs inside the virtual machine. Meanwhile, Windows applications running on the Windows host device can communicate with the modules running in the Linux virtual machine.

EFLOW enables users to run production Linux-based cloud-native workloads on Windows IoT device, while providing only server mode access to VM and no GUI support.

Prerequisites

 

Build Intelligent Traffic Management Docker Images

Since container images are not readily available for Intelligent Traffic management, this section will provide details to create and upload the container images to Azure Container Registry. To make the Intelligent Traffic Management reference implementation’s containers work with Microsoft EFLOW, modify Docker file for Smart City container and build new Docker image as described below.

1. Go to the reference implementation installation folder by executing the command:

cd Intelligent_Traffic_Management_<version>/Intelligent_Traffic_Management/intelligent-traffic-management


2. Open Dockerfile in text editor and make these changes:

  • Add instructions to copy resource folder and camera_config.json file: 
    COPY resources /resources
    COPY camera_config.json /camera_config.json 

     

  • Pass the value of Grafana port argument (g_port) as 3000: 
    -g_port 3000 

    After adding instructions, it should look similar to the following: 

3. To build the Docker images for Intelligent Traffic Management containers, run the command: 

sudo -E docker-compose build

 

Push Intelligent Traffic Management Docker Images to ACR

Follow the steps below to push Intelligent Traffic Management Docker images to ACR.


1. To create an Azure Container Registry (ACR), use the following link: Creating a container registry.
2. Go to Azure portal > container registry > choose your container registry > Access keys
    Enable Admin user, get the details of container registry and please make a note of username, password, and login server for further steps. 
3. Login to your Azure container registry: 

sudo docker login -u <ACR username> -p <ACR password> <ACR login server> 


4. Tag all Intelligent Traffic Management Docker images:

sudo docker tag intelligent-traffic-management_smartcity:latest <ACR login server>/intelligent-traffic-management_smartcity:latest
sudo docker tag intelligent-traffic-management_grafana:latest <ACR login server>/intelligent-traffic-management_grafana:latest


5. Push all Intelligent Traffic Management Docker images to ACR:

sudo docker push <ACR login server>/intelligent-traffic-management_smartcity:latest
sudo docker push <ACR login server>/intelligent-traffic-management_grafana:latest


If you have not done so already, install Connect Edge Devices to Azure* IoT (See Step 5: Install the connect_devices_to_azure_iot).

 

Build Connect Edge Devices to Azure IoT Docker Images

To make the Connect Edge Devices to Azure IoT work with Azure EFLOW, build it as container. 


1. Go to Connect_Edge_Devices_to_Azure_IoT folder in Desktop:

cd ~/Desktop/Connect_Edge_Devices_to_Azure_IoT 


2. Build Docker image:

sudo docker build . -t connect-edge-devices-to-azure-iot:latest 

 

Push Connect Edge Devices to Azure IoT Docker Images to ACR 

Follow the steps below to push Connect Edge Devices to Azure IoT docker images to ACR.
1. Tag Connect Edge devices to Azure IoT container:

sudo docker tag connect-edge-devices-to-azure-iot:latest <ACR login server>/connect-edge-devices-to-azure-iot:latest 


2. Push the container to ACR:

sudo docker push <ACR login server>/connect-edge-devices-to-azure-iot:latest

 

Set Up Azure Resources for Deployment

Before deploying the Intelligent Traffic Management Reference Implementation and Connect Edge devices to Azure IoT modules on EFLOW, you must complete the following steps. 

 

Create Azure IoT Hub

1. Follow the Create an IoT hub using the Azure portal instructions.
2. In your Azure Portal, go to your IoT Hub.
3. Under Automatic Device Management from the menu on the left, select IoT Edge.
4. Click on Add IoT Edge Device to create a new edge device for EFLOW VM. Provide a device ID and click the Save button.

5. Select the device ID of the target device you just created. Make a note of primary connection string for future reference.

 

Create Microsoft EFLOW device

To create an EFLOW device, follow the Microsoft installation guide
During the provisioning step, choose manual provisioning and provide the connection string of your IoT hub.

Deploy Reference solution in EFLOW

For deploying IoT modules which are pushed into ACR, follow the steps below.
1. Go to IoT device that is created in IoT hub in previous step, select the Module Settings tab.
2. On the container registry credential, provide the details of your Azure Container Registry that you have created in previous section. The username, password, and login server address can be found in your registry, under Settings in the Access keys section.
3. On the IoT Edge Modules, choose Add and select to add an IoT Edge Module. We need to add all the ITM containers as IoT edge Module to IoT Edge Deployment to EFLOW VM. 

The edge modules listed below are added by referencing to ITM RIs docker compose file along with Connect Edge devices to Azure IoT. 

Container Edge Module Name Startup Order Image URI
Influx DB itm_influxdb 1 influxdb:1.7
Grafana itm_grafana 2 As per docker image URI in AZCR
Smart City itm_smartcity 3 As per docker image URI in AZCR
Connect Edge Devices to Azure IoT connect_edge_devices_to_azure_iot 4 As per docker image URI in AZCR

 

The dialog will look similar to: 

4. The Smart City and Grafana modules will need to have some more information under the Environment Variables and Container Create Options tabs:

  • The Smart City container has several environment variables that need to be added for the container to run in the EFLOW environment. 
     
    Environment Variable Value
    HOST_IP <EFLOW VM IP>
    GRAFANA_HOST itm_grafana
    INFLUXDB_HOST itm_influxdb
    LOCAL_HOST 0.0.0.0


    NOTE: In EFLOW environment (after creating EFLOW VM), use Windows PowerShell to execute the command below to get the EFLOW VM IP address: 

    Get-EflowVMAddr


    After updating the environment variables in IoT Edge Module, the screen will look similar to: 


     

  • The Smart City and Grafana containers will both have port bindings and volume mount that need to be accessed by container (information in the docker-compose.yml file) as shown below:



    Update these settings as per the docker-compose.yml file under the Container Create Options.
    Refer to the code snippets and screenshots below for details. 

    itm_smartcity Container Create Options

    {
        "HostConfig": {
            "Devices": [
                {
                    "PathOnHost": "/dev/",
                    "PathInContainer": "/dev/",
                    "CgroupPermissions": "rwm"
                }
            ],
            "NetworkHost": "host",
            "PortBindings": {
                "5000/tcp": [
                    {
                        "HostPort": "5000"
                    }
                ]
            },
            "Binds": [
                "/dev:/dev",
                "/var/tmp:/var/tmp"
            ]
        }
    }


    After updating the above details, it should look similar to: 


    itm_grafana Container Create Options

    {
        "HostConfig": {
            "PortBindings": {
                "3000/tcp": [
                    {
                        "HostPort": "3222"
                    }
                ]
            }
        }
    } 

    After updating the above details, it should look similar to: 

5. Once validation is done, click on Create to deploy the modules in EFLOW.

Monitoring Edge Device

Using Windows Admin Center

After successful setup/deployment of EFLOW, you can connect to your EFLOW VM from Windows Admin Center and see the status of your edge modules as shown below:

NOTE:  Make a note of the IP address for viewing Grafana Dashboard.

 

Using Windows PowerShell

  1. Connect to your EFLOW VM from windows machine by executing this command in PowerShell: 
    Connect-EflowVM

     

  2. Run the below command to see the deployed list of edge modules:

    sudo iotedge list


    You should see output similar to: 

     

  3. To check the logs of edge modules, execute the command:

    sudo iotedge logs <edge module name>

     

 

Visualization in Grafana

To view the inference results in your local Grafana dashboard, open a browser on the Windows machine that hosts the EFLOW VM and navigate to: <EFLOW VM IP address>:3222

  1. Log in with User as admin and password as admin.
  2. Click on Home and select ITM to open the main dashboard.

 

Visualization in Azure IoT Central 

This section contains instructions for both Linux and EFLOW. 

Step 1: Create Azure IoT Central Dashboard

To create an Azure IoT Central dashboard, follow these instructions.
 

 

Step 2: Create Device Template

To create a device template, follow these steps:

1. Go to the Azure IoT Central application that you created in step 1, then navigate to Device templates and choose +New.

2. On the Select template type page, choose the IoT Device tile. Then select Next: Customize
 

3. On the Customize page, provide a name for the device template and select Next: Review.
NOTE: You do not need to select the check box for Gateway device with downstream devices.  

4. On the Review page, select Create.
  

5. Click on Import a model and upload the capability model ITM_DCM.json
The typical path is: ~/Desktop/Connect_Edge_Devices_to_Azure_IoT/ITM_IoT_Central/


 

6. To create an overall view, click Views and choose Visualizing the Device. Provide a View Name, for example, View-Overall and add the following tiles to the view:   

SI No. Title Name Telemetry Name Visualizing Panel Size
1 Total Vehicle Count Total Car Count Last Known Value* 2x1
2 Total Bicycle Count Total Bicycle Count Last Known Value* 2x1
3 Total People Count Total People Count Last Known Value* 2x1
4 Total Collision Count Total Collision Count Last Known Value* 2x2
5 Traffic Analysis

Total Car Count
Total Bicycle Count
Total People Count
Total Collision Count

Pie Chart 2x2
6 Total Collision Chart Total Collision Count Line Chart** 2x2
7 Traffic Flow

Total Car Count
Total Bicycle Count
Total People Count

Line Chart** 2x2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

* Disable the ‘Abbreviate values’ option in configure options. 

** Select Display Range as ‘last 100 value’ in chart configure options. 

 

The view will be similar to: 

 

7. To create a channel-wise view, click Views and choose Visualizing the Device. Provide a View Name, for example, View-ChannelWise and add the following tiles to the view: 
 

SI No. Title Name Telemetry Name Visualizing Panel Size
1 Channel 0

Channel 0 / Bicycle Count 
Channel 0 / Car Count 
Channel 0 / People Count 

Pie Chart 2x2
2 Channel 1

Channel 1 / Bicycle Count 
Channel 1 / Car Count 
Channel 1 / People Count 

Pie Chart 2x2
3 Channel 2

Channel 2 / Bicycle Count 
Channel 2 / Car Count 
Channel 2 / People Count 

Pie Chart 2x2
4 Channel 3

Channel 3 / Bicycle Count 
Channel 3 / Car Count 
Channel 3 / People Count

Pie Chart 2x2
5 Channel 4

Channel 4 / Bicycle Count 
Channel 4 / Car Count 
Channel 4 / People Count

Pie Chart 3x2
6 Channel 5

Channel 5 / Bicycle Count 
Channel 5 / Car Count 
Channel 5 / People Count

Pie Chart 3x2
7 Channel 6

Channel 6 / Bicycle Count 
Channel 6 / Car Count 
Channel 6 / People Count 

Pie Chart 3x2
8 Channel 7

Channel 7 / Bicycle Count 
Channel 7 / Car Count 
Channel 7 / People Count 

Pie Chart 3x2
9 Channel 8

Channel 8 / Bicycle Count 
Channel 8 / Car Count 
Channel 8 / People Count 

Pie Chart 2x2


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The view will be similar to:  

8. To create a channel wise view, click on ‘Views’ and choose ‘Visualizing the Device’.  Provide a View Name, for example ‘C. Collision View’ and add following tiles to the view:

 

I No. Title Name Telemetry Name Visualizing Panel Size
1 Channel 0

Collision – Channel 0, 
Near Miss – Channel 0 

Bar Chart 2x2
2 Channel 2

Collision – Channel 2, 
Near Miss – Channel 2

Bar Chart 2x2
3 Channel 6

Collision – Channel 6, 
Near Miss – Channel 6 

Bar Chart 2x2
4 Channel 7

Collision – Channel 7, 
Near Miss – Channel 7

Bar Chart 2x2
5 Collision Event

Collision Event

Last Known Value 3x2
6 near Miss

Near Miss – Channel 0, 
Near Miss – Channel 2, 
Near Miss – Channel 6, 
Near Miss – Channel 7 

KPI 3x2
7 Collision Chart

Collision – Channel 0, 
Collision – Channel 2, 
Collision – Channel 6, 
Collision – Channel 7 

Line Chart** 3x2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

** Select Display Range as ‘last 100 value’ in chart configure options.

 

The view will be similar to:  

9. Click on ‘publish’ on top panel when prompted. Click on the ‘publish’ button to publish your device template. 

 

Step 3: Add Device to Device Template
  1. In your Azure IoT Central application, navigate to the Devices page and choose the template you created in the previous step.
  2. Click on + New to add the new device to the template.
  3. Provide the required details and click Create (refer to the screenshot below). 
  4. Make sure you choose the right device template from the drop-down box.
  5. Give a display name to your device. 
  6. Provide a device ID. 
  7. Do not enable the Simulate this device option.

 

Step 4: Get Device Connection Parameters

View and record the device connection parameters of the Azure IoT Central device.

  1. On the Device page, select the device you created in the previous step.
  2. Select Connect.
  3. Make a note of the ID Scope, Device ID, and Primary Key values. 


 

Step 5: Run Program to Connect to Azure Dashboard

This section describes how to run a program that fetches data from the InfluxDB and sends the data to the Azure IoT Central dashboard. There are different steps for Linux and for EFLOW. 

 

Step 5.1 Run Program on Linux

1. Go to the ITM_IoT_Central directory: 

cd ~/Desktop/Connect_Edge_Devices_to_Azure_IoT/ITM_IoT_Central/


2. Enter the command below using the parameters from the previous step. 

chmod +x connect.sh
./connect.sh -s <ID SCOPE> -d <DEVICE ID> -k <PRIMARY KEY> 

   You will see output similar to: 

NOTE: Use device Scope ID, Device ID and Primary Key obtained from the previous step. 
You can run the reference implementation in parallel to send live data.  
The same script can be used with similar RIs for sending data from InfluxDB to Azure IoT Central with slight modifications in Python script and device template. 

 

Step 5.2 Run Program on EFLOW

1. Go to the connect_edge_devices_to_azure_iot module in IoT hub that was created in the previous section.

{
    "CMD": [
        "python3",
        "Connect_Edge_Devices_to_Azure_IoT/ITM_IoT_Central/send_telemetry.py",
        "-s",
        "<SCOPE ID>",
        "-d",
        "<DEVICE ID>",
        "-k",
        "<PRIMARY KEY>",
        "-o",
        "eflow"
    ]
}

After updating the above details, it should look similar to the following:

2. After adding all the required modules, click on Review + Create to proceed to the validation page.

3. Once validation is done, click on Create to deploy the modules in EFLOW.

 

Step 6: Monitor Data in Azure IoT Central Dashboard

1. Go to your Azure IoT Central dashboard. 

2. Navigate to Devices and choose the device template you created for Intelligent Traffic Management.

3. Click your device, then click on different tabs to view telemetry data in dashboards as shown in the following images:

  • Overall View

     

 

  • Channel View

     

 

  • Collision View

     

 

 

Automated Checkout Reference Implementation

In this section, you will create an Azure IoT Central dashboard for the Automated Checkout reference implementation, run standalone Python code to fetch telemetry data using REST API client, and send data to the Azure IoT Central dashboard for visualizing telemetry data. You can utilize the rest of the Azure IoT Central services to meet your needs. You will be able to run this application in both the Ubuntu* Linux* and Azure IoT Edge for Linux on Windows* (EFLOW) environments.

 

Prerequisites

Before you continue, you must complete the following:

  • Complete the steps to install and run the Automated Checkout reference implementation. 

NOTE: These steps will result in building containers for the Linux environment. To build containers for the EFLOW environment, refer to the Deployment in Windows Environment section.

NOTE: You are not required to run the web app or any additional steps for the installation (i.e., you are just installing to access the scripts).

 

Deployment in Linux Environment 

This section provides details on running the Automated Checkout RI in the Linux environment and two methods of visualization.

NOTE: Be sure you complete the Prerequisites described above.

 

Start the Automated Checkout RI

Follow the steps from the below documentation to build and start the Automated Checkout RI:

 
Visualization of Cooler

For visualization purposes, the Automated checkout serves the post-processed images over http. Open http://127.0.0.1:9005 on a web browser to observe how products are being added or removed from the cooler.

 

Visualization in Azure IoT Central

To view the inference results in the IoT Central dashboard, follow the Visualization in Azure IoT Central instructions later in this guide.

 

Deployment in Windows EFLOW Environment

Azure IoT Edge for Linux on Windows (EFLOW) works by running a Linux virtual machine on a Windows device. The Linux virtual machine comes pre-installed with the IoT Edge runtime. Any IoT Edge modules deployed to the device runs inside the virtual machine. Meanwhile, Windows applications running on the Windows host device can communicate with the modules running in the Linux virtual machine.

EFLOW enables users to run production Linux-based cloud-native workloads on Windows IoT device, while providing only server mode access to VM and no GUI support.

Prerequisites

 

Build Automated Checkout Docker Images

Since some container images are not readily available for Automated Checkout, this section will provide details to create and upload the container images to Azure Container Registry. To make the Automated Checkout reference implementation work with Microsoft EFLOW, two container images need to be modified.

  1. Go to the reference implementation installation folder by executing the command: 
    cd Automated_Checkout_<version>/Automated_Checkout/automated-checkout
  2. Run the command below to build the automated checkout services and create local Docker images:
    NOTE: This step can be skipped if the Automated Checkout RI images are built and already available.
    sudo make build 
  3. Create custom mqtt dockerfiles:
    NOTE: In the Automated Checkout RI, the edgex-device-mqtt and mqtt-broker Docker containers are mounting configuration files from the host machine filesystem at run time. For these containers to work on EFLOW, you must rebuild the images with the configuration files copied inside the image itself. 
    • Create a file named dockerfile.mqtt in the Automated_Checkout_<version>/Automated_Checkout/automated-checkout directory with the below content:
      FROM eclipse-mosquitto:1.6.3
      COPY res/mqtt/mosquitto.conf /mosquitto/config/mosquitto.conf
      CMD ["/usr/sbin/mosquitto", "-c", "/mosquitto/config/mosquitto.conf"] 
    • Create a file named dockerfile.edgex-mqtt in the Automated_Checkout_<version>/Automated_Checkout/automated-checkout directory with the below content
      FROM edgexfoundry/docker-device-mqtt-go:1.2.0
      COPY res/device-mqtt /res 

       
  4. To build the mqtt docker images for the dockerfile created above, run the below commands:
    sudo docker build -t edgex-device-mqtt:latest -f dockerfile.edgex-mqtt .
    sudo docker build -t mqtt-broker:latest -f dockerfile.mqtt . 

 

Push Automated Checkout Docker Images to ACR

NOTE: Azure IoT requires container images of edge modules to be available on a public/private container registry. Azure Container Registry allows you to build, store, and manage container images and artifacts in a private registry for all types of container deployments.

Follow the steps below to push Automated Checkout Docker images to ACR.

 

  1. To create an Azure Container Registry (ACR), use the following link: Creating a container registry.
  2. Go to Azure portal > container registry > choose your container registry > Access keys
    Enable Admin user, get the details of container registry and please make a note of username, password, and login server for further steps. 


     
  3. Open a terminal on your development machine.
  4. Set environmental variables as follows by running the following commands on the terminal.
    export ACR_USERNAME=<ACR username> 
    export ACR_LOGIN_SERVER=<ACR Login Server> 
  5. Login to your Azure container registry. Enter the Azure container registry password when prompted.

    sudo docker login -u $ACR_USERNAME $ACR_LOGIN_SERVER

     

  6. Tag all Automated Checkout Docker images:

    sudo docker tag mqtt-broker:latest $ACR_LOGIN_SERVER/automated-checkout/mqtt-broker:latest
    sudo docker tag edgex-device-mqtt:latest $ACR_LOGIN_SERVER/automated-checkout/edgex-device-mqtt:latest
    sudo docker tag automated-checkout/ds-card-reader:dev $ACR_LOGIN_SERVER/automated-checkout/ds-card-reader:latest
    sudo docker tag automated-checkout/ds-controller-board:dev $ACR_LOGIN_SERVER/automated-checkout/ds-controller-board:latest
    sudo docker tag automated-checkout/ds-cv-inference:dev $ACR_LOGIN_SERVER/automated-checkout/ds-cv-inference:latest
    sudo docker tag automated-checkout/as-controller-board-status:dev $ACR_LOGIN_SERVER/automated-checkout/as-controller-board-status:latest
    sudo docker tag automated-checkout/as-vending:dev $ACR_LOGIN_SERVER/automated-checkout/as-vending:latest
    sudo docker tag automated-checkout/ms-authentication:dev $ACR_LOGIN_SERVER/automated-checkout/ms-authentication:latest
    sudo docker tag automated-checkout/ms-inventory:dev $ACR_LOGIN_SERVER/automated-checkout/ms-inventory:latest
    sudo docker tag automated-checkout/ms-ledger:dev $ACR_LOGIN_SERVER/automated-checkout/ms-ledger:latest 

     

  7. Push all Automated Checkout Docker images to ACR:

    sudo docker push $ACR_LOGIN_SERVER/automated-checkout/mqtt-broker:latest
    sudo docker push $ACR_LOGIN_SERVER/automated-checkout/edgex-device-mqtt:latest
    sudo docker push $ACR_LOGIN_SERVER/automated-checkout/ds-card-reader:latest
    sudo docker push $ACR_LOGIN_SERVER/automated-checkout/ds-controller-board:latest
    sudo docker push $ACR_LOGIN_SERVER/automated-checkout/ds-cv-inference:latest
    sudo docker push $ACR_LOGIN_SERVER/automated-checkout/as-controller-board-status:latest
    sudo docker push $ACR_LOGIN_SERVER/automated-checkout/as-vending:latest
    sudo docker push $ACR_LOGIN_SERVER/automated-checkout/ms-authentication:latest
    sudo docker push $ACR_LOGIN_SERVER/automated-checkout/ms-inventory:latest
    sudo docker push $ACR_LOGIN_SERVER/automated-checkout/ms-ledger:latest 

     

 

Build Docker Image for Connect Edge Devices to Azure IoT Module

This section outlines sending Automated Checkout telemetry data to the cloud.

NOTE: If you have not done so already, install Connect Edge Devices to Azure* IoT (See Step 5: Install the connect_devices_to_azure_iot).

To make the Connect Edge Devices to Azure IoT work with Azure EFLOW, build it as container. 


1. Go to Connect_Edge_Devices_to_Azure_IoT folder in Desktop:

cd ~/Desktop/Connect_Edge_Devices_to_Azure_IoT 


2. Build Docker image:

sudo docker build . -t connect-edge-devices-to-azure-iot:latest 

 

Push Connect Edge Devices to Azure IoT Docker Images to ACR 

Follow the steps below to push Connect Edge Devices to Azure IoT Docker images to ACR.
1. Tag Connect Edge devices to Azure IoT container:

sudo docker tag connect-edge-devices-to-azure-iot:latest $ACR_LOGIN_SERVER/connect-edge-devices-to-azure-iot:latest 


2. Push the container to ACR:

sudo docker push $ACR_LOGIN_SERVER/connect-edge-devices-to-azure-iot:latest 

 

Set Up Azure Resources for Deployment  

Before deploying the Automated Checkout Reference Implementation and Connect Edge devices to Azure IoT modules on EFLOW, you must complete the following steps. 

Create Azure IoT Hub

1. Follow the Create an IoT hub using the Azure portal instructions.
2. In your Azure Portal, go to your IoT Hub.
3. Under Device Management from the menu on the left, select IoT Edge.


4. Click on Add IoT Edge Device to create a new edge device for EFLOW VM. Provide a device ID and click the Save button.

5. Select the device ID of the target device you just created. Make a note of primary connection string for future reference.

 

Create Microsoft EFLOW device

To create an EFLOW device, follow the Microsoft installation guide
During the provisioning step, choose manual provisioning and provide the connection string of your IoT hub.

Deploy Reference Solution in EFLOW

NOTE: The following step assumes that all Docker images related to Automated Checkout RI and Connect Edge Devices to Azure IoT RI are pushed to Azure Container Registry. If not completed, follow the Build Automated Checkout Docker Images for the steps to be followed.

 

Set Up Microsoft Visual Studio Code and Extensions

In this section we will be using the Azure IoT Extensions for Visual Studio Code to develop IoT Edge Modules. 

Azure IoT Tools for VS Code is an extension pack for Visual Studio Code that lets you get all you need for Azure IoT development with 1-click installation. Microsoft Azure IoT support for Visual Studio Code is provided through a rich set of extensions that make it easy to discover and interact with Azure IoT Hub that power your IoT Edge and device applications.

  1. Install Visual Studio Code on your development machine.
  2. Once the installation is finished, select View > Extensions.
  3. Search for Azure IoT Tools, which is actually a collection of extensions that help you interact with IoT Hub and IoT devices, as well as developing IoT Edge modules.
  4. Select Install. Each included extension installs individually.
  5. In Explorer of VS Code, click Azure IoT Hub Devices in the bottom left corner.

     
  6. Click Set IoT Hub Connection String in the context menu.

     
  7. An input box will pop up, then enter your IoT Hub Connection String.
    This is a one-time configuration. Make sure it is IoT Hub Connection String and not Device Connection String.
    The format is:  HostName=<my-hub>.azure-devices.net;SharedAccessKeyName=<my-policy>;SharedAccessKey=<my-policy-key>)

     
  8. The device list will be shown:

 

Deploying modules to device
For deploying the Automated Checkout RI modules to IoT Edge device that was created, follow the below steps. 

  1. Open the Connect to Edge Device Automated Checkout RI folder (AC_IoT_Central) on your Visual Studio Code using the option File > Open Folder.
  2. Expand the eflow_deployment_manifest folder to see the deployment files.
  3. Update the .env file with the required details of Azure Container Registry that was created and save the file.
  4. Right-click the deployment.template.json file and select Generate IoT Edge Deployment Manifest to generate the deployment manifest.

     
  5. The generated deployment manifests will appear under a new config directory. Right-click on the deployment.amd64.json file under config folder and select Create Deployment for Single Device.

     
  6. An input box will pop up with options to select from the IoT Edge Device. Select the IoT Edge device name that was created.

     
  7. Click Azure IoT Hub Devices in the bottom left corner and expand the Modules of the IoT Edge device selected on the previous step.

     

NOTE: Depending on the network speed of the edge machine, it might take a while to deploy all the modules.

 

Monitoring Edge Device

Using Windows Admin Center

After successful setup/deployment of EFLOW, you can connect to your EFLOW VM from Windows Admin Center and see the status of your edge modules as shown below:

NOTE:  Make a note of the IP address for viewing visualization of the cooler.


 

Using Windows PowerShell

  1. Connect to your EFLOW VM from your Windows machine by executing this command in PowerShell: 
    Connect-EflowVM

     

  2. Run the below command to see the deployed list of edge modules:

    sudo iotedge list


    You should see output similar to: 

     

  3. To check the logs of edge modules, execute the command:

    sudo iotedge logs <edge module name>

     

Visualization of Cooler

To view the cooler simulation video, open a browser on the Windows machine that hosts the EFLOW VM and navigate to <EFLOW VM IP address>:9005

 

Visualization in Azure IoT Central 

This section contains instructions for both Linux and EFLOW. 

 

Step 1: Create Azure IoT Central Dashboard
  1. To create an Azure IoT Central dashboard, follow these instructions.
     

 

Step 2: Create Device Template
  1. To create a device template, follow these steps:
    • Go to the Azure IoT Central application that you created in step 1, then navigate to Device templates and choose +New.
    • On the Select template type page, choose the IoT Device tile. Then select Next: Customize
       
    • On the Customize page, provide a name for the device template and select Next: Review.
      NOTE: You do not need to select the check box for Gateway device with downstream devices.  

       
    • On the Review page, select Create.  

       
  2. Click on Import a model and upload the capability model AC_DCM.json
    The typical path is: ~/Desktop/Connect_Edge_Devices_to_Azure_IoT/AC_IoT_Central/


    Upload the capability model: 

 

  • To create an overall view, click Views and choose Visualizing the Device. Provide a View Name, for example, View-Overall and add the following tiles to the view. Click on Start with devices and choose telemetry names from the drop-down.    


     
    SI No. Title Name Telemetry Name Visualizing Panel Size 
    1 <Leave this field empty> <Leave this field empty> Markdown^ 1x3
    2 Temperature (°F) Temperature Last Known Value* 1x1
    3 Humidity Humidity Last Known Value* 1x1
    4 Sprite Sprite / Units Last Known Value** 1x1
    5 Inventory Sprite / Units,
    Mountain Dew / Units,
    Gatorade / Units,
    Pringles / Units,
    Ruffles / Units
    Line Chart 4x2
    6 Mountain Dew Mountain Dew / Units Last Known Value** 1x1
    7 Gatorade Gatorade / Units Last Known Value** 1x1
    8 Pringles Pringle / Units Last Known Value** 1x1
    9 Ruffles Ruffles / Units Last Known Value** 1x1

     

     

     

     

     

     

     

     

     

     








    NOTE: The symbols (^, * and **) in the Visualizing Panel column represent a specific action to be done. Refer to the below table for details. 



     
    SI. No Symbol Property Value
    1 ^ Description <br><br><br><br><br><br><br><br><br><br><center><h1> # Vending Machine 1 ➤</center>
    2 * and ** Text Size 44
    3 ** Decimals 0





     
  • To create a channel-wise view, click Views and choose Visualizing the Device. Provide a View Name, for example, Inventory, and add the following tiles to the view. 
    Click on Start with devices and choose telemetry names from the drop-down. 




     
    SI No. Title Name Telemetry Name Visualizing Panel Size 
    1 Sprite Sprite / Name Last Known Value 2x1
    2 Mountain Dew Mountain Dew / Name  Last Known Value 2x1
    3 Gatorade Gatorade / Name Last Known Value 2x1
    4 Pringles Pringle / Name Last Known Value 2x1
    5 Ruffles Ruffles / Name Last Known Value 2x1
    6 Price Sprite / Price Last Known Value 1x1
    7 Price Mountain Dew / Price Last Known Value 1x1
    8 Price Gatorate / Price Last Known Value 1x1
    9 Price Pringles / Price Last Known Value 1x1
    10 Price  Ruffles / Price Last Known Value 1x1
    11 Units Sprite / Units Last Known Value 1x1
    12 Units Mountain Dew / Units Last Known Value 1x1
    13 Units Gatorate / Units Last Known Value 1x1
    14 Units Pringles / Units Last Known Value 1x1
    15 Units Ruffles / Units Last Known Value 1x1
    16 Maximum Stock Sprite / Maximum Stock Last Known Value 1x1
    17 Maximum Stock Mountain Dew / Maximum Stock  Last Known Value  1x1
    18 Maximum Stock Gatorade / Maximum Stock Last Known Value 1x1
    19 Maximum Stock Pringles / Maximum Stock Last Known Value 1x1
    20 Maximum Stock  Ruffles / Maximum Stock Last Known Value 1x1

     

     

     

     

     

     

     

     

     

     

































    The view will be similar to: 






     

  1. Click Publish on the top panel. When prompted, click the Publish button to publish your device template.

 

Step 3: Add Device to Device Template 

In the next series of steps, you will attach an edge device to your published Automated Checkout device template.

  1. In your Azure IoT Central application, navigate to the Devices page and choose the template you created in the previous step.
  2. Click on + New to add the new device to the template.
  3. Provide the required details and click Create (refer to the screenshot below). 
    • Make sure you choose the right device template from the drop-down box.
    • Give a display name to your device. 
    • Provide a device ID. 
    • Do not enable the Simulate this device option.


 

 

Step 4: Get Device Connection Parameters

In the next series of steps, you will view device connection parameters of the Azure IoT Central device.

  1. On the Device page, select the device you created in the previous step.
  2. Select Connect.
  3. Make a note of the ID Scope, Device ID, and Primary Key values. 

     
Step 5: Run Program to Connect to Azure Dashboard

This section describes how to run a program that fetches data from the Automated Checkout using Rest API and sends the data to the Azure IoT Central dashboard. There are different steps for Linux and for EFLOW.

 

Step 5.1: Run Program on Linux 

  1. Go to the AC_IoT_Central directory: 
    cd ~/Desktop/Connect_Edge_Devices_to_Azure_IoT/AC_IoT_Central/
  2. Enter the command below using the parameters from the previous step. 
    chmod +x connect.sh
    ./connect.sh -s <ID SCOPE> -d <DEVICE ID> -k <PRIMARY KEY>  -h <HOST IP> -i <INTERVAL> 

    You will see output similar to: 

 

NOTE: Use device Scope ID, Device ID and Primary Key obtained from the previous step in the Visualization in Azure IoT Central section. 
You can run the reference implementation in parallel to send live data.  
The HOST IP is the IP of the machine on which RI is running.
You can adjust the metric sending interval with INTERVAL.

 

Step 5.2: Run Program on EFLOW

  1. Go to the connect_aziot module in IoT hub that was created in the previous section.




     

  2. Add the following configuration to the Container Create Options for the IoT Edge Module.

    • Update the variables mentioned in the below json with values noted in the Get Device Connection Parameters step.

      For example, the value <SCOPE ID> should be updated with the scope ID of the Azure IoT Central device.
       

      {
            "NetworkingConfig": {
              "EndpointsConfig": {
                  "host": {}
              }
          },
          "HostConfig": {
              "NetworkMode": "host"
          },
          "Cmd": [
              "python3",           "Connect_Edge_Devices_to_Azure_IoT/AC_IoT_Central/send_telemetry.py",
              "-s",
              "<SCOPE ID>",
              "-d",
              "<DEVICE ID>",
              "-k",
              "<PRIMARY KEY>",
              "-ip",
              "localhost",
              "-i",
              "<INTERVAL>"
      
          ]
      }        


       

    • Once updated, copy the updated content to Container Create Options section of the module.

  3. After updating the above details, it should look similar to the following:


     

  4. After adding all the required modules, click on Review + Create to proceed to the validation page.


     

  5. Once validation is done, click on Create to deploy the modules in EFLOW.

 

Step 6: Simulating Automated Checkout RI Scenarios

This section describes how to simulate the following retail cooler scenarios:

  1. An employee stocks the cooler
    • The cooler is empty - it has no stock in its inventory
    • A worker swipes their badge
    • The worker adds stock to the cooler
  2. A customer purchases an item
    • Later, a customer swipes their badge to open the cooler
    • The customer takes item(s) from the inventory
    • The customer closes the door and gets billed
  3. The cooler requires maintenance
    • The internal temperature of the cooler has exceeded the maximum temperature threshold
    • A maintenance worker resolves the issue

The next sections describe two different ways of simulating these scenarios.

Step 6.1: Simulating using curl REST API calls

The steps in the Simulate User Actions section in the Automated Checkout RI user guide show how to simulate the automated checkout workflow using curl REST API calls. It is a step-by-step walkthrough with specific commands to run on the command line.

Step 6.2: Simulating using automated script

The automated checkout workflow scenarios can be simulated automatically using a simulator script that utilizes the Python requests library to make REST API requests. This script helps simulate all the scenarios mentioned above and avoids manual step-by-step execution of REST API using the command line.

You need the following prerequisites to run the simulator script:

  • python3

In case of deploying in EFLOW, copy the repo to the Windows host machine. 

The simulator script will follow the below flow to simulate the scenarios:

  1. Employee stocks the cooler
  2. Customer purchasing from the cooler. The script will continue this scenario four times until the cooler is empty.
  3. The cooler requires maintenance. 

Follow the below steps to run the simulator script.

  1. Go to the AC_IoT_Central directory:
    cd ~/AC_IoT_Central/


     

  2. Run the command below with the host_ip parameter: 

    python3 simulator.py --host_ip/-ip <HOST IP>


    NOTE: The HOST IP is the IP of the machine on which Automated Checkout RI is running (EFLOW VM IP for EFLOW based deployment). Default value is 127.0.0.1.​

    You will see output similar to: 

 

 

Step 7: Monitor Data in Azure IoT Central Dashboard

In the following series of steps, you will monitor data exported to your Azure IoT Central dashboard.

  1. Go to your Azure IoT Central dashboard. 
  2. Navigate to Devices and choose the device template you created for Automated Checkout.


     
  3. Click your device, then click on different tabs to display telemetry data in the dashboard as shown below.

    • Admin View
      This view provides current cooler parameters and high-level insights on inventory using historical data.


       
    • Inventory Status
      This view provides real-time status of each product on the inventory.


       

 


Known Issues

Production Mode Security Warnings

Issue with Grafana Visualization

In Production Mode, security risk warning will be displayed when navigating to Grafana dashboard via https://localhost:3000. To visualize data in Grafana, please navigate to https://127.0.0.1:3000 to avoid receiving warnings.

 

Insecure Request Warning 

On running connect.sh in Production Mode, Insecure Request Warnings will be printed on terminal window. The script is provided for reference purpose only. Update it to meet your needs.

 

Map UI and Inferencing video not rendering on EFLOW

Intel® GPU enablement is not yet available. Instructions will be added once the support is available.
Unable to view Map UI and inference video in Grafana dashboard and flask server. The Smart City module is unable to host video server on EFLOW VM IP. 

 

 


Summary and Next Steps 

You have successfully installed the Connect Intel Devices to Azure IoT* web application, and connected to Azure IoT Hub and Azure IoT Central.   

You have also successfully installed and visualized some of the sample applications through Azure IoT Central dashboard.  


Learn More 

To continue learning, refer to these sites for details on Azure Portal, Azure IoT Hub, Azure IoT EFLOW, and Azure IoT Central.

Support Forum 

If you're unable to resolve your issues, contact the Support Forum.  

 

†You are responsible for payment of all third-party charges, including payment for use of Microsoft Azure services. 

For the most up-to-date information on Microsoft® Azure products, see the Microsoft Azure website.

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.