## 2 Materials and Methods
### System's Design and Construction
#### 2.1.3 Hardware: Sensors, Auxiliary Electronics, and Raspberry Pi
In Figure 6(a,c), the scatter plot shows the relation between the respective measurements of height using each distance sensor, their simple average, and the best fitted line after applying multiple linear regression with an interaction term (also depicted in Figure 6(b)), as compared to the true height measured manually. The data measured with both sensors were treated as predictors and the true height as the response. The regression coefficients for the linear model that was utilized in this study are shown in Equation (1) below. \[y=12.9749+0.2509\cdot x_{1}+0.8177\cdot x_{2}-10^{-4}\cdot x_{1}\cdot x_{2}, \tag{1}\]  
The maximum of the absolute value of the data for this model (maximum error) was calculated to be \(max.error=3.41\times 10^{-13}\) mm, which is a sufficiently small value and much smaller than any of the sensors' data values used, indicating that this model accurately follows the measured data of both sensors. Moreover, the fit to the data had the same value for both the correlation coefficient \(R^{2}\) and the adjusted correlation coefficient \(R^{2}_{adjusted}\), with \(R^{2}=R^{2}_{adjusted}=0.9999\) and root mean square error \(RMSE=1.2226\) mm. Thus, we conclude that according to the experimental height measurements and the analysis performed, the linear model as described in Equation (1) above fulfills the distance measurement requirements for the purposes of the current work. To control the fan (mentioned below), the LEDs, the infrared LEDs, and the relay that controls the stepper motor driver, 2N2222A NPN transistors were used, which can handle the current required for these devices and the necessary resistors. An ordinary 12 V DC 2 A power supply was used to power the stepper motor and cooling fan. Finally, to connect all the necessary devices and electronic components, a simplified electronic circuit (Figure 7(a)) and a printed circuit board (PCB) (Figure 7(b)) were designed using EasyEDA software ver. 6.5.20 (Figure 7(a)). JST male/female connectors (JST XH 2.5 mm) were used to connect all devices to the circuit board. The control of the relay and the stepper motor driver, the control of the distance sensors, the limit switches, and the infrared LEDs, as well as the image acquisition, processing, and storage were carried out by a computing unit small enough to fit on the cart and powerful enough to handle all the tasks required. The Raspberry Pi 4 - Model B - 8 GB [53] proved to be ideal because, among other things, it supports WiFi, integrates USB ports, and has sufficient computing power and 8 GB of RAM to process the captured images. The official Raspberry Pi USB-C power supply (output voltage: 5.1 V DC, max. power: 15.3 W) was used to power the Raspberry Pi and all peripheral sensor devices. Given the \begin{table}
\begin{tabular}{c c c c} \hline
**Ultrasonic-True (r)** & **To-True (r)** & **Ultrasonic-ToF (r)** \\ \hline \(r_{1}=\begin{bmatrix}1&0.9998\\ 0.9998&1\end{bmatrix}\) & \(r_{2}=\begin{bmatrix}1&0.9983\\ 0.9983&1\end{bmatrix}\) & \(r_{3}=\begin{bmatrix}1&0.9984\\ 0.9984&1\end{bmatrix}\) \\ \hline \end{tabular}
\end{table} 
Table 1: Correlation coefficient matrices between sensors and manual measurements. high temperatures that can be achieved in a greenhouse, heat sinks coupled with a 12 V fan (the latter to also move the dust away) were used to cool the Raspberry Pi (RPI) (Figure 8c).