# Proposed Fuzzy-NN Algorithm with LoRa Communication Protocol for Clustered Irrigation Systems
## 3 Irrigation Systems Algorithms
### Proposed FITRA Algorithm Supporting the OWS Architecture  
OWS architecture constitutes of a servo valve actuator and analog soil moisture sensors (maximum 8 sensors MCU controller A/D 10-bit chip), as shown in Figure 2. The analog sensors are connected to the 10-bitanalog-to-digital component of the MCU (ATMega328P 8-bit microprocessor). Analog values are mapped into 10-bit digital values that range from 0 to 1023. Based on the authors' soil moisture sensor calibration field tests measurements, values less than 120 denote a soil sensor that measures water conductivity, while values greater than 1020 correspond to sensors that measure dry sand conductivity. Sensor values above 1020 lead the authors to infer that the sensors are open-circuited or lost ground contact. Sensor values bellow 120 are considered erroneous and such values are interpreted as short-circuited electrodes. The average sensor values are stored to the MCU controller EEPROM and at periodic intervals are transmitted back to the AS with the use of a UART 3G transponder connected to the MCU SPI bus. The FITRA system actuator is a four-state servo valve. The valve has 3/4-inch diameter and is connected to a pressurized 5-7 bar water supply network. The valve has four placement states (expressed in valve rotation degrees): On(0\({}^{\circ}\)), off(90\({}^{\circ}\)), middle(30\({}^{\circ}\)) and little(60\({}^{\circ}\)). In the middle state the valve is half-open (actual hose diameter set to 1/2\" inch), while in little state the valve is opened with an actual hose diameter between 1/8\"and 2/8\" of an inch. The actuator state transitions are controlled by the FITRA algorithm. Authors propose a new adaptive algorithm for clustered irrigation systems called FITRA (named after the Greek word for seed). FITRA high-level functionality is illustrated in Figure 3. FITRA initializes its irrigation decisions based on a fuzzy control process. Except for the collection of satisfactory amount of irrigation data and corresponding daily satisfaction feedback indicated by a farmer, FITRA switches from fuzzy to a neural network (NN) irrigation process, with weights that are back-propagated from the farmer and confirmed as an exceptional seasonal dataset. Each one of the OWS system soil sensors, which supports the FITRA algorithm, is a uniform analog soil moisture sensor. Calibration is required to define sensor boundary values that depend on the type of soil in the installation area and environmental conditions. After the experimentation part with the soil sensor for the identification of sensor-environment boundary values in temperate climate conditions of Epirus Greece, for fields of light slopes (\(<\)10\({}^{\circ}\)), the identified sensor boundary values were close to 130 (more than 120) for wet soil and close to 1021 (less than 1023) for dry soil. Intermediate values are spread out uniformly. Values of more than 1021 denote an off-the-ground open circuit sensor. While values less than 130 indicate short-circuited sensor electrodes or electrodes immersed into water without soil contact [33]. The FITRA algorithm uses a daily-calculated metric called Sum of Daily water Activity (_SDA_). The _SDA_ metric is given by the following formula and its values are equal to the total daily irrigation minute time (number of minutes the actuator was set to on):  
\[SDA=\sum_{i=1}^{1440}\frac{isv\_openi}{1400} \tag{1}\]  
where \(isv\_openi=1\) if the vane is opened the current minute \(i\) and 0 otherwise. The \(isv\_openi\) binary value is evaluated by the actuator's flow meter. Upon FITRA initialization, there is no knowledge about sensor relative position from the actuator valve and that position is statically assigned to be of: Close (C), Normal (N) or Long (L) distance from the actuator. Then FITRA algorithm enters the initial fuzzy state. It filters the soil measurement results, calculates membership functions from results based on a fuzzy process. When the outcome of the fuzzy process is confirmed it enters the neural network process.