## 3 Wireless Sensor Network and Wireless Sensor Node Deployment
### Wireless Sensor Node  
In order to design our sensor node, several factors must be considered. On the one hand, the node must be able to capture the images with enough quality and the image processing must be computed inside the node in order to detect any unusual status of the leaves that could be caused by a deficiency, pest, disease or other harmful agents. When any symptom is observed in a leaf, the node must send an alarm to the gateway node. We decided to use an available access point or wireless router on the market in order to reduce the costs of node deployment and take advantage of existing hardware. The main features of the needed hardware are that it must use IEEE 802.11a/b/g/n technology and it must also have at least one USB port in order to add a camera. The device should have the best hardware features because it must be able to process images. Moreover, the selected device for image capture, such as a video camera or webcam, must have USB and must adapt its hardware characteristics to the hardware characteristics of the access point or wireless router. Finally, the camera should be able to rotate, with the aim of having a larger viewing area and therefore reduce the number of required sensor nodes. In general, the original firmware of the access points and the wireless routers on the market does not allow some operations. Therefore, we should customize the device firmware in order to enable these additional features. One of the most used custom firmwares is OpenWRT [41]. It is a distribution based on GNU/Linux used for embedded devices such as routers and access points. It was driven initially by the GPL license and its intention was to allow manufacturers and users to modify and improve the code of their  
Figure 4: Sensing coverage of a wireless sensor camera. devices. OpenWRT provides a fully writable file system with package management. It is a very basic operating system that offers the possibility of complement it, with additional functionalities, using packages that allow users full customization ability to particularize the use of the device to a desired application. There are many devices that can operate under the OpenWRT firmware. In order to design our system, we need a wireless device that has to be able to work on IEEE 802.11 standard, and must have at least one USB 2.0 port. The USB port will be needed to connect a camera and acquire high quality images from the vineyard. It is important to choose the best hardware features in order to facilitate the tasks of image processing. Table 1 only shows those devices that meet our requirements [42]. It displays information about the type of hardware of the devices, CPU Speed, RAM and flash memory, number of USB ports and the version, the type of wireless card used and the wireless technology used, among other features. \begin{table}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|} \hline  
We selected the routers with higher processing capacity because we need to process images. The models with higher speed processors are the Netgear WNDR3700 and D-Link DIR-825. Both work with an Atheros AR7161 processor, (32 bit MIPS 24K processor core) [43], with a CPU Speed of 680 MHz and 64 MB of RAM memory. Moreover, we should keep in mind that our system will be mounted on a field, where it is difficult to get energy from the electrical grid in many cases. In these situations, it is common to use batteries and electrical power generation systems from alternative sources. Therefore, another factor that was taken into account was the energy consumption of the device. Table 2 shows the energy consumption in active mode, idle mode and standby of some devices (we have included in this table only the ones for which some consumption information can be found in their technical specifications and the ones of whose consumption information is published in a research paper).