This is the fourth installment of 5 part series Connecting Things to Internet – a step-by-step guide on how to get things connected to the Internet using low cost devices. In this fourth article, I will focus on getting Windows Azure IoT SDK installed on on your gateway device, The Rasbberry Pi 2, and configure the device in IoT hub that was create in the second article. As mentioned in the earlier article, I will be using Node implementation of Azure IoT SDK in this series.
Installing Azure IoT Node SDK
It is assumed that you already have Node(0.12.x or later) and serialport package installed in your RPi. If not done so, please refer to the previous article and have the gateway device ready before proceeding with the steps in this article. There are 2 ways of installing Azure IoT in your RPi.
Option 1: Installing IoT suite by compiling the source code.
- Navigate to https://github.com/Azure/azure-iot-sdks and copy the git url to the clipboard
- Connect to your RPi using Bitvise SSH Client and clone the project to your working directory
Shell1git clone https://github.com/Azure/azure-iot-sdks.git
- Now you should have the project cloned in your working directory
- Navigate to the node folder in your local copy of this repository (azure-iot-sdks). Run the build/dev-setup.sh script to prepare your development environment. it will take a while to complete the build. so, please be patient.
- Then run the build/build.sh script to verify your installation. if the build is completed successfully you should not see any errors.
Option 2: Installing IoT suite by using npm
- Go to your working directory and execute the following commands in the given order
Shell1234npm install -g azure-iot-device@latestnpm install -g azure-iot-device-amqp@latestnpm install -g azure-iot-device-http@latestnpm install -g azure-iot-device-mqtt@latest
Configuring Remote Device
After installing Windows IoT Azure SDK on your RPi, the next step of the process is to configure the device that you added in the second article. Follow the steps to have the device configured in the IoT hub.
- Execute the following command
- Log in to the IoT hub, select the newly added device and verify the device metadata defined in the above code.
This concludes the fourth article in the series. In the fifth and last article, I will explain how to send the sensor data captured from Arduino to the Iot Hub.