Skip to content
This repository was archived by the owner on May 20, 2019. It is now read-only.

inovex/azure-iot-edge-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure IoT Edge Demo

This repo contains a demo Azure IoT Edge application consisting of two python components:

  • An IoT device to be run on a Raspberry Pi, which reads data from a DS18B20 sensor and sends a message towards the cloud each second.
  • An IoT Edge deployment with a single module, which intercepts and prints these messages before forwarding them to the cloud.

The python code is based on Microsoft's Azure IoT Python samples.

Building and Testing the application

The following steps will guide you in setting up the demo application. The setup used in the live demo looked as following:

Demo setup consisting of two Raspberry Pis used as edge-device-0 and edge-device-1 respectively and an additional Raspberry Pi used as edge-node. They communicate over WiFi, which is linked to the internet, where the IoT Hub called iotedgedemo can be reached.

General prerequisites

Edge Node Prerequisites

Edge Node Deployment

If you have everything set up you first need to change the container registry settings in the module.json and deployment.template.json. Simply replace inovexedgedemoacr.azurecr.io with your registry URI and adjust the credentials accordingly. In the Docker entrypoint, replace the IP address in echo '10.100.36.59 edge-node' with the one of your edge-node. This procedure is a hotfix for us not having a FQDN for our edge-node. You can then deploy to the edge node using the iotedgedev cli:

# Prepare environment variables for iotedgedev, skip this part when redeploying
$HUB_NAME=<your-hub-name>
echo "BUILD_BUILDNUMBER=0.0.1" >> .env
echo "IOTHUB_CONNECTION_STRING=$(az iot hub show-connection-string -n $HUB_NAME | jq '.cs')" >> .env
echo "DEVICE_CONNECTION_STRING=$(az iot hub device-identity show-connection-string -n $HUB_NAME -d edge-node | jq '.cs')" >> .env
# Build & Push Docker images and deploy
iotedgedev build -f deployment.template.json -P arm32v7 --push --deploy

Edge Device Prerequisites

  • Provision two Raspberry Pis with an DS18B20 sensor and Raspbian as Edge Devices
  • The Pis should be able to reach the Edge Node on a static IP
  • The IP address of the Edge Node needs to be added to /etc/hosts of the devices: echo "<Edge Node ip> edge-node" >> /etc/hosts
  • Install the certificates from the Edge Node on the Edge devices
  • Create a device identity in your IoT Hub for both:
HUB_NAME=<your-hub-name>
for iotdevice in edge-device-0 edge-device-1; do
   az iot hub device-identity create -n $HUB_NAME -d $iotdevice
   echo "Created $iotdevice. Connection String:"
   az iot hub device-identity show-connection-string -n $HUB_NAME -d $iotdevice | jq ".cs"
done

Then refer to the device readme to setup the sensor and software.

Edge Device Deployment

Refer to the device readme

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published