An Open-Source Smart Sensor Architecture for Edge Computing in IoT Applications

: Smart sensors are sensing devices that include computational and communication functionalities. In this work we present a reference model aimed at simplifying the implementation of smart sensors and their integration in IoT applications. The proposed model is micro-controller agnostic and it is viable in different scenarios ranging from the management of a single analog sensor to the orchestration of a heterogeneous array of sensors. The model is open-source and the implementation is available online as reference for the development of custom smart sensors. The evaluation of our framework shows that it can be implemented with limited overhead


Introduction
Sensors, communication and computational technologies are boosting the development and diffusion of new and innovative services.The automotive, smart-homes, smart-wearables industries are the sectors where the impact and exploitation of such technologies is particular evident.Smart sensors are sensing devices that include computational and communication functionalities.Computation functionalities are exploited in the management of simple or complex measurement strategies on top of the sensing technologies, usually analog transducers or trivial digital sensors wrapping an analog transducer.In addition to computation functionalities, the communication functionalities that a growing number of sensors implement, allow to remotely configure and collected data from the sensors in the context, for instance, of IoT applications [1].The architecture of COTS sensors is manufacturer specific and, although usually built on top of reprogrammable logic, the provided systems are static and seldom upgradable.
In this work we propose a flexible software-based smart sensor architecture that supports a wide variety of smart sensor devices.The proposed architecture supports both analog and digital sensors, single and array of even synchronized sensors, passive and active sensors.The model is upgradable by-design, enabling to change the behavior of the sensor on the basis of application requirements.An implementation of the proposed model is presented [2] with a performance assessment.The work organization is the following.Section 2 reports the state of the art on smart sensors implementing a model closely related to the one proposed in this paper, whereas Section 3 presents the model and its modules.Section 4 focuses on a specific implementation of the architecture that covers a typical scenario of interest and analyzes obtained performance.Eventually, Section 5 ends the paper summarizing obtained results and future directions.

Related Work
The literature is full of examples showing the application of smart sensor technologies in a wide variety of scenarios.Home automation, [3], is probably the field with the majority of examples.Smart refrigerators [4], intelligent ovens [5] and smart thermostats [6] are just few of them.But the agriculture and the food [7], the automotive [8] and the wearable [9] industries are other sectors showing a similar trend, with the growing application of smart sensors and the development of new application paradigms based on them.
The availability of programmable COTS systems is helping the diffusion of smart sensing technologies, enabling developers to easily move from ideas to prototypes, from lab experiments to the production of commercial products.Examples are [10], that presents a smart voltage and current monitoring system based on ATMEG328 micro-controller, and [11] that proposes and analyzes the implementation of a compact smart resistive sensor based on a ATxmega32A4.In [12], Nhivekar and Mudholker present an embedded system for data logging and remote monitoring, whereas in [13] Mallick and Patro present a smart sensor for photoplethysmography monitoring.In all the considered cases the ATmega328 micro-controller is used.Other examples based on a different microcontroller technology, such as the STMicroelectronics STM32 or the Nordic nRF51822, are also present into the literature.
All the literature examples implement devices that deal with the sensing process exploiting the computational and communication capabilities of a programmable logic.What differentiate our work from the literature is that the proposed architecture aims at being general enough to be applicable in almost all the scenarios in which a smart sensor has to be developed.Moreover, the proposed model decouples completely the internal logic of the smart sensor from the transducer and the system controlling the smart sensor.For systems adopting our model, this simplifies the introduction of updates in the measuring algorithm or in the transducer.A thorough description of the proposed model in the specific context of eHealth applications can be found in [14].

Smart Sensor Architecture
The considered architecture targets programmable hardware systems equipped with GPIO ports, serial and wireless communication interfaces.Examples of system that fit the target architecture are the AVR ATmega328, the Broadcom BCM2835, the ST STM32, and Nordic nRF51822.The architecture consists of three modules: (i) the Sensor Interface Module (SIM), (ii) the Communication Module (CM) and (iii) the Measuring Engine Module (MEM).Each module provides specific functionalities and interacts with the other modules following the model presented in Figure 1.The SIM is sensor/transducer specific and provides a general interface for the management of both analog and digital sensors.The MEM is the subsystem that implements the measurement logic of the sensor system.The functionalities provided by the MEM vary on the basis of the desired behavior of the sensor and may range from simple measurement scaling to the storage of several measurements and the computation of a summary of them or the application of complex models on the time series of stored values (edge computing model).Eventually, the CM is the module that manages the communication between the Smart Sensor system and external devices.

Smart Sensor with Analog Probing Transducer
In this paper we consider a smart sensor that uses a probe technology for sensing a liquid substance.In particular we consider a system using cyclic voltammetry liquid sensors as those considered in [15].In this case, the data expected by the Smart Sensor is an array of couples, each representing an applied voltage and the corresponding measured current.The evolution in time of applied voltages is a design choice that we do not consider here.
Figure 2 shows how the proposed architecture can be configured to support this typology of sensors.In the considered implementation, the MEM is in charge of performing a given number of cyclic measurements, store the collected data and, as soon as the number of desired cycles is completed, inform an external driving device that the data is ready.The external device can issue then a read message to ask for the collected vector.It is worth noting that the proposed model is just one of the possible implementations.Indeed, another interesting implementation can include in the MEM the functionalities that are usually applied on the collected vectors such as the extraction of features and the identification of a proper classification outcome.
The proposed model has been implemented and we performed an evaluation based on code profiling [16], in order to assess the time spent in each module of the architecture and compare the performance with those of a monolithic implementation.The evaluation aimed at quantifying the overhead of the proposed architecture.We ran 100 measurement trials, and, in each trial, we performed a complete cycle of measurements.The measured software overhead was negligible with a growth of the CPU busy time not greater than 1%.

Conclusions
In the paper we present a general framework for the implementation of Smart Sensors and we show its application on a scenario of interest.An implementation is presented too along with a performance assessment showing that our model can be implemented with a negligible impact on the performance of the smart sensor system.