Connect Edge Devices to Azure* IoT

Published: 11/20/2020

Edge Software Hub   /   Connect Edge Devices to Azure* IoT  /  Documentation

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 reference implementation. 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: 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 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 can utilize the rest of the Azure IoT Central services to meet your needs. 

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

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 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, View-ChannelWise and add the following tiles to the view. Click on ‘Start with devices’ and choose telemetry names from 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 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 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

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 InfluxDB and sends the data to the Azure IoT Central dashboard. 

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> 

 

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

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

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 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 can utilize the rest of the Azure IoT Central services to meet your needs. 

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

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 ‘Abbreviate values’ option in configure options. 

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

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


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


 

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.

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

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

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> 

 

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.  
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 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 differnet tabs to view ttelemetry data in dashboards as shown in the following images:

  • Overall View 

 

  • Channel View 

 

  • Collision View 

 

 


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.


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