## 3 Materials and Methods
### Architecture  
In this subsection, the architecture of the proposed system is shown. The system is based on sensors for monitoring 10 parameters, including water quality parameters, tank parameters, fish behavior and humidity inside the node boxes. In each production tank, there are three nodes monitoring different parts of the tank. The employed nodes send the data wirelessly to the AP. First, the physical topology is shown, see Figure 1. In the fish farm, a local area network will be deployed. Different box nodes (BN) are placed in several points of the facilities. The nodes are wirelessly connected to the AP using Wi-Fi technology. The APs are connected to the switch with an Ethernet link. Several APs are located at different points of the facilities; some of them are placed in the rooms with the production tanks. However, other APs are placed in the offices and those AP do not send data to the database. Those AP are used to send data to the workers if any alarm messages are generated. Finally, the switch is connected to a router to have internet access with a serial connection. The topology is based on an extended star topology. Figure 2 shows the architecture of the entire system, including the database and the smart algorithms applied in the cloud. To save the data and move the computing activity to the cloud, it is possible to opt for a commercial solution such as Amazon Web Services [31] or Microsoft Azure [32] which implies an additional cost. In our case, we have used an own external web server which can be accessed through the internet. Besides, supervisors who are not located in the fish farm facilities can make an information request to the database from anyplace and anytime. Furthermore, in Figure 2 it is possible to see the location of the sensor and BN in the aquaculture tank. The BN 1 contains the following sensors: illumination, water level, oil layer, workers presence and fish behavior sensors. The BN 2 contains the rest of the water quality sensors, which include a temperature senor, turbidity, and conductivity sensor. Finally, the BN 3 contains the feed fallen detector. In addition, all the BN contains and humidity sensors. In normal condition, the nodes sense and send the data to the database. Once the data arrives at the database, the smart algorithm is applied. If the smart algorithm concludes that the data corresponds to normal situation no further actions are done. Nevertheless, if the smart algorithm concludes that the data does not fit with the normal situation, an alarm message is sent to the designed worker with the necessary information. To avoid the energy waste in the sending data, algorithms can be used to send only the relevant data. Thus, we reduce the number of information send reducing therefore the energy consumption in the data transmission. The energy consumption is one of the main deals in the WSN [33] and many protocols have been developed to reduce the energy waste [34; 35]. First, the thresholds for each variable are set (\(\mathit{TH}_{x}\)). Next, the sensor gathers data and save this data as reference value \(X_{x}\). A reference value is set for each one of the water variables (\(\mathit{Wv}\)), including temperature, conductivity, turbidity, and oil layer, and for the Tank variables (\(\mathit{Tv}\)), which include water level, illumination, and workers presence. The next step is to set a clock time = 0. Following, the systems gather new data and it is named as \(Y_{x}\). Then, the system checks the data from the humidity sensor. If the data is equal to 1, which indicates that there is humidity in the BN, then the system sends all the stored data; send an alarm to the workers and turn off this BN. If the humidity sensor gives a value of 0 the operation continues. The \(Y_{x}\) ta is compared with the \(X_{x}\). If the difference is higher than the \(\mathit{TH}_{x}\), the stored data is sent to the database. Moreover, the \(Y_{x}\) is set as \(X_{x}\), the clock is set again to 0 and the operation algorithm gathers new data.