The project From Coffee to Cloud aims at presenting an example of implementing Internet of Things (IoT) in a quick and easy way.
The use case is the monitoring of a coffee machine where a luminosity sensor keeps reading the ready light until it gets on, meaning coffee ready to be served. This way its status can be monitored remotely by the interested users (coffee addicted).
For such an application it makes necessary the join of front end and backend software development together with an integration with hardware for collecting data from the external world. In a try to bring to this example more simplicity it was chosen the support of SAP cloud environment, the programming language Python and Arduino hardware compatible.
Making use of the Hana Cloud infrastructure, more preciselly the Internet of Things (IoT) Service, it will be prepared an environment to receive and share data collected from a device.
- SAP Hana Cloud Platform Cockpit
- Help - SAP HANA Cloud Platform Internet of Things Services
- Youtube - Internet of Things (IoT) Services
For the task of colleting data it will be used an Arduino board connected to a luminosity sensor.
The reading is sent via serial port to a auxiliar device that's listening such port. The data is packed and sent to the cloud infrastructure.
The support proposed implementation follows what is described next:
- Form the SAP HANA Cloud Platform Cockpit root;
- Left Panel:
- Choose Services;
- Enable Internet of Things;
- Choose Go to Service.
SAP HANA Cloud Platform Cockpit
-
Form the SAP HANA Cloud Platform Cockpit root;
-
Left Panel:
-
Persistance;
-
Database & Schemas;
-
Pushbutton New;
-
Inform a Database ID;
-
Choose Database System: HANA MDC;
-
Enter Password;
-
Repeat Password; (notice that the user is SYSTEM)
-
Choose Save.
-
Form the SAP HANA Cloud Platform Cockpit root;
-
Left Panel:
-
Applications;
-
Java Applications;
-
Choose the IoT application;
-
Configuration;
-
Data Source Bindings;
-
Delete the current binding;
-
Choose New Binding;
-
Enter a Data Source;
-
Choose DB/Schema ID;
-
Enter Database User : SYSTEM;
-
Enter Password;
-
Choose Save.
-
Form the SAP HANA Cloud Platform Cockpit root;
-
Left Panel:
-
Applications;
-
Java Applications;
-
Choose the IoT application;
-
Choose Overview;
-
Choose Stop pushbutton;
-
Choose Start pushbutton.
JSON
args:[{
account,
device,
devToken,
messType,
proxy,
messages : [{
index,
sensor,
timestamp,
value,
user
}]
}]
Algorithm
BEGIN
read port
if read is FALSE
print "Error message"
else
create JSON_Header
HTTPpost JSON_Header
loop
read port
adjust JSON_Message
HTTPPost JSON_Message
delay 3
endloop
endif
END
Chrome Web Store Postman Rest Client
- Enter the device ID at the end of the URL; (Send and receive messages through HTTP)
- Authorization: OAuth2;
- Headers:
- Authorization - Bearer
- Content Type - application/json
- Change from Get to Post;
- Body:
{
"mode":"sync",
"messageType":"<Message ID>",
"messages":[
{
"sensor":"sensor1",
"value":"20",
"timestamp":1413191650
}
]
}
- Click Send.
Rodrigo Bühler
- About Myself
- At SAP Community
- At LinkedIn