This tutorial describes how to use Microsoft IoT Edge to connect a Revolution Pi system to Azure IoT Hub. The process involves configuring Azure IoT Hub, registering your IoT device, and setting up the IoT Edge runtime on your RevPi.
Prerequisites #
-
A valid Azure account
-
RevPi device (at least 8 GB storage)
-
PC with internet access
-
Basic familiarity with Linux command line
-
SSH access to your RevPi
Hardware #
-
RevPi base module with minimum 8 GB storage
-
Power supply
-
Network connection
-
PC with internet access
Software #
-
Latest version of Raspberry Pi OS
-
At least 600 MB of available memory
-
SSH client (e.g., PuTTY)
-
Create an Azure account at azure.microsoft.com/free
-
Log in to the Azure Portal
-
Set up SSH access to your RevPi device
-
Update your RevPi to the latest version of Raspberry Pi OS
-
Ensure you have 600 MB of free memory available
-
Step 1: Setting up Azure #
Creating the IoT Hub #
▷ Log in to the Azure Portal at portal.azure.com
▷ Click on "Create a resource" and search for "IoT Hub"
▷ Click "Create"
▷ Select your subscription and resource group or create a new one
▷ Choose the region closest to you. NOTE: Not all Azure services are available in all regions
▷ Select the pricing tier that matches your needs under "Management"
▷ Click "Review + Create"
▷ Click "Create" to deploy your IoT Hub
Creating the Edge Device #
▷ Navigate to your newly created IoT Hub
▷ Select "IoT Edge" under "Device management" in the sidebar
▷ Click "Add IoT Edge Device"
▷ Enter a Device ID for your RevPi
▷ Accept the default settings
▷ Click "Save"
▷ Click "Refresh"
▷ Select your newly created device
▷ Copy the "Primary Connection String" - you’ll need this later
Step 2: Setting up the RevPi Device #
Installing Required Packages #
First, add the Microsoft package repository and GPG key:
curl https://packages.microsoft.com/config/debian/stretch/multiarch/packages-microsoft-prod.deb > ./packages-microsoft-prod.deb
sudo apt install ./packages-microsoft-prod.deb
curl https://packages.microsoft.com/config/debian/stretch/multiarch/prod.list > ./microsoft-prod.list
sudo cp ./microsoft-prod.list /etc/apt/sources.list.d/
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo cp ./microsoft.gpg /etc/apt/trusted.gpg.d/
sudo apt-get update
Installing IoT Edge Runtime #
Install the Moby container engine and IoT Edge:
sudo apt-get install moby-engine -y
sudo apt-get install iotedge -y
Configuring IoT Edge #
▷ Open the configuration file:
sudo nano /etc/iotedge/config.yaml
▷ Find the "Manual provisioning configuration" section and update the device_connection_string with your Primary Connection String:
provisioning:
source: "manual"
device_connection_string: "HostName=XXX.azure-devices.net;DeviceId=rpi-1;SharedAccessKey=XXXXc="
Starting and Verifying IoT Edge #
▷ Restart the IoT Edge service:
sudo systemctl restart iotedge
▷ Check the status:
sudo systemctl status iotedge
sudo iotedge check
▷ Run "iotedge check" twice - it’s normal to see one remaining error about "Production readiness: Edge hub’s storage directory"
Troubleshooting #
If you encounter issues:
-
Check the RevPi forum at revolutionpi.de/forum/
-
Review Azure IoT Edge logs:
journalctl -u iotedge
-
Verify network connectivity
-
Ensure all required ports are open
-
Check system resources