## 2 Materials and Methods
### Control Schematic  
The STS system was implemented based on a PID controller tuned by a trial-and-error approach to find the desired PID gains experimentally. The gains of the PID controller were found to be optimum at \(\mathrm{kp}=150\), \(\mathrm{kd}=0.5\), and \(\mathrm{ki}=0.5\). The functional block diagram of the systems is illustrated in Figure 5. As mentioned previously, the main objective of using an STS is to track the sun rays via changing the solar module's tilt angle or azimuth angle as time elapses. The aim was achieved in this study by using both azimuth-based and sensing-based closed-loop algorithms.  
In the azimuth-based STS, the calculated azimuth angle based on a given latitude and longitude is considered as the input to the system. At the same time, the output is the signals that are continuously sent to the motor driver. Additionally, the accelerometer is the sensing component in this closed-loop system that measures the actual angle and compares it to the desired one. On the other hand, the sensor-based STS uses light-dependent varying resistors (LDR) as a sensor and does not need any input data, where a light-dependent resistor is a photoresistor whose resistance differs according to the light intensity projected on its surface. The error signal in both systems entered the PID controller with an anti-windup mechanism to reorient the modules without any sudden or unstable movement. The saturation block aims to clip out the effort signal if it exceeds a certain threshold level to prevent any unrated input to the DC motor dynamic, which prevents the systems from any environmental factors that might affect the stability of the metallic platform setup.  
The azimuth-based algorithm of the tracker is illustrated in Figure 6. As shown in Figure 6, the microcontroller starts initializing the code variables and constants for the sensors, modules, and temporary variables that are intermediate in the algorithm. After that, the accelerometer begins to read the initial orientation of the solar module to be used in later steps. Then, latitude and longitude are entered simultaneously. The real-time clock module (RTC) reads the time and date. The latitude, longitude, and time are used to calculate the azimuth angle and consider it a command signal via the previously mentioned equations. The azimuth angle is limited to be between \(60^{\circ}\) and \(-60^{\circ}\), so the input signals are supposed to be between these two values. The error will be tested if it has a value less than or equal to 0.5 to stop the algorithm. This technique will ensure that any insignificant errors within specific tolerance are eliminated.  
The sensor-based algorithm is illustrated in Figure 7, where the same analogy used at the beginning of the azimuth-based algorithm is used. The only difference in this algorithm is that there is no needed input command to the system since the signals coming from the LDRs are enough to calibrate the error signal. Then again, the same as for the azimuth  
Figure 5: Control block diagram.  
based algorithm, this error would be examined if it is in the permissible error window or not, as seen in Figure 7.  
Figure 6: Flow chart algorithm operation for azimuth-based SAST.