Skip to content

rbuhler/arduino.coffeeCloud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

arduino.buhler.coffeeCloud

FromCoffeeToCloud

From Coffee to Cloud

The project From Coffee to Cloud aims at presenting an example of implementing Internet of Things (IoT) in a quick and easy way.

Use Case

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.

Design Thinking

Story Board

Prototype

Hana Cloud Platform

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.

Arduino

For the task of colleting data it will be used an Arduino board connected to a luminosity sensor.

Python

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.

Hands On

In order to handle the data collected by the hardware an infrastructure shall be prepared. For such job Hana CLoud Platforma provides the Internet of Things Service that makes the service way easer.

The support proposed implementation follows what is described next:

Internet of Things Services

IoTHana

  • Form the SAP HANA Cloud Platform Cockpit root;
  • Left Panel:
  • Choose Services;
  • Enable Internet of Things;
  • Choose Go to Service.
### Data Base In order to create a new binding for the IoT service tables into the Hana XS infrastructure it makes necessay a little customizing.

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.

Arduino

Arduino and Luminisity Sensor

Sketch

Library ArduinoJson

JSON

args:[{
	account,
	device,
	devToken,
	messType,
	proxy,
	messages : [{ 
			index, 
			sensor, 
			timestamp, 
			value, 
			user
		}]
	}]

Python

Python - From Coffee to Cloud

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

Real World

Observation Tower

Observation Tower

Cofee Machine

Coffee Machine

More Info and Supporting Tools

Source of information

Google Chrome add-on Postman

Chrome Web Store Postman Rest Client

  1. Enter the device ID at the end of the URL; (Send and receive messages through HTTP)
  2. Authorization: OAuth2;
  3. Headers:
  • Authorization - Bearer
  • Content Type - application/json
  1. Change from Get to Post;
  2. Body:
{
        "mode":"sync",
        "messageType":"<Message ID>",
        "messages":[
            {
                "sensor":"sensor1",
                "value":"20",
                "timestamp":1413191650   
            }
        ]
}
  1. Click Send.

Rodrigo Bühler

About

Luminosity sensor for coffee machine ready light

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published