This was a Hackathon of the Nervousnet project (http://www.nervousnet.ethz.ch/), a hacking event made for developers, entrepreneurs, data specialists, early adopters, end users and everybody else interested in building and enforcing Digital Democracy together.
Nervousnet is a decentralized Internet of Things platform for privacy-preserving social sensing services provided as public good. It is implemented as a mobile app and it is open source under the GPL v3 license. Nervousnet is capable to collect and manage sensor data from Android and iOS smartphones by letting users self-determine the data they locally preserve and the data they remotely share. This forms the main privacy-by-design functionality of the nervousnet backend. A lightweight local analytics engine residing in the Nervousnet backend provides a high-level API for developers to build data-driven applications. Analytics can be also performed across devices with an implementation of a truly decentralized and privacy-preserving Big Data paradigm: the global analytics engine.
This Hackathon provided three types of challenges for online and remote participants to contribute to, with money prices ranging from 400 CHF (3rd place) to 1.000 CHF (1st place) per category. The challenges were as follows
1 - Design and Development of the:
Here you find opportunities like for e.g. extending the API of the local analytics engine, implementing communication security or integrating web views and an application store.
2 - Design and Development of:
Here you can build your own data-driven applications. Some examples: earthquake detection, localization and navigation, ambient assisting living, smart homes, IoT games and more. There will be new LoRa sensor nodes to play with!
3 - The nervousnet:
Come up with your own data summarization algorithm that guarantees the highest privacy protection level and at the same time performs accurate data analytics.
I did the first challenge. I decided to not only use smartphones to interact with this social privacy-preserving system, but extend it to smart devices like microcontrollers sensing our homes or public buildings. Actually, if we look into the envisioned architecture for Nervousnet at this point, IoT should be accounted for (and so, that's what I did):
With the code I developed (and available here on GitHub), you are able to use a specific microcontroller (Arduino), with a wifi shield on top of it (but can be used with Ethernet shield or anyother thing, with proper adaptation) and a Sensor of your choosing (I chose to mimic an axelerometer), to save one sensor Data to the backbone of Nervousnet (called Router, in the code). With the code, I provide a mysql Data Base which is a preliminary (still) centralized approach to Nervousnet Backbone, and presents a ten fold of different types of sensors (in the github link I provided, this is the file), being them:
Of these sensors, I used Arduino to publish dumy sensor data for the Accelerometer sensor (because I didn't actually have the hardware sensor with me, but that's changeable). This code is composed by a file to be flashed into the microcontroller (Here's the code for Arduino), a Java Server (composed by Netbeans and Glassfish application server, Here) providing the web interface between the microcontroler and the Nervousnet database, and the Nervousnet mysql DB (Here).
Considering the fact we had less than some practical 24H of hands on coding, you're not finding here a neat, full bullet proof code. I'm ok with that, and so should you.
The integration with the microcontroller was also done by Web Services; Previous integrations with both the smartphones and the backbone servers have been done by Google Protocol Buffers, and I also wanted to challenge this (not challenging, but enabling other Protocols to be used, and stretch Nervousnet's compatibility). As such, I used SOAP RESTful web services:
In the image above we get to see the communication between the microcontroller and the Nervousnet Backbone server I created through SOAP envelopes, XML communication (JSON can be used as well :P ). As I emulated an accelerometer sensor, the request I do in here (coming from the Arduino) has 3 values with it (X, Y and Z directions of the acceleration sensor). The answer from the backbone server is either a "true" or "false", meaning "YES, I recorded your data in the database", or "No, I didn't understand what you wanted, and so I failed to act".
Using stuff, the behavior of the Arduino is as follows:
And the result of this communication initiated by the Arduino is the following, registered in the database: