## 1 Introduction  
Over the past few years, Wireless Sensor Networks (WSNs) [1, 2] have drawn the attention of multiple researchers. WSNs are defined [1] as networks composed of a large number of sensor nodes and can be conceived of as small computers with extremely basic interfaces and components. Each node consists of a processing unit with limited computational capability and memory, sensors, a communication device and a limited power source, usually in the form of a battery. Hence, WSNs have strong constraints on their energy resources and computational capacity. In addition, network protocols and algorithms must possess self-organizing capabilities that enable them to autonomously adapt to changes resulting from external interventions or requests submitted by an external entity. As described in [1], sensor nodes can be used for continuous sensing, event detection, event identification, location sensing and local control of actuators. The range of applications of WSNs is very wide and includes intelligent agriculture, industrial control and monitoring, environmental monitoring systems, surveillance, health monitoring, traffic monitoring, _etc._  
Nowadays there is a persistent trend to include more and more functionalities into sensors in order to apply them in complex systems, to reduce the need for inter-sensor communication and to prolong battery lifetimes. In this sense, sensors with some intelligent capabilities have been proposed and several Soft Computing (SC) technologies have been applied to WSNs. On the other hand, WSNs are perfect scenarios for sensor collaboration in order to obtain a global purpose. In this work, the term collaborative involves communication of individual measures among sensors to accomplish their tasks and to achieve a common goal. Despite the wide interest in sensors and collaborative WSNs, little attention has been paid to collaborative Fuzzy Rule-Based Systems (FRBSs) for WSNs. FRBSs [3] are considered an extension of classical rule-based systems, because they deal with \"IF-THEN\" rules whose antecedents and consequents are composed of fuzzy logic statements (fuzzy rules) [4], instead of classical logic ones. One of the main characteristics of these systems is their capacity to incorporate human knowledge by accounting for its lack of accuracy and _uncertainty or imprecision_. FRBSs present some advantages over classical rule-based systems; for example: a) the key features of knowledge captured by fuzzy sets involve the handling of uncertainty and b) inference methods become more robust with the approximate reasoning methods employed within fuzzy logic. This paper presents a new collaborative approach based on knowledge-based WSNs. The contributions of this work are as follows:  
1. We propose a knowledge-based sensor that executes a small FRBS that has been adapted to it and allows experts to incorporate uncertain and vague knowledge about the sensor data into the sensors;
2. We define an application protocol that is adapted to sensor networks and enables the distribution of knowledge bases (KBs) and data communication between sensors;
3. We examine the performance of the sensor and protocol, and observe from the results that the sensor reaction time and the network throughput and delay allow the system to be used in a wide set of applications;
4. We propose a collaborative knowledge-based scheme that allows for collaboration among sensors in order to achieve a global network objective. The collaborative knowledge is definedby means of a FRBS, which is a very effective approach to support uncertainty and imprecision. As a real-world application, we present a knowledge-based WSN that concretely models a system of olive tree pests. The development of the olive tree fly is strongly related to the temperature and humidity conditions of the environment. The suitability of insecticide treatments applications should be evaluated if the risk of the plague appearance in an area surpasses a threshold level. The remainder of the paper is organized as follows.