Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
IoT/M2MIWG/Demonstrator
Contents
The M2M Industry Working Group is working on setting up a demonstrator of the technologies that are being developed under its umbrella.
It has been decided to go with the use case of a connected greenhouse, reporting its status (temperature, humidity, luminosity) and being controllable (turning artificial lighting on/off).
Purpose
Members of the M2M Industry Working Group or interested parties are invited to use the same setup for showcasing their commercial products based on the Eclipse M2M projects, and promoting the interoperability of their solutions.
For members of the IWG only, it will be possible to promote their solution on m2m.eclipse.org in the form of a small description and a link to their own website.
Suggestions of "commercial" scenarios
- connect the Raspberry Pi based greenhouse to your commercial server product using MQTT or M3DA
- promote an implementation of the greenhouse using your commercial embedded framework but connect it to the public m2m.eclipse.org broker (M3DA or MQTT)
Demonstrator setup
Overview
Hardware
- a table top green-house
- an Arduino UNO : http://arduino.cc/en/Main/ArduinoBoardUno for sensor acquisition
- a light sensor : http://www.seeedstudio.com/depot/grove-light-sensor-p-746.html?cPath=25_27
- a moisture sensor : http://www.seeedstudio.com/depot/grove-moisture-sensor-p-955.html?cPath=25_27
- a temperature sensor http://www.seeedstudio.com/depot/grove-temperature-sensor-p-774.html?cPath=25_27
- a servo for opening the greenhouse http://www.seeedstudio.com/depot/emax-9g-es08a-high-sensitive-mini-servo-p-760.html?cPath=39_41
- a Raspberry Pi : http://www.raspberrypi.org/faqs for running Mihini and communicating with the m2m.eclipse.org server
Software
A new section on m2m.eclipse.org website will feature a Web UI displaying the live value coming from the greenhouse sensors as well as allow to send commands (switch light on/off). The live stream of a webcam pointed towards the greenhouse will also be included on this page.
Source code of the demonstrator (Mihini and Arduino embedded + Web UI) will be available on Mihini examples source code repository: http://git.eclipse.org/c/mihini/org.eclipse.mihini.samples.git
REST API
The Raspberry Pi gateway bridging the greenhouse sensors to the Internet is running Mihini and communicating with m2m.eclipse.org using M3DA.
The gateway's deviceID is: RPI000000006f257df2
The Mihini application running on the gateway is managing a greenhouse
asset that has a data
tree node holding all the values related to the sensors, that is:
-
luminosity
- an integer indicating the luminosity level in the greenhouse -
humidity
- an integer indicating the humidity level in the greenhouse -
temperature
- an integer indicating the temperature in the greenhouse -
open
- a boolean indicating whether the roof is opened or not
Getting sensor data
An HTTP GET on the following URL: http://m2m.eclipse.org/m3da/clients/RPI000000006f257df2/data returns a JSON document containing the latest values sent by the Mihini application.
More specifically, there are entries for all the values of the greenhouse
asset.
{ "greenhouse.data.luminosity": [{ "value": [69.626168224299], "timestamp": "1369418402000000" }, { "value": [56.666666666667], "timestamp": "1369418401000000" }], "greenhouse.data.humidity": [{ "value": [41.555555555556], "timestamp": "1369418402000000" }, { "value": [37.333333333333], "timestamp": "1369418401000000" }], "greenhouse.data.open": [{ "value": [true], "timestamp": "1369418402000000" }, { "value": [true], "timestamp": "1369418401000000" }], "greenhouse.data.temperature": [{ "value": [25.745177707255], "timestamp": "1369418402000000" }, { "value": [25.745177707255], "timestamp": "1369418401000000" }] }
Sending commands
You should do an HTTP POST on the http://m2m.eclipse.org/m3da/clients/RPI000000006f257df2/data URL, with a payload in the form of a JSON document indicating what values to update on the Mihini system. Since the Mihini application has registered callbacks on specific data paths, this is a way to execute commands, like e.g. closing the roof, by posting the following JSON document:
{ "settings" : [{ "key" : "greenhouse.commands.data.toggleRoof.state", "value" : false }] }