I will build a iot gateway which will log sensor data of grove shield to Azure IOT Hub together with a visualization dashboard using Power BI.
This is guide about using Intel Edison to send data to Azure IoT hub and those data will be retrieved and stored in Azure Storage. With Power BI connecting to the Azure Storage, a visualization dashboard will be created.
Prerequisites
- An Azure account
- Azure CLI installed
- Visual Studio Code
- node, npm and gulp
- A Power BI account
- Azure Storage Explorer
- Power BI Desktop
Configure Intel Edison
Follow this resource to setup and configure your Intel Edison.
Get the Tools
Download the development tools and the software for the first sample application for Intel Edison. Depending on the platform you are developing with, follow one of the following links:
Create and deploy blink application
1. Clone this sample repository from GitHub.
git clone https://github.com/Azure-Samples/iot-hub-node-edison-getting-started.git
2. Open the sample app (Lesson1) in Visual Studio code.
cd iot-hub-node-edison-getting-started
cd Lesson1
code .
3. Install the libraries and other module for the sample app.
npm install
4. Generate the device configuration file.
gulp init
5. Update configuration file config-edison.json in Visual Studio Code.
# For Windows command prompt
code %USERPROFILE%\.iot-hub-getting-started\config-edison.json
# For MacOS or Ubuntu
code ~/.iot-hub-getting-started/config-edison.json
6. Update the placeholder device hostname or IP address
and device password
with the IP address and password that you marked down in the section Configure Intel Edison above.
7. Deploy and run the sample application. Verify that the app works.
gulp deploy && gulp run
Create IoT hub
1. Sign in to Azure account.
az login
2. Set the default subscription that you want to use.
az account set --subscription {subscription id or name}
3. Register the provider "Microsoft.Devices"
az provider register "Microsoft.Devices"
4. Create a resource group named iotsampleRG in the in South East Asia region.
az group create --name iotsampleRG --location southeastasia
5. Create an IoT hub in the iotsampleRG resource group.
az iot hub create --name {hub name} --resource-group iotsampleRG
Register Intel Edison
1. Register Edison device in IoT hub.
az iot device create --device inteledison01 --hub-name {hub name}
Create Azure function app and Azure storage account
Use an Azure Resource Manager template to create an Azure function app and an Azure storage account. The Azure function app listens to Azure IoT hub events, processes incoming messages, and writes them to Azure Table storage. The storage account is used for reading the persisted copies of messages from Azure table.
Follow this link and this resource to create the function app and storage account.
1. Open the sample project's Lesson3 in Visual Studio Code.
cd Lesson3
code .
2. Update the arm-template-param.json file.
3. Create and deploy resources in Azure
az group deployment create --template-file arm-template.json --parameters @arm-template-param.json -g {resource group name}
Get IoT hub and device connection string
1. Get the IoT hub connection string.
az iot hub show-connection-string --name {hub name}
2. Get the device connection string.
az iot device show-connection-string --hub-name {hub name} --device-id inteledison01
Configure device connection
1. Initialize configuration file.
npm intall gulp init
2. Update configuration file config-edison.json in Visual Studio Code.
# For Windows command prompt
code %USERPROFILE%\.iot-hub-getting-started\config-edison.json
# For MacOS or Ubuntu
code ~/.iot-hub-getting-started/config-edison.json
gulp deploy && gulp run
az storage account list -g iotsampleRG --query [].name
az storage account show-connection-string -g iotsampleRG -n {storage name}
gulp run --read-storage