## 2 System Overview
### Sensing System: WSNs for Specific Data Acquisition
Although this is not optimum or adaptable to any kind of general situations, it is absolutely appropriate in this context. In this manner, as Figure 4 shows, each node works individually, in an autonomous and iterative way, while the quadrotor is not in the surroundings. When it arrives, it communicates its presence to the network by means of a QDTR beacon, which will be spread along the mesh, configuring the paths for the routing scheme in the same action [35]. Once the hierarchy is set, according to the distance from each node to the sink (measured in number of hops), every node sends the data saved following the protocol presented in the Figure 4.  
Thus, each node should maintain a number of packets inversely proportional to its distance to the quadrotor (d), with a latency time proportional to d-1. The way to guarantee the data pipeline in this multipath-reconfigurable system is to use CSMA/CD--included in IEEE 802.15.4 protocol--that delimits the access to the medium in conflictive areas [36]. This system is appropriate when the clusters are made up of few nodes so as not to overflow the system while allowing the required data to be stored. The algorithm that describes this operation is based on the state machine presented on Figure 5. As it can be observed, the initial state--and also the most common one--is low energy condition, or IDLE, this is due to the great importance of power consumption in WSN systems where battery lifetime is a critical issue. In this state, microcontroller, sensors and inputs/outputs are disabled except for communications (aerial and chip) and watchdog timing that are maintained awake. At any time, both interfaces could trigger a system interruption: packet reception from the mobile node or timing signal that launches the acquisition process. Any of those events will prompt a node reactivation, which will wake the system interfaces and resources up. The base program will then be able to determine what caused the interruption. In case of a temporal event, the measurement task will be turned on and the corresponding sensors will execute multiple micro delayed acquisitions. Although final accuracy depends on sensors' precision, it allows to avoid punctual errors by applying the necessary filtering processes in the successive steps, as well as obtain a more realistic value. Besides, analyzed data will provide solutions for environmental pattern recognition, of alarm/critic state recognition and parameters required to dynamically adapt more operation (such as sample time, number of samples per acquisition, secure range, _etc._). Finally, the data is encoded in order to maximize memory capacity and communication intervals. In this line, when similar values are obtained repeatedly (within a predefined range), new value is not stored. Instead, a heart bit in the package header indicates that the acquisition was successfully done and its result was similar to the previous one. Also, values are encoded depending on their frequency, in a similar procedure as used in Variable Length Coding (VLC) [37]. Once the information is encoded and stored, the control loop is reset and remains in IDLE mode until it receives a new interruption. Figure 4: Communications protocol. On the other hand, when the wake up is motivated by an incoming communication, the string is initially analyzed. Apart from the node number, the header is the same for every communication, because messages only flow among similar motes with the same communication standard, and differences appear in the payload. So, packet discrimination starts with the MESSAGE TYPE field. Two kinds of packets are considered: beacons sent by the quadrotor, and data packets sent by other motes to be relayed to the sink. In the first case, the quadrotor beacons are in charge of waking the nodes up one by one and making up the mesh. It indicates that large communication resource is available and ready to receive their saved data. At the same time, beacons are also used for evaluating and defining feasible paths for the routing scheme.