This is the second part of the 5 part series on how to in get things connected to Internet. In the previous article, I set the stage for the series by explaining the background and the steps that are involved in the series to complete your first IoT project. In this article, I will explain how to setup and configure the heart of the project, Windows Azure IoT hub.
IoT Hub provides foundational services that are specifically designed for secure and reliable bi-directional device connectivity for millions of IoT devices, and enables device management for IoT solutions, at scale, for a diverse set of devices and device topologies. One of the main use of Azure IoT Hub is to gather telemetry from devices. More information on IoT Hub is freely available on the public domain. You may get more additional information on IoT hub in this article. In addition to Azure IoT hub, Microsoft has released Azure IoT Suite in public preview that abstracts existing IoT services like IoT Hub, Stream Analytics, DocuemntDB, Event Hubs, Azure Websites and other services allowing you to focus on the IoT question at hand rather than the implementation. At the time of writing, there are 2 base implementations provided. For this series, I will use the remote monitoring base implementation project.
Provisioning Remote monitoring IoT solution
This section will give you the step-by-step guidance on how to create a IoT remote monitoring site.
- Log in to https://www.azureiotsuite.com (Azure free trial subscription is sufficient for this)
- Click Select button on Remote monitoring tile(see image above)
- Provide solution name, region and the type of the subscription. You may have to enter a different solution name if the solution name is already taken. You will also be able to see the services that will be created as part of the solution that will help to determine the cost that will incur to host the solution on Azure platform.
- Provisioning the IoT remote monitoring application will take several minutes to be completed based on the time of the day and the region you have selected. you will be able to monitor the provisioning status on the provisioning page.
- Once the solution provisioning is completed you can directly go to the solution home by clicking Solution dashboard. however, I would like to draw your attention to the services that have been provisioned as a part of the solution. clicking on Azure management portal will take you to your management portal.
- Once you are in the management portal you will see all the required foundational services that are provisioned as a part of the IoT remote monitoring solution. This may give you a very good understanding of what services is required for a IoT solution as well as you may be easily determine the cost of hosting the solution on Azure platform.
Exploring remote monitoring solution
This section, I will show you the major components of the solution and how the site enables device management capabilities in secure manner. The hub menu identifies 4 admin menu items and 1 command menu item.
Solution dashboard is loaded by default when you navigate to the solution site. there are 3 main areas in the dashboard;
- Bing map : maps the location of each device that is defined in the device management list
- Telemetry History : Displays temperature and humidity data collected by the selected device.
- Alarm History : History of the predefined alarm triggers
The default solution will provision 4 simulated devices that generates random temperature and humidity data. as you can see in the image below, you can edit device metadata in the properties tab of each device. in addition to editing the metadata, you can disable the device, add rule to the device and send a command to the device from the IoT hub.
Third menu item is Rules where you can define various rules for each device.
Last menu item of the Hub Menu is the actions menu that will enable you to assign pre-defined actions on the device.
ADD A DEVICE
Add a device will enable you to add a device of your choice. this will be discussed in detail in the next section.
Provisioning remote monitoring devices
In the previous section, I have explained each menu item that is available in your IoT remote monitoring solution. in this chapter we will look at how a new device can be provisioned. the base solution allows us to create a simulated device that generates random device data. however, I am not interested in provisioning a simulated device as our objective is to connect a physical device to the internet and upload telemetry to the Windows Azure website. there are 3 steps involved in adding a physical device to the device management list. we will start by clicking ‘ADD A DEVICE’ menu item at the bottom left of the dashboard.
- Step 1: Choosing a device type. in this case, we will choose Custom Device and click Add New button.
- Step 2: Enter a Device ID and check if the id exists already. you may choose to have the system generate an id for you. however, manually entering an id would us enable a human readable id which make us easy to identify the device in the future rather than having a guid assigned to it by the system. after confirming that the id is unique to this solution, click create to provision the device.
- Step 3: Once the device is provisioned in the device management list, you will be able to retrieve information that will be used to configure your physical device to securely connect to the IoT hub. as you can see, there is a link to an article that explains how to configure a physical device. but, the article assumes that you are programming the device in C++ and lacks the information on how to configure the device to send data to the solution that we are working with.
After verifying and recording the device information, click Done to go back to the dashboard page. as you can see in the below image, the newly provisioned device is added to the device list. however, it is disabled until actual data is sent to the hub via the physical device.
Now that we have provisioned an IoT hub that is capable of receiving remote sensing data and provisioned a custom device in the device management list, our next step is to configure a physical device that is capable of collecting remote sensing data and upload them to the hub. in my next article, I will go through step-by-step on how to configure Arduino UNO micro-controller with Raspberry Pi.