In the last blog I have explained the code that reads the sensors data, process it and sent to Cloud storage, in this case it is Azure Services.
First created an Azure IoT Hub using the Azure portal as described here. I am using my Biz Spark subscription for this.
Then provisioned a device in the above IoT Hub and got the Device Connection String, which is set in the device software in the azure1_config,h as shown below. Actually this device name / id will follow a format which is yet to be decided. The provisioning will final be done from a Mobile App.
#define AZUREIOTHUBCONNECTIONSTRING "HostName=esm-iot-hub.azure-devices.net;DeviceId=P-NUCLEO-AZURE1-Test;SharedAccessKey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Currently used Device Explorer utility provided by Microsoft is used to confirm that the data is received by the IoT Hub as shown in the following image.
The data received by IoT Hub will be stored in Azure Storage / SQL database which will be displayed by the Mobile App using Azure App Service. Currently this part is being designed and coded.
Mobile App Menu Contents:
In the last blog I have shown the glimpse of the Mobile App Main Menu, which is show below. The functionality is explained here.
When the app is started it will be showing the Home page as shown below
Tapping the 'Hamburger' icon at the top left corner shows the Main Menu shown earlier. Tapping the [NEW DEVICE] button will allow to add a new device to the Azure IoT Hub. Tapping the [ABOUT] button will show the details about the app. Tapping the [START RECIVING DATA] button will start displaying the data as it is received by the IoT Hub. This will be in the form of a formatted table.
The Main Menu options are described below:
- Home (Live Data) - Shows the Home Page. This is used to return to the Home Page from any other page.
- Alerts - This will display the current and past alerts received. On app start, if there is an active alert the Alerts page will be displayed automatically.
- History - This system saves past 7 days data in the cloud storage. This past data will be shown here date-wise. This also includes the data received currently till the time of showing this page.
- Manage Cloud - This enables removing an existing device from IoT Hub. If no data is received from a device continuously for 2 days, that device will be 'disabled'. Such disabled device also can be enabled again here. Until it is enabled the data will not be received by the IoT Hub.
- Manage Device - This enables the setting of Wi-Fi credentials, IoT Device Connection String, Temperature Unit, Threshold Temperature and other necessary parameters in the device. This connects to the device through the Bluetooth.
- App Settings - This allows change of password and other app parameters be set.
- Setup New Device - This will walk you through the steps to setup a new device.
- About and Help - This shows the details of the app and help topics.
Currently researching on the components needed to connect the mobile app to Azure services. Once it is finalized more app pages will be designed and shown here.