Programming a Sensor Network in a layered middleware architecture 521 0 Programming a Sensor Network in a layered middleware architecture Michele Albano Instituto de Telecomunicações - Aveiro Portugal Stefano Chessa University of Pisa and ISTI-CNR Italy Abstract Wireless Sensor Networks (WSNs) have become a mature technology aimed at performing environmental monitoring and data collection. Nonetheless, harnessing the power of a WSN presents a number of research challenges. WSN application developers have to deal both with the business logic of the application and with WSN’s issues, such as those related to network- ing (routing), storage, and transport. A middleware can cope with this emerging complexity, and can provide the necessary abstractions for the definition, creation and maintenance of ap- plications. This work discusses the problems related to the development of such a middleware and surveys the state of the art on the field. 1. Introduction In the last few years, hardware and software innovations have been leading Wireless Sensor Networks (WSNs) from the research labs to deployments in real contexts. A WSN application is a distributed application that is built on a large number of low-cost, low-power, battery- powered sensors (Akyildiz et Al., 2002; Baronti et Al., 2007; Chessa, 2009). Sensors are spread in an environment (sensor field) without any predetermined infrastructure and cooperate to execute common monitoring tasks which usually consist in sensing environmental data and monitoring a variable set of objects. The sensed data are collected by a sink (a node that can communicate with both the WSN and an external network), when the sink is connected to the network. The sink, which could be either static or mobile, is in turn accessed by the external operators to retrieve the information gathered by the network. Distilling a given high-level behavior from a set of sensors is a challenging problem, since the application has to deal with its own business logic, and with the issues that naturally arise when WSNs are taken into account, such as network formation, data transport and data man- agement, security and energy saving. Dealing with these issues can be done either explicitly, 23 www.intechopen.com