In this blog post I am sharing the details of a sample application which we tried to create for Hackathon 2016 at Infosys Chennai.
We wanted to develop an full stack application around HCP IOT services touch basing other functionalities also like PAL libraries, consuming web service etc .so we finalized with the below use case
Use Case
Precision irrigation controller using arduino microcontroller and soil moisture sensors powered by SAP HCP is the use case we finalized. and to understand the application I will talk about the irrigation domain a little bit.
basically what we are trying to do here is based on soil moisture sensor reading we are switching on or off the pump. There are 2 parameters which are relevant and basic in irrigation controller
Field capacity and permanent wilting point. I won't go much details into these, you can just assume field capacity is the maximum point where we need to switch off the pump and permanent wilting point is the minimum threshold below which the soil moisture should not drop.so we will have a point above PWP where we will switch on the pump.
Also the application leverages the weather prediction information before switching on the pump.ie) If there is a rain forecast for the current day then the pump won't switch on though the soil moisture sensor reading falls below the PWP.
we get weather forecast from weather underground web service and we enrich the forecast information by historical data using linear regression from PAL libraries
below is the application architecture
Disclaimer: We were not able to convert the full architecture into an working application within given time. its partially complete(around 60%).I will be sharing codes and modules in the further posts .please pardon me if its in bits and pieces. Nevertheless it will be helpful as we were able to finish the vital integration part of the application
First let me start with what are things not available in the application from the architecture
1.There is no UI5/HTML part to interact with the application. all the interactions are done via the IDE
2.We didn't integrated the weather underground web service with the application. we hard coded the value for competition sake.
I have attached the code files. and description below
File Name | Description |
---|---|
moisture_pump.ino | Its the arduino code which needs to be uploaded into arduino |
node_internetrelay.js | Its node.js code which is the integration module between arduino and SAP HCP.It handles the http communication between arduino and HCP.basically it does 2 communications, POST the soil moisture sensor reading to HCP and Get the Pump output signal from HCP |
node_main.js | Its the main controller code of the application. It basically reads the sensor values from the HANA tables and decides whether or not to switch on the pump. |