## 3 Design and Implementation Details
### Functionality and Fine-Tuning Explanation  
To provide soil-specific data to the final user in a meaningful format requires the application of calibration equations upon the original readings [22]. The way that these equations are applied depends upon the specific instrument type being connected to the peripheral node. Figure 6 depicts indicative code parts implementing the soil instrument calibration function for TEROS 12 instruments. The top-left part of Figure 6 corresponds to the calculation of \(\epsilon_{\text{a}}\) quantity locally on the sensor node utilizing the Arduino programming environment. The bottom-right part of Figure 6 shows the equivalent code part executed on the RPi in Python, which post-processes the original/raw data arriving from the peripheral soil instruments to the sink/gateway node. While both methods provide satisfactory accuracy and are aligned with the edge computing philosophy, the calculation of calibration equations at the sink/gateway node relieves the limited MCU of the sensor nodes from extra tasks and provides ease and freedom for experimentation with different equation variants. The data provided by the sensor nodes to the sink/gateway contained, apart from a sensor node identifier, a modulo-256 serial number information stamp for interception of potential packet losses, and they were encrypted using the lightweight crypt and speck libraries, which are compatible with the Arduino programming environment. Furthermore, a thermometer was added to provide an independent reference of the temperature inside the box hosting each sensor node. This thermometer was implemented using a TMP26 and alternatively an LM35 chip. The node arrangements also provided a voltage divider made by resistors of 150 k\(\Omega\) in order to incorporate battery voltage health status information inside the packet payload travelling from the sensor nodes to the sink/gateway. On packet data arrival therein, sensor node-specific information was supplemented by the corresponding received signal strength indicator (RSSI) values as intercepted and calculated by the sink/gateway node. Figure 5: Sink/gateway node software arrangements for remote data access, in case that the combination of Remote.It and WinSCP tools is used. Similarly, a serious weakness of cheap microcontrollers, especially when they are called to process analog data, is the deviations in performance between different pieces of the same type. More specifically, the 32u4 unit inside node #A1 contained LDO voltage regulators generating 3.27 V and a more stable internal reference voltage of 2.52 V instead of the expected 3.30 V and 2.56 V values, respectively. Similarly, the 32u4 unit inside node #A2 generated 3.29 mV and 2.54 mV, respectively. These imperfections favor the use of an accurate analog reference voltage circuit, replacing the internal reference, like the Adafruit LM4040 breakout module, per each node. This would increase the cost of each node by EUR 10, approximately. Alternatively, each node microcontroller can be calibrated once using the same circuit in order to calculate the exact value of a dedicated correction coefficient, to store it internally, and to utilize it during the ADC process, thus converting the analog values to their accurate digital equivalents. The latter solution was adopted by the proposed sensor nodes due to cost and simplicity purposes. Thankfully, in contrast to the LDO voltage level imperfections mentioned, the ADC unit built into the 32u4 microcontroller is very linear and withstood the operating temperature variations. This fact was verified by recording and inspecting the ADC values corresponding to the accurate analog reference chip connected to an analog input of the MCU (in lieu of an analog soil instrument) while the sensor node was subjected to temperature extremes.