In recent years, wireless sensor networking has shown great promise in applications ranging from industrial control, environmental monitoring and inventory tracking. Given the resource-constrained nature of sensor devices and the dynamic wireless channel used for communication, a sensor networking protocol needs to be compact, energy efficient and highly adaptable. In this paper we present SAMPL, a simple aggregation and message passing layer, aimed at flexible aggregation of sensor information over a long period of time, and supporting sporadic messages from mobile devices. SAMPL is a compact network layer that operates on top of a low-power CSMA/CA based MAC protocol. The protocol has been designed with extensibility in mind to support new transducer devices and unforeseen applications without requiring reprogramming of the entire network. SAMPL uses a highly adaptive tree-based routing scheme to achieve highly robust operation in a time-varying environment. The protocol supports pe...