# A Social Environmental Sensor Network Integrated within a Web GIS Platform
## 3 Implementation
### Network Architecture  
Data management and storage are the main activities of the proposed sensor network and are supported by exploiting both preexisting hardware capabilities and also extensions of the YUN. It is worth noting that several distribution methodologies exist for both portable and fixed monitoring devices. Portable sensors are dependable to the Android device in order to assert its networking capabilities (Figure 3). Consequently the YUN transmits the data via Bluetooth connection to the mobile device, which then is responsible to forward these readings to the server for further manipulation. On the other hand, fixed nodes set aside Android connectivity and directly forward the readings  
Figure 1: Sensor Circuit schema. Figure 2: Sensor node in bulk form. through WiFi. Both module types are time synchronous through a Unix Timestamp [30] function that is embedded on deployment. Additionally, during mobile monitoring the system validates time-stamp with satellite timing provided by GPS Atomic Clock [31]. This technique expands the recording accuracy of the system's recognition of time related patterns. A Client-Server schema has been developed for the purpose of the study, utilizing open source software and Cloud Computing technologies. Supportively an MQTT [32] broker has been set up in order to insure the continuity of operation between base station and the server. Heroku [33] is a cloud platform-as-a-service (PaaS) on which a server has been deployed through Node.js [34] to host the operation of the database. Both database design and implementation have been developed through the non-relational Database Management System MongoDB [35]. Therein, every recording is handled as a GeoJSON [36] element by the database to be used subsequently by the Android app. A fragment of the transmitted data in GeoJSON format is depicted below:  
``` { \"_id\": { \"Soid\": \"S8188b45914b700011f6 dbff1\" }, \"deviceId\": \"mob001\", \"sensorType\": \"mobile\", \"timestamp\": { \"Sdate\": \"2016-11-01T14:32:03.0002\" }, \"goo\": { \"type\": \"Point\", \"coordinates\": [ 23.77108281, 37.94333254 ] }, \"humidity\": 38.2, \"temperature\": 24.8, \"heatIndex\": 24.33, \"luminosity\": 56, \"methane\": 4.73, \"co\": 38.66, \"noise\": 39

Figure 3: Communication architecture. ## 4 Application Framework

The Android platform has been designed to offer numerous hardware and software capabilities to assist development and functioning of heterogeneous types of applications. Upon investigation, the aforementioned capabilities have been proven to fulfill the requirements of the proposed system and its dependencies on complex tasks that require hardware components and are related to the flow of collected data. The implemented app has been designed to exploit the Bluetooth, GPRS, WiFi and GPS capabilities of the mobile phone, which are the prerequisites in terms of the phone's specifications so as to enable data acquisition and collection from the YUN, location tracking and data transmission. Data may then be forwarded to services for database provisioning and cartographic representation. To avoid message flooding, the app's operating sequence is initiated by the pairing between the sensor and the Android device via Bluetooth and consists of several intervals of predefined duration. Each recording consisting of a set of measurements from all sensors is instantly transmitted as a string message to the phone. This message is enhanced with the exact geographic location of the device and a time stamp (Figure 4). The message is then transformed to the GeoJSON format and transmitted to the MQTT broker, which then forwards it to the server. This flow of data to the dynamic repository enables the interactive mapping operations that allow cartographic representation of the recorded data. The latter is implemented in the server that stores all recordings to the MongoDB database and additionally manages and analyzes the content through logical queries.