The analysis of the state‐of‐the‐art on the BSN domain has highlighted that the development of BSN applications is to date a complex task also due to the lack of programming frameworks with dedicated support to the distinctive requirements of BSN systems.
To support the programming of optimized BSN applications while minimizing the development time and effort, we have designed and realized SPINE (Signal Processing In‐Node Environment) [1–3], an open‐source domain‐specific programming framework for BSNs.
SPINE aims at boosting the prototyping of BSN applications. SPINE enables efficient implementations of signal‐processing algorithms for analysis and classification of sensor data through libraries of processing functionalities. It is organized into two interacting macro‐components, which are, respectively, implemented on commercially available programmable sensor devices and on the personal coordinator (Android smartphones and tablets, or a personal computer). Communication among these devices is wireless, using Bluetooth or IEEE 802.15.4 standards. The high‐level SPINE API (at the coordinator level) allows for dynamic and flexible configuration of sensing and processing functionalities available at the sensor node level. Many biophysical sensors and signal‐processing tasks are natively implemented and available to application developers. In addition, the SPINE framework has been carefully designed to allow for very easy integration of new, custom‐defined sensor drivers and processing tasks. A key advantage of adopting SPINE is its ability to configure the BSN system based on specific sensing and processing requirements; in this way, the same sensors can be used by different applications without requiring off‐line reprogramming before switching from an application to another.
TinyOS [4] is an event‐driven operating system, which provides a programming environment for embedded systems. It has a component‐based execution model implemented in the nesC language [5] with a very low memory footprint.
TinyOS concurrency model is based on commands, asynchronous events, deferred computation called tasks, and split‐phase interfaces. The function invocation (as command) and its completion (as event) are separated into two phases in interfaces provided by TinyOS. Application user has to write the handler, which is invoked upon the triggering of an event. Commands and event handlers may post a task, which is executed by the TinyOS FIFO scheduler. These tasks are non‐preemptive among each other and, thus, run to completion. Only an (asynchronous) event can preempt running tasks. Data race conflicts that arise due to preemption can be solved using atomic sections.
Radio communication in TinyOS follows the Active Messages [6] model, in which each packet on the network specifies the ID of the handler that will be invoked on the recipient nodes. The handler ID is an integer that is carried in the header of the message. When a message is received, the event associated with the handler ID is signaled. Different sensor nodes can associate different receive events with the same handler ID.
The development of SPINE, as a domain‐specific BSN middleware (MW), is motivated by the need of providing more effective solutions than naïve application‐specific programming and a more efficient approach than general‐purpose programming frameworks. It has been demonstrated that in the BSN domain, domain‐specific frameworks contribute to reduce the development cycle and maintenance since they provide high‐level abstractions of network protocols and hardware details, allowing the programmer to focus mainly on the application logic without the burden of carrying the overhead of general‐purpose functionalities that are, in practice, not used in the BSN domain (e.g. multi‐hop support).
The main challenge during the design of SPINE was to find the most effective trade‐off between high‐level API definition (i.e. fulfillment of requirements in the BSN programming domain) and the limitations given by strongly resource‐constrained sensing devices.
SPINE is a full‐fledged and extensible solution that allows rapid prototyping of BSN‐based applications and systems. It allows quick implementation of distributed signal‐processing intensive applications by supporting several physiological sensors, in‐node and on‐coordinator signal‐processing utilities, wireless transmission of biosignals, and built‐in optimized network and resource management. SPINE is designed as a modular structure to simplify the integration of additional sensor drivers and signal‐processing modules; in addition, the framework itself can be tailored and customized by a simple mechanism to combine all the sensing and processing modules altogether, according to specific application requirements. A key advantage of adopting SPINE is its ability to configure the BSN system based on specific sensing and processing requirements; in this way the same sensors can be used by different applications without requiring off‐line reprogramming before switching from an application to another. SPINE supports BSN networks that are conceptually organized in a star‐topology, with the sensor nodes representing the edges and the coordinator unit the center of the star. Direct node‐to‐node communication is also possible, although the predefined processing functionalities do not need it. It is worth noting that SPINE devices communicate atop an application‐level protocol, so it is in principle possible to use a multi‐hop network layer to realize systems that are based on a physical network in which the coordinator and the nodes are more than one hop distant.
In the following, we describe the software architecture of SPINE, its High‐Level Data Processing module, and finally discuss its heterogeneous support of sensor and coordinator device platforms.
A high‐level representation of the SPINE architecture is shown in Figure 3.1. The SPINE MW is partially located at the coordinator device and partially on the wearable sensors. The MW provides an API both on the coordinator and the sensor nodes to support the development of applications that finally rely on the platform‐independent communication protocol layer. This protocol represents an abstraction layer including diverse platform‐dependent communication adapters that are dynamically loaded at the coordinator, whereas are linked at compile time at the sensor‐node level.
Figures 3.2 and 3.3 show, respectively, the architecture of the SPINE Node(s) and SPINE Coordinator components. The former is implemented in the sensor platform‐specific embedded programming language and is placed on each BSN sensor node; the latter is implemented in Java and runs on the coordinator device (an Android porting of the SPINE Coordinator has also been realized).
The SPINE Node (see Figure 3.2) consists of four main components:
The SPINE Coordinator (see Figure 3.3) consists of two main components:
Table 3.1 API exposed by SPINE at the coordinator station.
Functionality | Description |
discoveryBsn | Inquiry node discovery and supported sensing and processing capabilities |
setupSensor | Allows individual specification of sampling rates for multiple sensors |
setupFunction | Setup a preliminary configuration of available processing functionalities |
activateFunction | Enables the execution of one or multiple in‐node (periodic or trigger based) signal‐processing functionalities |
startBsn | Issues a broadcast message to the BSN to command a synchronized start of sensing and processing functionalities that have been previously setup and enabled |
resetBsn | Issues a broadcast message to the BSN to command a synchronized reset of the nodes |
Event | Description |
newNodeDiscovered | Registered SPINE listeners are notified when a new BSN node is discovered |
discoveryCompleted | Registered SPINE listeners are notified when the BSN discovery procedure is terminated |
dataReceived | Registered SPINE listeners are notified when new user data sent from a specified node are received by the coordinator |
serviceMessageReceived | Registered SPINE listeners are notified when a service message (e.g. warning or error notifications) sent by a specific node is received by the coordinator |
From a programming perspective, SPINE provides an intuitive Java API (documented in Chapter 12) for convenient BSN management to easily support node discovery, sensing operations, signal processing, and data communication. In addition to several sensor natively supported and pre‐defined processing functions, SPINE is designed such that framework tailoring (i.e. customization and extension) becomes very straightforward.
The SPINE MW is completed with “optional add‐on” modules available only on the coordinator node; they represent an important aspect, despite not being part of its core architecture:
The High‐Level Data Processing module is an optional SPINE plug‐in that empowers the core framework functionalities with additional signal processing and decision‐support algorithms (e.g. signal filters, pattern recognition, classification, etc.). This module is available at the coordinator level and provides robust support throughout the typical signal‐processing workflow, from sensor data acquisition up to classification (see Figure 3.6).
A layered representation of the High‐Level Data Processing component is depicted in Figure 3.7. SPINE acts as a MW layer between this module and the underlying BSN. On top of SPINE, a set of converters are placed to convert SPINE data representations into more abstract objects, Datasets and Signals. Data mining and machine learning tools can therefore transparently handle BSN data, since the module can also generate WEKA‐compliant Comma Separated Values (CSVs) and Attribute‐Relation File Format (ARFF) files. Finally, a collection of functionality wrappers further support rapid implementation of common tasks needed during the development of SPINE applications. A typical use of this module is described in detail in the following.
BSN sensory data are retrieved with SPINE and converted into more convenient data structures (Signal and Dataset objects, depending on application‐specific requirements). Then, developers can optionally apply filtering and segmentation to incoming signals. Feature Extraction algorithms are also available and they are useful when in‐node feature extraction functionalities provided by SPINE are not enabled (i.e. SPINE is used to acquire raw sensor signals). To support the initial problem analysis, several feature selection algorithms are provided to identify the most significant subset of extracted features to reach satisfactory classification accuracy. Finally, the classification phase is widely supported, including training. A few algorithms are implemented and ready‐to‐use; in addition, developers may easily integrate further classifiers, especially thanks to the choice of providing support for using WEKA libraries.
SPINE supports a heterogeneous plethora of hardware platforms, sensors, programming languages, and operating systems; these make this framework suitable for diverse application scenarios (such as smart‐Health and e‐Fitness), in which, due to specific requirements, only certain hardware/software sensor platforms might be used.
SPINE supports the most common sensor motes. The TinyOS implementation runs on MicaZ, TelosB, and Shimmer/2/2R [8] (for the latter, SPINE supports both IEEE 802.15.4 and Bluetooth radios). This implementation includes a security function using hardware AES‐128 encryption of the CC2420 radio. In addition, there exist SPINE implementations for ZigBee devices (like the Telecom Italia “Bollino”, equipped with the CC2530 System‐on‐Chip) based on Texas Instruments Z‐Stack and for Java‐based Sun SPOT nodes [9]. SPINE also notably provides native support for several physical sensor transducers, including accelerometers, gyroscopes, electrocardiogram, electro impedance plethysmography, temperature, humidity, and light.
In addition to sensors and platforms supported by default, SPINE is designed in such a way that it is easy to integrate further drivers for other sensors and even add support for new platforms. The same happens for the processing functions: integrating additional feature extractors (and even simple classifier algorithms) is straightforward.
At the coordinator level, SPINE supports heterogeneous mobile and desktop devices, as depicted in Table 3.2. Originally, Windows‐ and Linux‐based computers were supported through the SPINE Java SE implementation. However, with the spread of smartphones and tablets having more than sufficient computation and storage capabilities to support mobile‐health applications and (almost) continuous Internet connectivity (through which it is possible to transmit raw signals and high‐level information to remote servers or in the cloud), we put significant efforts to obtain mobile SPINE coordinators since their use is particularly useful (sometimes strictly necessary) when continuous, outdoor mobility is required and is not possible to rely on fixed infrastructures. A JavaME porting of the framework has been in fact realized. A limited QT implementation is also available and runs on Symbian and Windows smartphones, enabling Bluetooth communication with Shimmer nodes using the third‐party QBluetooth library. Finally, and most significant, an Android implementation of SPINE has been more recently developed. SPINE Android has been evaluated on several devices (that have been connected to Shimmer nodes over Bluetooth).
Table 3.2 SPINE‐tested mobile personal devices.
Device | CPU | RAM (MB) | Miscellaneous |
HTC Nexus One | 1 GHz, Snapdragon QSD 8250 | 512 | Android 2.x., MicroSD, up to 32 GB |
Samsung Galaxy S | 1 GHz, ARM Cortex‐A8 Dual‐Core | 512 | Android 2.x., MicroSD, up to 32 GB |
Samsung Galaxy S4 | 1.9 GHz, Snapdragon 600 Quad‐Core | 2048 | Android 4.4.2., MicroSD, up to 64 GB |
Huawei P8 | Quad‐core 2.0 GHz Cortex‐A53e+Quad‐core 1.5 GHz Cortex‐A53 | 3096 | Android 6.0, MicroSD, up to 128 GB |
Samsung Tab2 10.1 | 1.0 GHz, ARM Cortex A9 Dual‐Core | 1024 | Android 4.0.3., MicroSD, up to 32 GB |
Samsung Note3 | 2.3 GHz, Snapdragon 800 Quad‐Core | 3096 | Android 4.4.2., MicroSD, up to 64 GB |
Nokia N95 | 332 MHz, TI OMAP 2420 (ARM11‐based) | 128 | Symbian OS v9.2, S60 rel. 3., MicroSD, up to 32 GB |
Nokia 6120 | 369 MHz, ARM11 | 64 | Symbian OS v9.2, S60 rel. 3.1., MicroSD, up to 8 GB |
Finally, SPINE provides a Java‐based emulation environment that virtualizes generic sensor nodes. With this tool, it is possible to emulate a SPINE‐based BSN, provided that a dataset is available for each node. Hence, each emulated node is equipped with emulated sensors defined by its given dataset. The SPINE emulator is helpful in various situations; for example, to simplify testing and debugging, processing functionalities can be initially implemented in the emulated environment. In addition, the emulator, along with a simple dataset, has been released in open‐source to allow interested developers for investigating the potential of the SPINE framework itself, even if they are not equipped with real wireless sensor nodes.
In this chapter, SPINE, a domain‐specific programming framework, has been presented. The main goal of SPINE is to provide BSN developers with support for rapid prototyping of signal‐processing applications. In SPINE, sensors and common processing functionalities, such as math aggregators and threshold‐based alarms, can be configured independently and connected together arbitrarily at runtime based on external controls.
Hence, one of the main achievements of SPINE is the reuse of software components to allow different end‐user applications to configure sensor nodes at runtime based on the application‐specific requirements without off‐line reprogramming when switching from an application to another. Furthermore, thanks to its modular component‐based design approach, SPINE enables a great degree of heterogeneity: a wide variety of hardware platforms, sensors, programming languages, and operating systems are supported. This allows for a very flexible and usable framework in different BSN application scenarios, where, due to specific requirements, only certain platforms or operating systems might be used.
18.191.223.123