Connect Edge Devices to Azure IoT*

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. 

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 reference application. 

Get Started 

Step 1: Install the Use Case

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. 

5. 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

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

 

Step 6: 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. 

NOTE: Do not switch back to the Connect Edge Devices to Azure IoT tab until the Microsoft Azure Cross-platform Command Line Interface page has appeared and closed automatically. 

5. After signing in, the page below closes automatically and returns 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: 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 

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: 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 (EIV installed).

3. Build the People Counter docker images:

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

[ Ex: docker build . -t  abc.azurecr.io/sample/iotc-hub:pc ] 

     NOTE:
a. For creating image URL, you need login server details of your container registry. Go to azure portal > container registry > choose your container > Access keys.  Please 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/sample/iotc-hub:pc. Where abc.azurecr.io is the login server address of your container registry, sample/iotc-hub is your repository and pc is the image tag.
c. Please 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>

Where CR is the Container Registry.

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

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.

5. Push the application image to your azure container registry:

sudo docker push <image URL>:<tag>

Example: sudo docker push abc.azurecr.io/sample/iotc-hub:pc

Step 2: Prepare Deployment Manifest

In the next series of steps, you are going to prepare the deployment manifest file. 

1. Go  to ~/Desktop/Connect_Edge_Devices_to_Azure_IoT/Cloud/Deployment_Manifest in your machine (EIV installed) and open deployment.json file.

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

Example: abc.azurecr.io/sample/iotc-hub:pc

3. Replace container registry name (line no.26), login server (address: line no.27), password (line no.28) and username (line no.29) with your container registry created in previous step.

NOTE:
1. Give full image URL with tag. [ ex: abc.azurecr.io/sample/iotc-hub:pc ]
2. Go to azure portal -> container registry -> choose your container registry ->   Access Keys. Get the details of container registry username, login and password.

Step 3: Create IoT Central Dashboard

To create an Azure IoT central dashboard, please follow Quickstart - Create an Azure IoT Central application.

Step 4: 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’

  • 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 ‘+ Replace manifest’ and select Browse to upload the deployment. json (Available inside ~/Desktop/Connect_Edge_Devices_to_Azure_IoT/Cloud/Deployment_Manifest folder) and choose Replace

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

Step 5: 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 6: 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 7: 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 8: 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 9: 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 

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. 

Data Visualization Using Azure IoT Central Dashboard

In this section, you will create an Azure IoT Central dashboard for a reference implementation, run standalone Python code to fetch telemetry data from Influx DB, and send data to the Azure IoT Central dashboard for visualizing telemetry data.

Prerequisites

Before you continue, you must complete the following:

  1. Complete the steps to install and run the Multi-Camera Detection of Social Distancing reference implementation. 

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 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:   
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, View-ChannelWise and add the following tiles to the view: 
 

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 People Count - Channel 03 Last Known Value 2x2
4 People Count - Channel 04 Last Known Value 2x2
5 Social Distance Violation - Channel 01 Last Known Value 3x2
6 Social Distance Violation - Channel 02 Last Known Value 3x2
7 Social Distance Violation - Channel 03 Last Known Value 3x2
8 Social Distance Violation - Channel 04 Last Known Value 3x2
9 People Count - Channel 01,
Social Distance Violation - Channel 01
Pie Chart 2x2
10 People Count - Channel 02,
Social Distance Violation - Channel 02
Pie Chart 2x2
11 People Count - Channel 03,
Social Distance Violation - Channel 03
Pie Chart 2x2
12 People Count - Channel 04,
Social Distance Violation - Channel 04
Pie Chart 2x2
13 People Count - Channel 01,
People Count - Channel 02,
People Count - Channel 03,
People Count - Channel 04
Bar Chart 4x4
14 Social Distance Violation - Channel 01,
Social Distance Violation - Channel 02,
Social Distance Violation - Channel 03,
Social Distance Violation - Channel 04
Bar Chart 4x4


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


 

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

  1. In your 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

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

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

Go to the MCSD_IoT_Central directory: 

cd ~/Desktop/Connect_Edge_Devices_to_Azure_IoT/MCSD_IoT_Central/


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> 

 

NOTE: Use device Scope ID, Device ID and Primary Key obtained from previous step. 
You can run the reference implementation in parallel to send live data.  

Send Data from influxDB to Azure IoT Central for Other RIs

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. 

  • connect.sh will not work out of box with other reference implementations to send data to Azure IoT Central. The following files need to be modified: 
    • send_telemetry.py 
      • Change database name (assuming data is still deposited to InfluxDB) 
      • Attribute names (Influx DB series names) 
      • Code to process data  
      • Modify message string w.r.t telemetry name 
    • Create new Device Template (.json file) for your use case 

NOTE: For connecting via MQTT the process will be different. The above example with connect.sh will work only when data is deposited into InfluxDB. 

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 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: 

Summary and Next Steps 

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

Learn More 

To continue learning, see the following: 
 

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. 

Product and Performance Information

1

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