Development and Testing of a Single-Axis Photovoltaic Sun Tracker through the Internet of Things

: Solar tracking systems enable increased e ﬃ ciency of a photovoltaic system through a continuous adjustment of its position with respect to the sun, thus increasing the generation of electrical energy. The integration of photovoltaic solar tracking systems in buildings and houses enables the energy needs of users in a broader way to be covered. This integration is facilitated through the existence of technologies such as access to the Internet through Wi-Fi, which allows developing systems to be encompassed within the domain of the “Internet of Things” (IoT). In this study, a ﬁrst-of-its-kind “open-loop” solar tracker was designed and developed, which executes the tracking algorithm in the Firebase web service and allows the exchange of data with said service through a NodeMCU development board, which has an integrated Wi-Fi module. After an experimental campaign in Aguascalientes, central Mexico, gains in terms of collected energy on average were measured at 29.9% in May compared to an optimally tilted ﬁxed photovoltaic system. This study opens the possibility of integrating power generation systems into the IoT domain, which, among other things, allows for constant monitoring of the behavior of the system. and methodology, S.G., P.M.R., and J.A; A.M.; and


Introduction
Most people spend 90% of the day indoors, increasing electricity consumption derived from the use of heating, ventilation, and air-conditioning (HVAC) equipment and home appliances. The percentage of building energy consumption in the United States of America has increased from 33.7% in 1980 to 41.4% in 2010. China had an increase of 40% in a 20 year period (1990 to 2009). Europe registered 55% of the total energy consumption in buildings in 2012. An increase in worldwide energy consumption in buildings is expected because of population and economic growth. Due to this continual growth, different technologies have been developed, allowing clean energy generation in buildings, such as thermal heaters for water, biodigesters, and photovoltaic (PV) systems [1].
PV systems are the most popular technology for clean electricity generation in buildings [2]. They present many advantages, such as the availability of the solar resource, the modularity that allows systems of any capacity to be installed, low maintenance, absence of noise, or even the ability to replace diesel generators at times of power cuts [3]. However, one of the main issues with this kind of application is the moderate efficiency of PV modules, typically in the range from 15% to 20%. Many rooftops have limited area for installing a PV generator and, thus, the electricity generation can be lower than the building needs. Regarding the degrees of freedom, sun trackers are classified into single-axis and two-axes. Different configurations can be designed for each of these types. The main configurations are ( Figure  1): -East-west horizontal single-axis.
-Vertical single-axis with tilt equal to latitude.
-North-south inclined single-axis with tilt equal to latitude.
-Two-axes. The two-axes tracker is the one that allows the percentage energy gains compared to a fixed system to be maximized because it keeps the PV modules perpendicular to the solar rays over the day. However, the double rotatory movement adds cost and difficulty of maintenance. To simplify the structure and control, single-axis trackers are used more for building integration.
Regarding the control method, sun trackers are classified into sensor driver systems, microprocessor driver systems, open-closed loop driver systems, intelligent driver systems, and a combination of any of these systems mentioned.
Sensor driver systems employ photosensors that give a feedback signal (voltage or current) that can be used to drive the solar tracker. Microprocessor driver systems use algorithms and mathematical equations to calculate the position of the sun and usually employ Arduino or Peripheral Interface Controller (PIC) microprocessors. A combination of microprocessor and photosensors can be used to reduce the tracking errors of microprocessor-only systems. The control algorithm can be open-loop or closed-loop. Open-loop algorithms do not require sensors as they use date and time as variables, while closed-loop algorithms rely on the feedback provided by the sensors. Intelligent driver systems use algorithms based on fuzzy logic or artificial neural networks to improve the control characteristics.
Open-loop systems are a good option for active control in applications that do not require high tracking precision, such as flat-plate PV systems. This method avoids the need for maintenance of sensors and is very stable, even in cloudy conditions. As the design proposed in this study is openloop, we next summarize the prototypes reported in the literature for open-loop tracking systems. The two-axes tracker is the one that allows the percentage energy gains compared to a fixed system to be maximized because it keeps the PV modules perpendicular to the solar rays over the day. However, the double rotatory movement adds cost and difficulty of maintenance. To simplify the structure and control, single-axis trackers are used more for building integration.
Regarding the control method, sun trackers are classified into sensor driver systems, microprocessor driver systems, open-closed loop driver systems, intelligent driver systems, and a combination of any of these systems mentioned.
Sensor driver systems employ photosensors that give a feedback signal (voltage or current) that can be used to drive the solar tracker. Microprocessor driver systems use algorithms and mathematical equations to calculate the position of the sun and usually employ Arduino or Peripheral Interface Controller (PIC) microprocessors. A combination of microprocessor and photosensors can be used to reduce the tracking errors of microprocessor-only systems. The control algorithm can be open-loop or closed-loop. Open-loop algorithms do not require sensors as they use date and time as variables, while closed-loop algorithms rely on the feedback provided by the sensors. Intelligent driver systems use algorithms based on fuzzy logic or artificial neural networks to improve the control characteristics.
Open-loop systems are a good option for active control in applications that do not require high tracking precision, such as flat-plate PV systems. This method avoids the need for maintenance of sensors and is very stable, even in cloudy conditions. As the design proposed in this study is open-loop, we next summarize the prototypes reported in the literature for open-loop tracking systems.
An open-loop 3-position single-axis sun tracker was designed and tested in [9]. It used a PIC microprocessor, with a timer integrated circuit (IC), a direct current (DC) motor controlling the movement of the tracker, and additional electronic components mounted on a printed circuit board (PCB). A fixed hour was defined for each of the three angles of inclination, and a rotating-type resistor was used to detect the angular position of the PV module.
An open-loop two-axes sun tracker for its implementation with a Fresnel lens to concentrate sunlight on a Stirling engine was proposed in [10]. A single-chip microprocessor (AT89S52) was used to store the information provided by a global positioning system (GPS) module (EM-406A) and a real-time clock (RTC) and to calculate the corresponding altitude and azimuth angles. Two different stepper motors adjusted the axes' positions, and additional PV modules supplied the power for moving the structure.
A small open-loop two-axes sun tracker prototype was tested in [11] by implementing two different algorithms that control the intervals between readjusting movements: one algorithm using a fixed time interval, while the other calculating the difference between the actual sun position and the position at the last movement to decide if a new movement is required. The differences in the performance of both open-loop algorithms were very small for daily searches numbered greater than five.
An automated positioning two-axes sun tracking system was proposed in [12] controlled by a microcontroller unit (MCU) and with peripherals, such as an encoder and a GPS. The MCU consisted of a master controller (PIC18f4680) in charge of performing the algorithm, arithmetic calculations, and database generation, with two additional slave microcontrollers in charge of controlling the motor drivers and getting feedback from the encoders for both altitude and azimuth adjustment. A compass was added to provide the system a true north reference so that, along with the GPS, the tracking system could be implemented anywhere around the world.
The energetic performance of open-loop 2-position and 3-position north-south horizontal single-axis sun trackers was analyzed in [13] for 22 locations with latitudes up to 50 • . These trackers change the position at fixed hours, and the position angles themselves are predefined, simplifying to the maximum the tracker control. The 3-position tracker performed near the analogous tracker with continuous movement.
A 3-position north-south inclined single-axis sun tracker was designed and tested in [14], and a low concentration ratio reflector was incorporated to increase the collected irradiation. The experimental results showed an appreciable energy gain compared to a fixed system at an affordable cost.
A 2400 Wp north-south inclined single-axis sun tracker was implemented in Turkey [15], with complete monitoring through a microcontroller and a PC and a hybrid grid-connected with batteries configuration.
An open-loop two-axis sun tracker was evaluated and compared to a fixed system [16]. A three-phase alternating current (AC) motor was used for the east-west axis, while a DC motor was used for the north-south axis. An encoder that provides feedback to an Input/Output (I/O) data card was used to record measurements for storage on a computer.
The review of the technical characteristics of existing open-loop sun trackers reveals that the IoT technology has not been applied in this field for integrating the sun trackers in smart homes. The current study tries to fill in this knowledge gap.

Theoretical Analysis of Sun Tracking Energy Gains
The percentage of energy gains of a tracking system compared to a fixed system are dependent on the type of tracker, location, and season. The ideal energy collected by the different types of sun trackers was analyzed for Aguascalientes, central Mexico (21.9 • N, -102.3 • E). The description of the methodology used is as follows.
Inputs of the method were the twelve values of monthly average daily global horizontal irradiation (GHI d ) in kWh/(m 2 day) taken from the National Aeronautics and Space Administration Prediction of Worldwide Energy Resources (NASA POWER) website [17]. The typical profiles of global horizontal irradiance (G(0)) in kW/m 2 for the day in the middle of each month at 5-min intervals were calculated as [18]: G(0) = (π/24)·[(cos ω − cos ω s )/(ω s · cos ω s − sin ω s )]·(a + b· cos ω)·GHI d where ω is the solar hour angle in radians, and ω s is the solar hour angle at sunrise for the considered day. The trigonometric terms are expressed in radians. The sun position for each ω value was determined by the elevation angle (γ s ) and the azimuth angle (ψ s ) as [19]: sin γ s = sin δ· sin φ + cos δ· cos φ· cos ω cos ψ s = (sin γ s · sin φ − sin δ)/(cos γ s · cos φ) where δ is the Earth's declination angle, and φ is the site latitude. The diffuse (D(0)) and beam (B(0)) horizontal irradiances were then calculated. First, the extraterrestrial horizontal irradiance (B o (0)) was obtained by: B o being the solar constant and ε the eccentricity of the Earth's orbit at the day considered. The clearness index was defined as: The D(0) was then estimated by using a correlation proposed by Iqbal [20]: And the B(0) component is the difference between G(0) and D(0). The next step consists of the calculation of the position angles of the PV modules: orientation relative to the south (α) and tilt (β). These angles can be obtained for each sun position (γ s , ψ s ) considering the type of sun tracker [21]: -East-west horizontal single-axis: tan β = cos ψ s /Sγ s -Vertical tilted single-axis: -North-south horizontal single-axis: tan β = sin ψ s / tan γ s -North-south tilted single-axis: -Two-axes: Energies 2020, 13, 2547 6 of 19 Once the position angles of PV modules were known, the method estimated the beam (B), diffuse (D), and albedo (A) components of solar irradiance on the plane of the collectors. B was obtained by: cos θ = sin δ sin φ cos β − sin δ cos φ sin β cos α + cos δ cos φ cos β cos ω + cos δ sin φ sin β cos α cos ω + cos δ sin α sin ω sin β (20) where θ represents the angle of solar rays with respect to the normal of PV modules. For the calculation of D, the anisotropic sky diffuse model of Hay was used [22]: And A was obtained by an isotropic model with 0.2 albedo coefficient: The sum of B + D + A is the global irradiance incident on the plane of the PV modules (G). G can be integrated over time to get the collected irradiation on a daily, monthly, or annual simulation.
The collected irradiance over the winter and summer solstices has been plotted for Aguascalientes and is shown in Figure 2, compared to a south-oriented fixed structure system with tilt equal to latitude. The daily collected irradiation and percentage gains are indicated in Table 1. It can be seen that the best sun tracker, excluding the two-axes, depended on the season: for the winter solstice, the best single-axis tracker was the north-south tilted single-axis with a 24.1% gain, while for the summer solstice, it was the north-south horizontal single-axis with a 37.6% gain. Therefore, an annual simulation was required to know which type of single-axis tracker performs better in the location. The monthly behavior of the sun trackers is represented in Figure 3. It can be seen that from April to August, the best single-axis tracker was the north-south horizontal single-axis, while in the rest of the months, it was the north-south tilted single-axis. If we observe the annual percentage gains, Table 2, the best single-axis sun tracker was the north-south tilted single-axis with a 27.7% gain, followed by the north-south horizontal single-axis with a 23.9% gain. The selected single-axis tracker in this study was the north-south tilted single-axis with tilt equal to latitude as it provides the best annual energy gains in central Mexico. Although the designed tracker can be configured at any location, it will be commercialized in a first stage in this region. Table 1. Daily collected irradiation and percentage gains relative to a south-oriented fixed structure system with tilt equal to latitude of the different types of sun trackers for the winter and summer solstices in Aguascalientes.

Type of PV System
Ideal collected global irradiance of the different types of sun trackers over the winter (a) and summer (b) solstices in Aguascalientes, and comparison to a south-oriented fixed structure system with tilt equal to latitude.

Prototype Design and Implementation
The prototype construction can be divided into four areas: the support and movement structure, the control circuit, the Firebase-based tracking algorithm, and the monitoring system. Each area will be described in the following sub-sections.

Physical Design
Regarding the support and movement structure, it was designed using the SolidWorks software, considering the dimensions of the PV modules used, see Table 3. It was decided that a structure capable of supporting two PV modules would be manufactured, seeking to create an economically more efficient and simple design to implement as a commercial product. Figure 4a and b represent a 3D CAD model of the proposed sun-tracking prototype. The isometric and side views of the designed structure are shown. The construction of the base was carried out with structural steel rectangular tubular profile, which was subsequently painted to adapt it for outdoor use. Regarding design criteria, the stroke length and force of the electric actuator used to rotate the PV modules were considered to assess the range of rotation that the tracker would have. In this case, it was considered that the best option would be to contemplate a range of −45 • to 45 • , considering the angle 0 • as the position at solar noon. Additionally, the structure has the functionality to adjust the inclination of the modules manually up to 45 • , which allows the use of this same structure in different parts of the world. Figure 4c,d show the implementation of the physical structure with the PV panels and the linear actuator.

Control System
As for the control circuit, a NodeMCU board that has an ESP8266 module was used to enable connectivity to Wi-Fi networks [24]. This board has input and output pins that allow the connection of additional components and allows for coding using the Arduino IDE platform, widely recommended for IoT applications [25][26][27][28]. In this case, the use of the H-bridge CJMCU-7960 for the control of the electric actuator that rotates the structure that supports the PV modules was considered. To control the movement and set the position of the tracker, a gyroscope MPU-6050 was used to feedback the physical position of the tracker to the control code. One of the characteristics sought for this prototype was the possibility of using it in different sites worldwide, which is allowed by the design of the structure and by the variables considered in the tracking algorithm. In this way, a GPS module U-Blox GY-GPS6MV2 was implemented to obtain the latitude and longitude values, which are then fed to the algorithm in Firebase, and that allows the calculation of the angle of rotation. It was also decided to connect it to the board through an SRD-05VDC-SL-C relay, looking to turn it off once having obtained the aforementioned values. In Figure 5, the connection diagram of the control circuit is presented.  The flowchart in Figure 6 represents the routine followed by the control circuit. The flowchart in Figure 6 represents the routine followed by the control circuit. The flowchart in Figure 6 represents the routine followed by the control circuit.

IoT Architecture
The architecture of the system as a whole was considered within the scope of IoT, since, as mentioned above, the NodeMCU board has a Wi-Fi module that allows connection to web services. In this case, it was decided to work with the Google Firebase platform, where the tracking algorithm is mounted. Figure 7 shows the general IoT architecture of the system.

IoT Architecture
The architecture of the system as a whole was considered within the scope of IoT, since, as mentioned above, the NodeMCU board has a Wi-Fi module that allows connection to web services. In this case, it was decided to work with the Google Firebase platform, where the tracking algorithm is mounted. Figure 7 shows the general IoT architecture of the system. Through simple commands in the code of the NodeMCU board, such as read, write, and set commands, it is possible to connect to a specific Firebase service, as well as exchange information with it. In this way, it is possible to save computing power in the physical devices while performing all the algorithm operations in the cloud, and only request the value of the angle already processed for handling on the board, which reduces the costs in system components. Figure 8 shows the principal components of the IoT architecture system. Through simple commands in the code of the NodeMCU board, such as read, write, and set commands, it is possible to connect to a specific Firebase service, as well as exchange information with it. In this way, it is possible to save computing power in the physical devices while performing all the algorithm operations in the cloud, and only request the value of the angle already processed for handling on the board, which reduces the costs in system components. Figure 8 shows the principal components of the IoT architecture system. Through simple commands in the code of the NodeMCU board, such as read, write, and set commands, it is possible to connect to a specific Firebase service, as well as exchange information with it. In this way, it is possible to save computing power in the physical devices while performing all the algorithm operations in the cloud, and only request the value of the angle already processed for handling on the board, which reduces the costs in system components. Figure 8 shows the principal components of the IoT architecture system. A consideration made for the angle adjustment was that, due to the physical limits of rotation of the tracker, any angle obtained from Firebase with a value less than -45° would be taken as -45°, and for any angle obtained from Firebase with a value greater than 45° would be considered as 45°. A consideration made for the angle adjustment was that, due to the physical limits of rotation of the tracker, any angle obtained from Firebase with a value less than -45 • would be taken as -45 • , and for any angle obtained from Firebase with a value greater than 45 • would be considered as 45 • .

Tracking Algorithm in Firebase
Firebase offers different types of solutions and web services for managing applications with hosts and clients. The capabilities of Firebase are focused on being easy, secure, and compatible with most systems. For the prototype, two extensions of Firebase were used: Cloud Functions and Firebase Database.
Cloud Functions is a backend code used for managing the applications with functions triggered by Firebase functions. The functions are executed in the cloud servers allowing the host to maintain a simple system on the applications. Functions are coded in JavaScript and are executed when an event on the Firebase products is activated.
Firebase Database is a cloud database managed in JSON format. The data are stored in the server and synchronized when the client starts and regains a connection with the server. The organization of the database allows the client to set or listen to data in different branches. The database was structured as seen in Figure 9, where an identifier was assigned to each user and each registered tracker. Each identifier had the data of each tracker, in this case, Phi (latitude), hem (northern = 1 or southern = −1 hemisphere), long (longitude), and op (operation number). The angle of rotation was returned in a result category (position) to obtain the results of the functions performed. For a normal operation case, only the angle of rotation (position) would be obtained, being able to display other results of interest for testing and debugging. structured as seen in Figure 9, where an identifier was assigned to each user and each registered tracker. Each identifier had the data of each tracker, in this case, Phi (latitude), hem (northern = 1 or southern = -1 hemisphere), long (longitude), and op (operation number). The angle of rotation was returned in a result category (position) to obtain the results of the functions performed. For a normal operation case, only the angle of rotation (position) would be obtained, being able to display other results of interest for testing and debugging. For a simple IoT application, the NodeMCU board connects to the server, sets a database with the global position obtained by GPS, and starts a counter for controlling the angle request each day. The database expects four inputs: the longitude, latitude, hemisphere, and the request number. When the database is synchronized, the request number triggers a function in Cloud Functions with the algorithm for calculating the angle of inclination of the solar tracker. This angle is returned to the database as the output of the function, and the NodeMCU board waits for reading the synchronized angle in the database. The function ( Figure 10) takes from the database, once initiated the event, the data of the tracker, latitude, longitude, and hemisphere, and within the same function, the UTC time is obtained to calculate the angle of rotation of the tracker at the time of change in the operation number. This angle is updated in the results and can be read by the solar tracker. For a simple IoT application, the NodeMCU board connects to the server, sets a database with the global position obtained by GPS, and starts a counter for controlling the angle request each day. The database expects four inputs: the longitude, latitude, hemisphere, and the request number. When the database is synchronized, the request number triggers a function in Cloud Functions with the algorithm for calculating the angle of inclination of the solar tracker. This angle is returned to the database as the output of the function, and the NodeMCU board waits for reading the synchronized angle in the database. The function ( Figure 10) takes from the database, once initiated the event, the data of the tracker, latitude, longitude, and hemisphere, and within the same function, the UTC time is obtained to calculate the angle of rotation of the tracker at the time of change in the operation number. This angle is updated in the results and can be read by the solar tracker.  From the solar time, and considering the declination angle of the Earth at the day (δ) and the site latitude, it was possible to obtain the solar height and azimuth, according to Equations (4) and (5). Once the solar position was known, Equations (15) and (16) allow the target orientation and tilt of the PV modules to be calculated. Finally, the rotation angle of the sun-tracker (ag) was obtained by: The photovoltaic tracker system received this value through the database and made its adjustment for the position obtained. The system was controlled and received feedback for its position through an accelerometer to the ESP8266, which performed the main interactions with the systems.

Monitoring System
To evaluate the performance of the tracker, electrical output short-circuit current was measured for one of the installed PV modules. For this system, an Arduino UNO board was used, to which an ACS758 current meter connected to the outputs of the monitored module was connected. This meter was previously calibrated, which ensured that the measurements were reliable. Through this calibration, a precision level of two decimal places with 0% error was reached, for values found between 0 and 20 A.
It was decided that current measurements would be taken every 15 min. The collected values were saved in a txt file generated on an SD card, located inside a reader connected to the Arduino board, which allowed for easy retrieval of the collected data. It is important to mention that the monitoring system was independent of the control system. Figure 11 shows the connection diagram of the monitoring system. board, which allowed for easy retrieval of the collected data. It is important to mention that the monitoring system was independent of the control system. Figure 11 shows the connection diagram of the monitoring system. Figure 11. Connections diagram of the monitoring system.

Experimental Results
As mentioned before, the experimental campaign took place in Aguascalientes, central Mexico. Aguascalientes' climatic conditions fall inside the semi-desert ones. It is a dry and usually sunny climate. During the year, the temperature generally remains within the range of 4 °C to 30 °C and rarely falls below 0 °C or rises above 33 °C. The measurements were made during nine days in the month of May 2019, corresponding to days 11, 12, 13, 14, 17, 19, 20, 21, and 22. These days were selected because of the absence of clouds, which facilitated the measurement of the energy gains. Solar noon took place at 12:45 pm local time on these days, rising a solar height angle between 85.9°and 88.5°. Figure 12 shows the movement of the solar tracker over a working day, at 10:47, 12:26 (near solar noon), 13:42, and 16:35.

Experimental Results
As mentioned before, the experimental campaign took place in Aguascalientes, central Mexico. Aguascalientes' climatic conditions fall inside the semi-desert ones. It is a dry and usually sunny climate. During the year, the temperature generally remains within the range of 4 • C to 30 • C and rarely falls below 0 • C or rises above 33 • C. The measurements were made during nine days in the month of May 2019, corresponding to days 11, 12, 13, 14, 17, 19, 20, 21, and 22. These days were selected because of the absence of clouds, which facilitated the measurement of the energy gains. Solar noon took place at 12:45 pm local time on these days, rising a solar height angle between 85.9 • and 88.5 • . Figure 12 shows the movement of the solar tracker over a working day, at 10:47, 12:26 (near solar noon), 13:42, and 16:35. A fixed south-oriented PV module (same manufacturer and model to those installed on the tracking structure) was installed close to the sun-tracking prototype with the same tilt as the tracker axis to compare the irradiation collected by the tracking and the fixed system ( Figure 13). This fixed module was mounted on a structure that supports three modules, but only one was monitored in this study (the clean module is shown in Figure 13). The structure was located approximately five meters from the tracking system and at the same height (directly on the ground). This fixed module was monitored in the same way as the tracking system. The measurement of the short-circuit current of the PV modules allowed an indirect estimation of the irradiance collected by each system, because short-circuit current is approximately proportional to the irradiance in PV modules (taking into account that the temperature coefficient of short-circuit current is very small for crystalline silicon modules, <0.05%/°C). Therefore, the irradiance incident on a PV module (G) can be expressed as: Isc,meas being the measured short-circuit current, Isc,STC the reference short-circuit current at standard test conditions (STC), and 1000 W/m 2 the reference irradiance at STC. The collected irradiation over one day (H) can be estimated by a summation: where Δt is 1/4 h in this study. A fixed south-oriented PV module (same manufacturer and model to those installed on the tracking structure) was installed close to the sun-tracking prototype with the same tilt as the tracker axis to compare the irradiation collected by the tracking and the fixed system ( Figure 13). This fixed module was mounted on a structure that supports three modules, but only one was monitored in this study (the clean module is shown in Figure 13). The structure was located approximately five meters from the tracking system and at the same height (directly on the ground). This fixed module was monitored in the same way as the tracking system. The measurement of the short-circuit current of the PV modules allowed an indirect estimation of the irradiance collected by each system, because short-circuit current is approximately proportional to the irradiance in PV modules (taking into account that the temperature coefficient of short-circuit current is very small for crystalline silicon modules, <0.05%/ • C). Therefore, the irradiance incident on a PV module (G) can be expressed as: The measurements registered during two example days are shown in Figure 14a,b. These days have been selected randomly and are shown as examples because all the days show similar curves. The superior performance of the tracking system compared to the fixed system can be observed mainly in the morning and afternoon periods, while at noon, both systems were identically oriented and collect the same irradiance. With the data registered over the experimental campaign, it is possible to compare the daily irradiation collected by the fixed and tracking systems. The numerical results are presented in Table  4, as well as the percentage of irradiation gains obtained by the tracking system for each measured day. These results exhibit that the percentage gains of the tracking system were in the range 26.6%-33.4% at this time of year in Aguascalientes. The average irradiation gain was 29.9% for the experimental campaign. The difference in the percentage gains compared to the average gain is also indicated in the table for each measured day. Six days showed positive differences (gains higher than the average), while three days showed negative differences. These three days exhibited an absolute value of the difference higher than the six days with a positive difference, being responsible for a decay of the average gain. I sc,meas being the measured short-circuit current, I sc,STC the reference short-circuit current at standard test conditions (STC), and 1000 W/m 2 the reference irradiance at STC. The collected irradiation over one day (H) can be estimated by a summation: where ∆t is 1/4 h in this study. The measurements registered during two example days are shown in Figure 14a,b. These days have been selected randomly and are shown as examples because all the days show similar curves. The superior performance of the tracking system compared to the fixed system can be observed mainly in the morning and afternoon periods, while at noon, both systems were identically oriented and collect the same irradiance. The measurements registered during two example days are shown in Figure 14a,b. These days have been selected randomly and are shown as examples because all the days show similar curves. The superior performance of the tracking system compared to the fixed system can be observed mainly in the morning and afternoon periods, while at noon, both systems were identically oriented and collect the same irradiance. With the data registered over the experimental campaign, it is possible to compare the daily irradiation collected by the fixed and tracking systems. The numerical results are presented in Table  4, as well as the percentage of irradiation gains obtained by the tracking system for each measured day. These results exhibit that the percentage gains of the tracking system were in the range 26.6%-33.4% at this time of year in Aguascalientes. The average irradiation gain was 29.9% for the experimental campaign. The difference in the percentage gains compared to the average gain is also indicated in the table for each measured day. Six days showed positive differences (gains higher than With the data registered over the experimental campaign, it is possible to compare the daily irradiation collected by the fixed and tracking systems. The numerical results are presented in Table 4, as well as the percentage of irradiation gains obtained by the tracking system for each measured day. These results exhibit that the percentage gains of the tracking system were in the range 26.6-33.4% at this time of year in Aguascalientes. The average irradiation gain was 29.9% for the experimental campaign. The difference in the percentage gains compared to the average gain is also indicated in the table for each measured day. Six days showed positive differences (gains higher than the average), while three days showed negative differences. These three days exhibited an absolute value of the difference higher than the six days with a positive difference, being responsible for a decay of the average gain. Table 4. Daily irradiation collected by the tracking and the fixed systems for the 9 days of the experimental campaign, percentage gain of irradiation obtained by the tracking system, and difference of the percentage gain from the average gain.

Day
Tracking The irradiance gains of the tracking system compared to the fixed system over the 9 days of the experimental campaign can be analyzed more in detail by examining the minimum, average, and maximum gains over local time ( Figure 15). It can be seen that the average gain curve had two maxima (located approximately in the 8:00-9:00 am and the 5:30-6:30 pm ranges). These were the operating points with the best performance improvement due to the tracking movement. These points differed from sunrise (around 6:30 am) and sunset (around 7:15 pm) because the limits in the rotatory angle avoided more perpendicularity compared to the solar rays during these events. It can also be highlighted that the uncertainty in the measurements (understood as the difference between the minimum and maximum gain at a given local time) was higher in the first and last hours of the day compared to the interval around noon. This can be due to low irradiance errors inherent to the current sensors and to the fast change in the irradiance level during the first and last hours of the day. As can be seen, the uncertainty bars were quite small in the interval around noon, in which most of the energy was generated by the PV system.
The experimental value of the average irradiation gain (29.9%) can be compared with the ideal irradiation gain of a tilted north-south single-axis sun tracker in the site at this time of year, which can be calculated following the procedure described in Section 3. The ideal percentage gain was 32.3%. Therefore, the prototype obtained irradiation gains somewhat lower than the ideal percentage. The difference can be due to the limits in the angle of rotation of the mechanical structure (between −45 • and 45 • ). However, the obtained irradiation gains are relevant for an energy generation device for building integration. Energies 2020, 13, x FOR PEER REVIEW 18 of 20 Figure 15. Analysis of average irradiance gains of the tracking system compared to the fixed one over the day for the 9-days experimental campaign and, difference between the maximum and minimum gains represented by the bars.

Conclusions
First, it is possible to observe that the proposed first-of-its-kind sun tracking system through IoT for building integration can provide a substantial increase in energy production (29.9% in May in Aguascalientes), showing an expected behavior close to that found in the ideal solar tracking system of the same type (32.3% in May in Aguascalientes). This, in addition to the low cost of implementation and the design of the control system, which due to the algorithm, can operate anywhere in the world automatically, makes this system very innovative and flexible in terms of implementation. Although the sun-tracker mechanical structure is not novel, the Internet of Things architecture is innovative, and such an approach cannot be found in the literature. The proposed system is suitable for integration in buildings, which often have a Wi-Fi connection available. In addition, the inclined axis makes the proposal for its implementation in small sun-trackers more suitable.
Another advantage of the system is the possibility of displaying its behavior through Firebase since this platform allows visualizing the number of requests made by the control circuit, as well as the value delivered. In this way, it is possible to know the position of the tracker at any time.
A drawback that arises from the use of this system is the need for a Wi-Fi connection. Although in applications for houses or buildings, this may not be very limiting, it is so if for large-scale applications for power generation on solar farms. In addition, a Wi-Fi signal drop would result in losses in the energy generation (in these periods, the sun tracker would not be optimally oriented).
An improvement area that could be identified was the construction of the structure that supports the photovoltaic modules, especially focused on cost reduction. This can be achieved using cheaper, similar performing materials, or even better, through a redesign of the structure, managing to find a cheaper design that has the same level of support as the structure used.