Azure IoT Edge on Windows 10 IoT Core-Alibaba Cloud Developer Community

At this year's Build conference, Microsoft released the first version of Azure IoT Edge (https://github.com/Azure/iot-edge). The main feature of this version is to push computing power from Azure to Edge devices Azure IoT Edge, reducing the time spent on data transmission in the cloud and speeding up the response time. For example, Azure IoT Edge device can be used as a gateway device for data preprocessing and analysis to reduce the latency of IoTHub data transmission. At the same time, this version supports multiple fieldbus devices to connect data Azure IoT Edge devices, and then Azure IoT Edge devices interact with Azure IoTHub in a unified manner.

At the Connect conference in November this year, Microsoft announced the public preview version of Azure IoT Edge (document link: https://docs.microsoft.com/en-us/azure/iot-edge ), which has been launched in the Midwest, Northern Europe and East Asia of the United States, and will be opened in batches in other regions. Azure IoT Edge supports platforms and architectures such as Windows, Linux, x64, and ARM. You can use Docker-based Linux or Windows containers. Supports Development languages such as C#, C, and Python. Microsoft also released an AI suite for Azure IoT Edge to assist developers in Edge AI application development (https://github.com/Azure/ai-toolkit-iot-edge).

This topic takes a Windows running IoT Core 10 MinnowBoard MAX as an example to describe in detail the installation of Windows 10 IoT Core(Build 16299), the deployment of Docker, the installation of Python and Iotedgectl tools, the creation of IoT Edge Device, deploy and run the Module.

MinnowBoard MAX is a relatively old board, its processor is Intel Atom E8325, dual-core 1.3G dominant frequency, can run 64-bit system. To MinnowBoard MAX RUN Windows 10 IoT Core Build 16299 (Because running Azure IoT Edge run when The Minimum System version is 16299), need firmware update, system Image burn writing and Bios settings this three Steps.

1.1 firmware update

to update the firmware, you need to download the latest file from Intel's official website. The link address is https://firmware.intel.com/projects/minnowboard-max,笔者写文章时,其最新的版本为0.97,如下图所示,

then, update the firmware by referring to part 3 of Windows 10 IoT Serials 1-Minnow Board MAX 10 IoT development environment for Windows. Note that currently Microsoft released for Minnow Board MAX The Windows 10 IoT Core is 64 wei so, the updated firmware also to select 64 wei version. In other words, the files to be used are two 64-bit firmware-related files, as shown in the following figure.

1.2 System Image writing

the easiest way to write a system image is to download the official Windows 10 IoT Core Dashboard software, click set new device, select the device type, OS version, device name, and set the required password, click download and install.

Note that you must download the OS version 16299 or later.

1.3 BIOS settings

after the system image is burned, you need to set the BIOS of the Minnow Board MAX, which mainly modifies the Boot sequence. For more information, see Section 5 of Windows 10 IoT Serials 1-building Minnow Board MAX 10 IoT development environment for Windows, complete the settings of "Manager-> System Setup -> South Cluster Configuration -> LPSS & SCC Configuration" and "Boot Mainenance Manager-> Boot Options > Change Boot Order" in sequence.

after the system is installed, connect the network cable to the Minnow Board MAX and power on. During the first run, some settings are experienced, so the speed is relatively slow. After the system runs, PowerShell utility tool is used to connect Minnow Board MAX devices in the LAN. For details, please refer to this document "login remotely with PowerShell". Note that the user name and password are set when the system image is burned.

Then, run the following command step by step:

Invoke-WebRequest https://master.dockerproject.org/windows/x86_64/docker-17.06.0-dev.zip -o temp.zip

Expand-Archive .\temp.zip $env:ProgramFiles -f

Remove-Item .\temp.zip

$env:Path += ";$env:programfiles\docker"

SETX /M PATH "$env:Path"

dockerd --register-service

start-service docker

after the preceding script is run, Docker is installed on the Minnow Board MAX device, environment variables are set, and the Docker service is started.

in the PowerShell, run the following script:

Invoke-Expression (Invoke-WebRequest -useb https://aka.ms/iotedgewin)

note that the command is executed according to the script file. If no changes are made, the following error is displayed.

That is, the version of Docker downloaded and installed is 17.06. However, when you open the downloaded PowerShell script, you will find that the requirement is 17.09. Therefore, you need to download the script file, and modify the DockerVersion in line 38, change 17.09 to 17.06, as shown in the following figure.

After the modification, transfer the file to the Minnow Board MAX device through file sharing and FTP, such as the root directory of the C disk. Then, run the following command through the PowerShell:

C:\Install-IotEdgeRequirements.ps1

in this way, local script files are executed through PowerShell. During this process, Python and IoTedgectl tools are downloaded, which may take a long time depending on the network connection. If the download and installation are correct, a prompt is returned through the PowerShell, as shown in the following figure.

In addition, you can run the iotedgectl help command to view the commands that it can accept.

Now, we need to use Docker to Pull the IoTedge Agent and IoTedge Hub modules to the local, that is, run them in the PowerShell respectively:

docker pull microsoft/azureiotedge-agent:1.0-preview

docker pull microsoft/azureiotedge-hub:1.0-preview

if everything is installed normally, the installation is completed at this step.

currently, IoT Edge Device communicate through Azure IoTHub. Therefore, you need to Create an IoTHub on the Azure subscription. For more information, see Create an IoT hub using the Azure portal. Note that the free F1 level is sufficient.

After creating IoTHub, you can select IoT Edge (preview) -Add IoT Edge Device, as shown in the following figure:

enter a name. Take MinnowBoard as an example and click OK.

After the device is created, go to the device information page and copy the connected Connection String, as shown in the following figure.

IoT Edge runtime consists of two modules: IoT Edge agent and IoT Edge hub. IoT Edge agent is responsible for deploying and monitoring IoT Edge deployed to Modules devices. IoT Edge hub communication between deployed Modules and between devices and IoTHub bus.

The configuration is also performed through the PowerShell:

iotedgectl setup --connection-string "{device connection string}" --auto-cert-gen-force-no-passwords

"{device connection string}" is replaced by the Connection String saved in step 4 above.

Then, run the following command:

iotedgectl start

you can also run the following command to check whether the IoT Edge agent is running:

docker ps

one of the important features of Azure IoT Edge is to support dynamic deployment of modules on the cloud to IoT Edge Device. Each Module is a package running in a container. Modules support Azure Service, such as Azure Functions, Azure Stream Analytics, and Azure Machine Learning. User-defined modules can also be implemented in Java, .NET Core 2.0, Node.js, C, and and Python.

Here, we deploy the Module that has been written by Microsoft. The Module generates temperature, humidity, and atmospheric pressure data every 5 seconds and uploads them to IoTHub. The procedure is as follows:

First, in the Azure Portal, navigate to the newly created IoTHub, click "IoT Edge (preview)"-"Set Modules"-"Add IoT Edge Module" in sequence, in the displayed settings page, click Add IoT Edge Module, as shown in the following illustration.

Enter a name and Image URI, where Image URI is set:

microsoft/azureiotedge-simulated-temperature-sensor:1.0-preview

other settings are default, as shown in the following figure.

The subsequent settings are default. Click Submit to Submit. After returning to the device page, I found that mytemp has started running in the following Deployed Module.

surveillance IoT Edge Device Equipment And iothub interactive data, can practical Azure Device Explorer tool, The Tool on Github with download: https://github.com/Azure/azure-iot-sdk-csharp/releases

the latest version is 1.4.1. After the download and installation, enter the connection string of IoTHub on the Configuration page and click Update:

after that, you can select a device on the Data page to monitor the Data, as shown in the following figure.

So far, we have installed MinnowBoard 10 Windows (Build 16299) on the IoT Core, deployed Docker, and installed Python and Iotedgectl tools. At the same time, azure Portal creation, Module deployment, and operation are completed on the IoT Edge Device. At the same time, Azure Device Explorer tools are used to monitor the interaction between Edge Device and Azure IoTHub data.

 

1. Azure IoT Edge V1:https://github.com/Azure/iot-edge

2. Azure IoT Edge V2:https://docs.microsoft.com/en-us/azure/iot-edge

3. Azure IoT Edge AI Kits:https://github.com/Azure/ai-toolkit-iot-edge

4. Windows 10 IoT Serials 1-for Minnow Board MAX The Windows 10 IoT Development environment Building

5. MinnowBoard firmware update: https://firmware.intel.com/projects/minnowboard-max

6. Windows IoT Core Image burning tool: Windows 10 IoT Core Dashboard

7. Azure IoTHub Create: Create an IoT hub using the Azure portal

8. Azure Device Explorer tool download: https://github.com/Azure/azure-iot-sdk-csharp/releases

this article is transferred from the blog of Smart Life blog Park, original link: http://www.cnblogs.com/dearsj001/p/AzureIoTEdge4WindowsIoTCore.html , if you need to reprint, please contact the original author.

Selected, One-Stop Store for Enterprise Applications
Support various scenarios to meet companies' needs at different stages of development

Start Building Today with a Free Trial to 50+ Products

Learn and experience the power of Alibaba Cloud.

Sign Up Now