14.11.2014 Views

Mobile Middleware for Wireless Body Area Network - IEEE Xplore

Mobile Middleware for Wireless Body Area Network - IEEE Xplore

Mobile Middleware for Wireless Body Area Network - IEEE Xplore

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

32nd Annual International Conference of the <strong>IEEE</strong> EMBS<br />

Buenos Aires, Argentina, August 31 - September 4, 2010<br />

<strong>Mobile</strong> <strong>Middleware</strong> <strong>for</strong> <strong>Wireless</strong> <strong>Body</strong> <strong>Area</strong> <strong>Network</strong><br />

Xiang Chen, Agustinus Borgy Waluyo, Isaac Pek, and Wee-Soon Yeoh<br />

Abstract— This paper presents a flexible, efficient and<br />

lightweight <strong>Wireless</strong> <strong>Body</strong> <strong>Area</strong> <strong>Network</strong> (WBAN) <strong>Middleware</strong>.<br />

The <strong>Middleware</strong> is developed to bridge the communication<br />

between mobile device as a gateway and the sensor nodes, and<br />

there<strong>for</strong>e it shields the underlying sensor and OS/protocol stack<br />

away from the WBAN application layer. The middleware is<br />

coded in the <strong>for</strong>m of lightweight dynamic link library, which<br />

allows the application developer to simply incorporate the<br />

middleware resource dynamic link library into their<br />

application and call the required functions (i.e. data<br />

acquisition, resource management and configurations). A<br />

showcase of the middleware deployment is exhibited at the end<br />

of the paper.<br />

Index Terms—lightweight middleware, mobile middleware,<br />

wireless body area network middleware.<br />

I. INTRODUCTION<br />

ecent advances of miniaturized sensor devices are<br />

Rcapable of collecting physiological data, carrying out<br />

processing of the data, and then wirelessly transmitting this<br />

in<strong>for</strong>mation to the gateway. This interaction is commonly<br />

known as <strong>Wireless</strong> <strong>Body</strong> <strong>Area</strong> <strong>Network</strong> (WBAN).<br />

In WBAN, energy efficiency is extremely critical as<br />

sensor nodes are powered by batteries. This issue together<br />

with the growing variety of sensor devices in the market,<br />

cause application development very difficult and time<br />

consuming, especially <strong>for</strong> those who are not familiar with<br />

networking protocol and real-time embedded OS. As such, it<br />

is natural to design a middleware that shields the underlying<br />

sensor hardware or OS/protocol stack from the higher-level<br />

applications.<br />

The proposed middleware helps to accelerate application<br />

developer by utilizing highly reusable codes or a common<br />

set of service API. The middleware supports mobile health<br />

monitoring application using WBAN. The main functions of<br />

this middleware include data acquisition, resource<br />

reconfigurations and resource managements. As the<br />

middleware is deployed in a mobile device, which has<br />

inherent resource constraints (i.e. limited memory and<br />

Manuscript received April 1, 2010. This work was supported by Science<br />

and Engineering Research Council (SERC) of the Singapore Agency <strong>for</strong><br />

Science, Technology and Research (A*STAR) on Embedded & Hybrid<br />

Systems II (EHS-II) programme under grant 052-118-0058.<br />

Xiang Chen is with the Institute <strong>for</strong> Infocomm Research (I 2 R), A*STAR,<br />

Singapore (e-mail: xchen@i2r.a-star.edu.sg).<br />

Agustinus Borgy Waluyo is with the Centre <strong>for</strong> Distributed Systems and<br />

Software Engineering, Monash University, Australia (e-mail:<br />

Agustinus.Borgy.Waluyo@infotech.monash.edu.au).<br />

Isaac Pek is with the Institute <strong>for</strong> Infocomm Research (I 2 R), A*STAR,<br />

Singapore (e-mail: ipek@i2r.a-star.edu.sg).<br />

Wee-Soon Yeoh is with the Institute <strong>for</strong> Infocomm Research (I 2 R),<br />

A*STAR, Singapore (e-mail: wsyeoh@i2r.a-star.edu.sg).<br />

processing power), it is particularly important to ensure an<br />

optimized system design and coding.<br />

Our preliminary work on WBAN middleware has been<br />

reported in [1]. In the earlier work, the middleware is<br />

designed as a separate application, which operates using<br />

socket programming. However, this approach is very much<br />

resource intensive and apparently not the best way to adopt<br />

especially when the host device is lightweight. In this paper,<br />

we present a new <strong>for</strong>m of middleware in dynamic link<br />

library (dll), which uses a call-back function instead of<br />

socket mechanism. The architecture of the middleware has<br />

been further optimized. The efficiency and size of this<br />

middleware as compared to its predecessor are shown in this<br />

paper.<br />

The subsequent section is organized as follows. A detailed<br />

description of the proposed middleware can be found in<br />

Section II, followed by a showcase of the middleware<br />

deployment in Section III. Finally, Section IV concludes the<br />

paper.<br />

II. MOBILE MIDDLEWARE FOR WBAN: ARCHITECTURE AND<br />

FUNCTIONALITIES<br />

The proposed mobile middleware is designed to support<br />

multi-modal sensors, allowing different sensors types (e.g.<br />

accelerometers, and ECG) to co-exist and transmit to a<br />

common gateway.<br />

A. Overview<br />

The <strong>Middleware</strong> supports two-way<br />

communication/interaction from applications to the<br />

underlying sensor nodes. The programs that constitute the<br />

WBAN <strong>Middleware</strong> reside in both the sensor nodes (Lower<br />

<strong>Middleware</strong>) and the PDA (Upper <strong>Middleware</strong>). Figure 1<br />

illustrates the overall system overview.<br />

The Lower <strong>Middleware</strong> programs are coded in nesC using<br />

TinyOS 2.1x, while the Upper <strong>Middleware</strong> is programmed<br />

in C#. The upper and lower layers communicate over<br />

wireless <strong>IEEE</strong> 802.15.4 (Zigbee) protocol, passing through a<br />

base station node. This node utilizes the native BaseStation<br />

program, provided by TinyOS.<br />

B. Lower <strong>Middleware</strong><br />

The Lower <strong>Middleware</strong> relates to the functions and<br />

processes inside the sensor node. The main tasks of this<br />

Lower <strong>Middleware</strong> are; (i) to establish radio communication<br />

with the sensor gateway, (ii) to support data sensing and<br />

reporting, (iii) to supply single node streaming service, (iv)<br />

to provide configurations capability and (v) to enable<br />

resource control and management. To realize this, the Lower<br />

<strong>Middleware</strong> incorporates several components, and provides<br />

a user defined function <strong>for</strong> the developer to utilize based on<br />

978-1-4244-4124-2/10/$25.00 ©2010 <strong>IEEE</strong> 5504


the nature of their application. The components and the<br />

functions are further described below.<br />

Sensor<br />

Gateway<br />

PDA(C#)<br />

<strong>Mobile</strong> Health Application<br />

<strong>Mobile</strong> <strong>Middleware</strong><br />

(Upper <strong>Middleware</strong>)<br />

<strong>Wireless</strong> Communication<br />

The ADC Channel should correspond to the physical<br />

hardware (i.e. the sensor should be physically connected to<br />

ADC Channel 1 - if “ADC_CHANNEL = 1” is specified).<br />

The Channel Number allows applications to determine the<br />

origin of the data in a radio packet. The channel number<br />

uniquely identifies each data stream originating from the<br />

sensor node (SingleChannelSensor only has one<br />

channel). The sampling rate parameter lets the developer to<br />

modify the sampling frequency of the sensor. To distinguish<br />

between different sensors, we provide sensor type parameter.<br />

Sensor Nodes<br />

(Lower <strong>Middleware</strong>)<br />

Figure 1. System overview<br />

• Components<br />

We have designed two Lower <strong>Middleware</strong> programs, one<br />

<strong>for</strong> a single stream of data coming out from the ADC (i.e.<br />

ECG) and another is <strong>for</strong> multiple data streams (i.e three-axis<br />

accelerometers), which is called SingleChannelSensor<br />

and MultipleChannelSensor, respectively. The<br />

graph component of the single stream of data is depicted in<br />

Figure 2. As can be seen from Figure 2, we employ<br />

BANMAC component as part of the program. This<br />

component is particularly responsible <strong>for</strong> the communication<br />

protocol between sensor nodes and sensor gateway. The<br />

protocol adopts a polling scheme, which follows a star<br />

topology and a master-slave model. This ensures that each<br />

sensor transmits the data reading at different times, and<br />

hence avoids collision. The BANMAC differs from standard<br />

polling in the sense that each transmission is preceded by a<br />

very short carrier sense period. A routine check to the<br />

channel in order to ensure it is free <strong>for</strong> transmission is<br />

carried out each time a packet is to be sent out. Further<br />

details of this BANMAC component can be found in [2].<br />

Other components include LedsC to control the light on the<br />

sensor, and a few Timers <strong>for</strong> data collection, sensor radio<br />

on/off, and battery reading.<br />

• User-defined Function and Parameter Setting<br />

The user-defined function and parameter setting are<br />

available to allow the application developer adjust the<br />

attributes of the parameters and process the data according to<br />

their requirements. Figure 3(a) indicates the parameter<br />

configurations in the header file. As shown in Figure 3(a),<br />

the appropriate ADC Channel (which the sensor is connected<br />

to) has to be specified.<br />

(a) Parameter configurations<br />

(b) User defined function<br />

Figure 3. Parameter configurations and User-defined function<br />

As an example, <strong>for</strong> accelerometer, the type is set to ‘1’,<br />

while ECG is ‘2’. The user-defined function as displayed in<br />

Figure 3(b), is called onBoardProcessing and supposed<br />

to be left empty by default. Developers can add in additional<br />

code which will be executed each time new data is<br />

successfully sampled. The Lower <strong>Middleware</strong> allows<br />

developers to per<strong>for</strong>m this function prior to data<br />

transmission. The example shown in Figure 3(b) divides the<br />

incoming data by 5 be<strong>for</strong>e they are transmitted out.<br />

C. Upper <strong>Middleware</strong><br />

The Upper <strong>Middleware</strong>’s role is to communicate with the<br />

Lower <strong>Middleware</strong> based on the given set of APIs. The<br />

architecture of the Upper <strong>Middleware</strong> can be seen in Figure<br />

4. We describe the call back function, reconfiguration and<br />

resource management features in the following.<br />

• Call back Function<br />

This call back function is implemented in the Upper<br />

<strong>Middleware</strong>, and is defined to serve the communication<br />

aspect between Upper <strong>Middleware</strong> and higher-level<br />

application.<br />

Msp430<br />

ADCxC<br />

(Sensorx)<br />

BANMessengerR<br />

(receiver)<br />

BANMessengerS<br />

(messenger2)<br />

Msp430<br />

ADCvC<br />

(Battery)<br />

Read<br />

<br />

BANReceive<br />

SingleChannelSensorC<br />

BANSend<br />

Read<br />

<br />

Boot<br />

Split<br />

Control Packet BANSend BANCtrl BANRadio<br />

Leds<br />

Ctrl<br />

Timer<br />

<br />

Timer<br />

<br />

Timer<br />

<br />

Timer<br />

<br />

MainC BANMessengerS BANMAC BAN<br />

(messenger1)<br />

Radio<br />

LedsC<br />

TimerMilliC<br />

DataCollection<br />

Timer<br />

TimerMilliC<br />

OneShot<br />

Timer<br />

TimerMilliC<br />

Toggle<br />

Timer<br />

TimerMilliC<br />

Battery<br />

Timer<br />

Figure 2. Lower <strong>Middleware</strong> components<br />

5505


Resource<br />

Control<br />

Command<br />

Application Layer ( <strong>Mobile</strong> Health Application)<br />

Notification<br />

and<br />

r esource<br />

in<strong>for</strong>mation<br />

Mote properties<br />

request and<br />

in<strong>for</strong>mation<br />

Incoming data streams<br />

with relevant mote ID and<br />

sensor type<br />

ResourceManager<br />

SensorHub MoteProperties<br />

Sensor Command<br />

Check Sensor<br />

Mote properties<br />

Request<br />

Response Interface<br />

update and<br />

in<strong>for</strong>mation<br />

Commands<br />

Sensor_RespMsg<br />

Incoming Data<br />

Resource<br />

Resource<br />

Streams and<br />

C heck Sensor Control<br />

In<strong>for</strong>mation<br />

set/update mote<br />

Command Interface Command<br />

Incoming Data<br />

properties<br />

Streams<br />

Sensor_CmdMsg SensorGateway<br />

DataManager MoteManager<br />

Mote<br />

updates<br />

Decrypts the<br />

Incoming Data<br />

Message<br />

Incoming and<br />

Outgoing Data<br />

Streams<br />

Check Sensor Data<br />

Interface<br />

Sensor_DataMsg<br />

COM port number of the attached base station node (see<br />

Figure 7). The SensorHub object is the main link between<br />

the application and the Upper <strong>Middleware</strong>. Each application<br />

should only create a single instance of SensorHub. A call<br />

to this function is necessary to begin receiving data from the<br />

sensor nodes. Without a call to this function, no<br />

data/responses from the sensor node network will be<br />

received by the application.<br />

SensorDecoder<br />

Sensor<br />

Nodes<br />

Gateway Node<br />

Encrypted <strong>Wireless</strong> Data Transmission<br />

SingleChannelSensor<br />

Multiple ChannelSensor<br />

Figure 4. Upper <strong>Middleware</strong> architecture<br />

This function replaces the threads in the socket<br />

programming. In this case, the application developer needs<br />

to define function delegates in which the Upper <strong>Middleware</strong><br />

will use to callback whenever new data/response arrives<br />

from the sensor nodes. As such, it is not necessary to<br />

maintain constant connection <strong>for</strong> checking purposes.<br />

Figure 5. Defining function delegates<br />

Upon defining function delegates shown in Figure 5, the<br />

application developer subsequently is required to assign the<br />

function delegates to local functions. The local function that<br />

we use as an example is called<br />

middlewareDataFunction <strong>for</strong> processes data and<br />

middlewareResponseFunction <strong>for</strong> processes<br />

responses (see Figure 6).<br />

Figure 7. Initiate the Upper <strong>Middleware</strong><br />

• Reconfiguration<br />

Reconfiguration feature enables applications to change the<br />

property of the sensors on-the-fly, such as changing the<br />

sampling rate of the sensor through the Upper <strong>Middleware</strong>.<br />

Figure 8 shows the reconfiguration functions in the Upper<br />

<strong>Middleware</strong>.<br />

Figure 8. Sensor reconfiguration functions<br />

• Resource Management<br />

Resource management relates to the ability to control each<br />

of the sensor nodes in the network. A set of resource control<br />

APIs is provided by the Upper <strong>Middleware</strong>. Resource<br />

control messages include sensor once-off and periodic sleep,<br />

sensor’s battery level reading and notification as depicted in<br />

Figure 9.<br />

Figure 9. Sensor resource management functions<br />

Figure 6. Assigning function delegates to local function<br />

The Upper <strong>Middleware</strong> will ‘callback’ incoming<br />

data/response to the application through these functions.<br />

Input parameters must be adhered to <strong>for</strong> them to function<br />

correctly. Define local data and response callback functions<br />

with the input parameters.<br />

The application developer may add the desired<br />

implementation/processing code into the body of the<br />

middlewareDataFunction. To initiate the upper<br />

<strong>Middleware</strong>, the developer firstly needs to create a new<br />

instance of SensorHub, passing as its input parameter the<br />

III. MIDDLEWARE DEPLOYMENT<br />

This section shows the deployment of the proposed<br />

middleware by an application. Our sensor hardware is a set<br />

of EHSII sensors, developed by the Embedded & Hybrid<br />

Systems II program in A*STAR [3] which have similar<br />

specifications as the Imperial College BSN motes [4].<br />

Figure 10. Sensor devices and a PDA<br />

5506


For this purpose, we utilize three accelerometers and one<br />

ECG, and the Upper <strong>Middleware</strong> resides in the PDA (HTC<br />

X7501 Advantage Ultra <strong>Mobile</strong>). Figure 10 shows the<br />

image of the associated sensor nodes and the mobile device.<br />

• Incorporating the <strong>Middleware</strong> into an Application<br />

As stated earlier, the proposed middleware is developed<br />

in C# in the <strong>for</strong>m of dll functions. In this showcase, we have<br />

developed a mobile health monitoring application that will<br />

deploy the middleware and interact with the sensor devices<br />

through the middleware. We are using Visual Studio 2008<br />

development suite. There are two simple steps to add the<br />

proposed middleware program into the application. The first<br />

step that application developer needs to do is to add a<br />

reference to the <strong>Middleware</strong>.dll in the project, by selecting<br />

‘Reference’ in the Solution Explorer as illustrated in Figure<br />

11(a). In this example, the <strong>Middleware</strong> dll is named<br />

<strong>Middleware</strong>.v3. Following this, in the second step, the<br />

developer will have to import the <strong>Middleware</strong>.v3 into<br />

the source code ‘using <strong>Middleware</strong>.v3’ statement at the<br />

header of the code (see Figure 11(b)). Subsequently, the<br />

application developer may commence deploying the<br />

middleware functions based on the procedures that have<br />

been described earlier in section IIC.<br />

• Parameter Setting Interface<br />

As part of the sensor reconfiguration and management<br />

features, the application should be built with an interface to<br />

utilize these features as what displayed in Figure 12(d). Each<br />

of these control command calls the relevant function given<br />

by the Upper <strong>Middleware</strong>. Figure 12(d) shows the radio<br />

toggle command has been triggered <strong>for</strong> sensor mote 4 and<br />

the sensor sends an acknowledgement back to the<br />

application.<br />

(a) Sensor indicators<br />

(b) Accelerometers wave<strong>for</strong>m<br />

(a) Reference the <strong>Middleware</strong><br />

(b) Import the <strong>Middleware</strong><br />

Figure 11. Incorporating <strong>Middleware</strong> dll<br />

• Data Acquisition<br />

After incorporating the middleware into the application<br />

and activating the data acquisition functions, the application<br />

should start receiving data streams from each of the sensor<br />

node. As shown in Figure 12(a), the light indicator in the<br />

application turns into green, which means that the<br />

application is receiving sensor data. The four lights indicates<br />

mote 1 to 4. Mote 1 to 3 corresponds to the three<br />

accelerometer sensors, while mote 4 relates to the ECG<br />

sensor. Figure 12(b) and (c) depicts the accelerometer and<br />

ECG wave<strong>for</strong>ms, respectively after receiving the data from<br />

the sensor nodes.<br />

(c) ECG wave<strong>for</strong>m (d) Sensor control interface<br />

Figure 12. Sensor data acquisition and presentation<br />

• Per<strong>for</strong>mance Comparison<br />

Compared to our previous WBAN middleware in [1], the<br />

<strong>Middleware</strong> reported in this paper offers much smaller size<br />

and better per<strong>for</strong>mance. The size of the previous Upper<br />

<strong>Middleware</strong> (106 bytes) is about two times larger than the<br />

current version (41 bytes) in this paper. In terms of the<br />

efficiency (loading time), the current middleware (~1.5 sec.)<br />

is about 5 to 6 times faster as compared to its predecessor<br />

(~10 sec.). These two are arguably the most significant<br />

elements when working in resource-constrained<br />

environments.<br />

IV. CONCLUSION<br />

We have presented an efficient, flexible and lightweight<br />

mobile middleware <strong>for</strong> wireless body area network. The<br />

middleware architecture, its functions/processes, and the<br />

deployment of the middleware including per<strong>for</strong>mance<br />

comparison of the middleware have been discussed.<br />

REFERENCES<br />

[1]. A.B.Waluyo, I. Pek, X. Chen and W-S. Yeoh, “SLIM: A Secured<br />

Lightweight Interactive <strong>Middleware</strong> <strong>for</strong> <strong>Wireless</strong> <strong>Body</strong> <strong>Area</strong><br />

<strong>Network</strong>” In Proc. of the 30th International Conference of the <strong>IEEE</strong><br />

Engineering in Medicine and Biology Society, pp. 1821–1824, 2008.<br />

[2]. Bd. Silva, A. Natarajan, M. Motani, and K-C. Chua, “Design<br />

Considerations of <strong>Body</strong> Sensor <strong>Network</strong>s”, In Proc. of the <strong>IEEE</strong><br />

Healthcom, pp.323-328, 2008.<br />

[3]. A*STAR,”EHSII: Embedded & Hybrid Systems II”, http://www.ehssg.org/.<br />

Referenced: April, 2009.<br />

[4]. B. Lo, S. Thiemjarus, R. King, and G-Z. Yang, “<strong>Body</strong> Sensor<br />

<strong>Network</strong> – A <strong>Wireless</strong> Sensor Plat<strong>for</strong>m <strong>for</strong> Pervasive Healthcare<br />

Monitoring”, In Proc. of the 3rd International Conference on<br />

Pervasive Computing, pp.77-80, 2005.<br />

5507

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!