Azure IoT Edge enables you to perform analytics and data processing on your devices, instead of having to push all the data to the cloud. The IoT Edge tutorials demonstrate how to deploy different types of modules, built from Azure services or custom code, but first you need a device to test.
In this tutorial you learn how to:
- Create an IoT Hub
- Register an IoT Edge device
- Start the IoT Edge runtime
- Deploy a module
The simulated device that you create in this tutorial is a monitor on a wind turbine that generates temperature, humidity, and pressure data. You’re interested in this data because your turbines perform at different levels of efficiency depending on the weather conditions. The other Azure IoT Edge tutorials build upon the work you do here by deploying modules that analyze the data for business insights.
Prerequisites
This tutorial assumes that you’re using a computer or virtual machine to simulate an Internet of Things device.
- Install Docker and make sure it’s running.
- Install Python and make sure you can use the pip command.
- Run the following command to download the IoT Edge control script.
pip install -U azure-iot-edge-runtime-ctl
- Install Visual Studio Code
- Install Azure IoT Edge extension
Create an IoT hub
Start the tutorial by creating your IoT Hub.
- In Visual Studio Code, select IoT Hub Devices.
- Select … then select Create IoT Hub from the menu.
- Select Subscription, Resource Group and fill in other required fields to create IoT Hub
Register an IoT Edge device
Register an IoT Edge device with your newly created IoT Hub.
- Select … then select Create Edge device from the menu.
- Type device id to create a new Edge device.
Configure the IoT Edge runtime
Configure and start the Azure IoT Edge runtime on your device.
- Right-click the Edge device in Device List and select Setup Edge
- In Command Palette, select Edge: Start Edge
Deploy a module
Manage your Azure IoT Edge device in VS Code to deploy a module which will send telemetry data to IoT Hub.
- In Command Palette, select Edge: Generate Edge deployment manifest, save the deployment.json file.
- In the modules section of deployment.json, update SampleModule to tempSensor, update
<registry>/<image>:<tag>
to microsoft/azureiotedge-simulated-temperature-sensor:1.0-preview. - Right-click the Edge device in Device List and select Create deployment for Edge device, then select the deployment.json file to deploy the module.
View generated data
Monitor device to cloud messages sent from your IoT Edge device to your IoT hub
- To monitor data arriving at the IoT hub, right-click the Edge device and select Start monitoring D2C message
- To stop monitoring data, right-click the Output Channel and select Stop monitoring D2C message
View module status
Expand the Edge device to view the status of each module
What’s Next
Now you have successfully deployed a pre-defined module on your IoT Edge device within Visual Studio Code. Besides that, you can build your own module as well. Please check out this tutorial for developing and deploying your own module.
0 comments