Azure IoT Edge User Manual

Azure IoT Edge integrates cloud analysis and custom service logic into devices to help organizations focus on service insights instead of data management. It packages service logic into standard containers, scales out IoT solutions, deploys these containers to devices, and then monitors these devices on the cloud. For more information about Azure IoT Edge, see About Azure IoT Edge module.The InHand IG902-series products provide Azure IoT Edge SDK to support Azure IoT Edge and enable you to quickly develop and complete tasks and securely and efficiently deploy services. This SDK manages the Azure IoT Edge runtime to manage the Azure cloud platform deployment and run the IoT Edge module (docker image) on the IoT Edge device (IG902).This document describes how to deploy and run an IoT Edge module that simulates telemetry data and sends it to IoT Hub on IG902 through the Azure platform by using the Azure IoT Edge SDK.

1. Environment Preparations

You need to prepare the following items before start (as for how to get the IG902 software version, please visit the Resource.):

  • Azure IoT account
  • IG902 firmware version: v2.0.0.r12644 or later
  • Docker SDK version: 18.06.3-ce or later
  • Azure IoT Edge SDK version: 1.0.4 or later
  • IG902-series products

1.1 Configure the Azure IoT environment

If you have deployed the corresponding IoT Hub and IoT Edge devices on Azure IoT, skip this section.

  • Step 1: Log in to Azure IoT

    Visit https://portal.azure.cn/ and log in to Azure.

    _images/2020-04-01-11-17-22.png

  • Step 2: Add IoT Hub

    After successful login, the page is as follows. Select IoT Hub.

    _images/2020-04-01-11-20-56.png

    Click Add to create an IoT Hub.

    _images/2020-04-01-11-22-39.png

    _images/2020-04-01-11-25-09.png

    After the IoT Hub is created, the page is as follows:

    _images/2020-04-01-11-28-51.png

  • Step 3: Add an IoT Edge device

    On the IoT Hub page, click the target IoT Hub. On the IoT Edge that appears, click Add an IoT Edge device.

    _images/2020-07-01-10-43-59.png

    Configure the parameters and click Save.

    _images/2020-07-01-10-45-04.png

  • Step 4: Copy the connection string of the IoT Edge device

    After the IoT Edge device is created, the page is as follows:

    _images/2020-07-01-10-46-25.png

    Click Device ID of the IoT Edge device. On the details page of the IoT Edge device that appears, copy the Primary Connection String parameter for subsequent use.

    _images/2020-07-01-10-48-09.png

1.2 Configure the IG902 environment

1.2.1 Configure IG902 to connect to the Internet

As for how to configure IG902 to connect to the Internet, see Connect IG902 to the Internet.

1.2.2 Update the IG902 software version

  • Update the IG902 firmware version

    As for how to update the IG902 firmware version, see Update the IG902 software version.

  • Update the IG902 Docker SDK

    As for how to update the IG902 Docker SDK, see Install Docker SDK.

  • Update the IG902 Azure IoT Edge SDKChoose Edge Computing >> Cloud Edge Computing, uncheck Enable Security Daemon, click Upgrade, select the Azure IoT Edge SDK file, and click Confirm.

    _images/2020-07-31-11-32-42.png

1.3 Modify the configuration file of Azure IoT Edge

On the Edge Computing >> Cloud Edge Computing page, click Export to export the configuration file of Azure IoT Edge.

_images/2020-07-31-11-33-50.png

Modify the device_connection_string parameter in the configuration file of Azure IoT Edge and save the modification. This string is the Primary Connection String of the IoT Edge device that you copied in the step Copy the connection string of the IoT Edge device.

_images/2020-07-01-11-10-20.png

Import the modified configuration file of Azure IoT Edge.

_images/2020-07-31-11-34-34.png

2. Run Azure IoT Edge

Choose Edge Computing >> Docker Manager and check Enable Docker Manager.

_images/2020-07-31-11-35-52.png

Choose Edge Computing >> Cloud Edge Computing, and check Enable Security Daemon.

_images/2020-07-31-11-36-13.png

After the security daemon is enabled, the Azure IoT Edge daemon pulls an image to create a container named edgeAgent. This process takes for about 20 minutes because the image is large. You can choose LOCAL >> Containers on portainer to check whether the edgeAgent container is running. If the edgeAgent container is running, Azure IoT Edge is in normal operating state.

_images/2020-07-31-11-36-38.png

_images/2020-07-01-13-20-30.png

_images/2020-07-01-13-19-25.png

Then, RUNTIME STATUS of $edgeAgent on the details page of the IoT Edge device is running.

_images/2020-07-01-14-55-52.png

3. Configure and Deploy the Module

  • Step 1: Add the IoT Edge module

    On the details page of the IoT Edge device, click Set Modules.

    _images/2020-07-01-13-23-33.png

    On the Set modules on device page, click Add and select IoT Edge Module to add the IoT Edge module.

    _images/2020-07-01-13-26-18.png

    In the window Add IoT Edge Module that appears, configure the module name and image URL. This document takes the mcr.microsoft.com/azureiotedge-simulated-temperature-sensor:1.0 image as an example. This image, provided by Microsoft, simulates telemetry data and sends the data to IoT Hub. As for how to deploy the module, see Develop and deploy the Python IoT Edge module for the Linux device.

    _images/2020-07-01-13-37-01.png

    After the module is added, the page is as follows:

    _images/2020-07-01-15-00-29.png

    The edgeHub container listens to the port 443 and is mapped to the port 443 of the host (IG902) by default. Generally, the IG902’s port 443 is listened to and occupied by other programs. Therefore, you need to modify the mapping port of the edgeHub container to ensure that edgeHub can be started. Click Runtime Setting. In the window Runtime Settings that appears, modify HostPort to another port, such as 444. After modification, click Save.

    _images/2020-07-01-13-48-56.png

    Then, click Review + create and click Create after confirmation. The IoT Edge module is added.

    _images/2020-07-01-13-52-17.png

    The edgeHub and mcr.microsoft.com/azureiotedge-simulated-temperature-sensor:1.0 are automatically deployed to IG902 and run on IG902. You can view the deployed containers on the details page of the IoT Edge device. If RUNTIME STATUS is running, the container has been deployed and runs normally. (The total size of two images is about 400 MB. It takes about 20 or more minutes to deploy them.)

    _images/2020-07-01-13-55-07.png

  • Step 2: View the container running status

    Access portainer and choose LOCAL >> Containers. It can be seen that three containers are already running.

    _images/2020-07-01-13-56-48.png

    Click Logs of the EIP-demo-edge-module container to view its running logs. If the logs are as follows, the container runs normally, that is, it simulates the telemetry data and sends the data to IoT Hub.

    _images/2020-07-01-14-00-14.png

    _images/2020-07-01-13-59-57.png

At this time, you have deployed and run an IoT Edge module that simulates telemetry data and sends it to IoT Hub on IG902 through the Azure platform.