Development of a Utility Model for the Measurement of Global Radiation in Photovoltaic Applications in the Internet of Things (IoT)

In order to develop future projects in the field of photovoltaic solar energy, it is essential to accurately know the potential solar resources. There are many methods to estimate the incident solar radiation in a certain place. However, most of them are very expensive or do not have the ideal characteristics for good monitoring of a particular photovoltaic installation. For these reasons, an electronic device connected to the internet of things (IoT) is presented in this paper which manages to measure global radiation in photovoltaic applications. The device developed has been patented in the Spanish Patent and Trademark Office. It presents some features that make it very suitable to measure photovoltaic installations with the advantage of being a low cost and very reliable device. The device has been tested to determine global horizontal irradiance obtaining a correlation coefficient R2 = 0.994.


Introduction
Renewable energies have proven to be very reliable energies for the future world energy scenario.There are many such energies, and the degree of technical and economic maturity of all of them is very varied, although in general they are all very technologically advanced and are beginning to be, or already are, fully competitive economically against "conventional" energies [1].
The growth of the installed power capacity of renewable energies during the period 2001-2015 can be seen in Figure 1, obtained from the International Renewable Energy Agency (IRENA) 2017 report [2].It is noteworthy that, from 2012, the accumulated power of renewable energies began to be higher than those of non-renewable energies, and continues thus.The accumulated power of renewable energies presents variable behavior.That is to say, it does not present continuous growth, but there are years in which it increases and others in which it decreases.The maximum value reached 145 GW in 2007.However, observing Figure 1, we see that the evolution of accumulative power of renewable energies is of continuous growth, reaching a maximum value of 154 GW in 2015, and as mentioned above, it has consistently obtained higher values than non-renewable energies since 2001.
Of all the renewable energies, it is interesting to highlight photovoltaic solar energy [3] for different reasons.In relation to its growth and degree of maturity it is undoubtedly one of the renewable energies with better future prospects.More than twenty years of photovoltaic (PV) market development have resulted in the deployment of over 403 GW of PV systems throughout the world.In Figure 2 the evolution of the cumulative PV installations in GW from 2007 to 2017 can be observed.Reference International Energy Agency (IEA) report 2018 [4].Likewise, photovoltaic systems have special characteristics that provide them with added values as electricity production systems.The modularity of photovoltaic systems stands out in particular.This implies that facilities of the desired size can be designed depending on the use of the installation.Designing facilities of the necessary size and adapting the generation curves to those of electric Of all the renewable energies, it is interesting to highlight photovoltaic solar energy [3] for different reasons.In relation to its growth and degree of maturity it is undoubtedly one of the renewable energies with better future prospects.More than twenty years of photovoltaic (PV) market development have resulted in the deployment of over 403 GW of PV systems throughout the world.In Figure 2 the evolution of the cumulative PV installations in GW from 2007 to 2017 can be observed.Reference International Energy Agency (IEA) report 2018 [4].Of all the renewable energies, it is interesting to highlight photovoltaic solar energy [3] for different reasons.In relation to its growth and degree of maturity it is undoubtedly one of the renewable energies with better future prospects.More than twenty years of photovoltaic (PV) market development have resulted in the deployment of over 403 GW of PV systems throughout the world.In Figure 2 the evolution of the cumulative PV installations in GW from 2007 to 2017 can be observed.Reference International Energy Agency (IEA) report 2018 [4].Likewise, photovoltaic systems have special characteristics that provide them with added values as electricity production systems.The modularity of photovoltaic systems stands out in particular.This implies that facilities of the desired size can be designed depending on the use of the installation.Designing facilities of the necessary size and adapting the generation curves to those of electric Likewise, photovoltaic systems have special characteristics that provide them with added values as electricity production systems.The modularity of photovoltaic systems stands out in particular.This implies that facilities of the desired size can be designed depending on the use of the installation.Designing facilities of the necessary size and adapting the generation curves to those of electric consumption makes possible a better correlation between production and consumption, thus reducing the period of overcapacity that exists in large facilities.The performance of a photovoltaic system could depend on the seasonal effects, weather and the system quality, therefore it is essential to measure and analyze the energy production of the system.In this sense, a solar monitoring system was designed in order to measure the electrical and weather parameters of thirteen photovoltaic plants.These plants were of at least seven years old where measured data reflects the electrical energy production was as expected for the same system at the weather conditions during these seven years [5].
Currently the distribution companies carry out the installation of smart meters for remote reading of consumptions.This will facilitate the integration of renewable generation in electricity distribution networks.The new technological capabilities can respond to the new demands, configuring a true milestone in the management of smart electric networks or smart grids [6,7].These intelligent networks must make a reality the "smart cities" that are an emerging paradigm worldwide.The "Smart Cities" are supported by studies on the energy behavior of cities around the world.Such is the scope of the issue that the European Commission, in its draft proposals for the imminent call of the Horizon 2020 program, marks Smart Green as a priority line of action [8].
All the advances mentioned must help the photovoltaic systems to reach the 'grid parity' [9,10] with other systems of production of energy and allow the constant development, sustained and without need of subsidies.The development of elements that make the energy coming from the photovoltaic systems pour "intelligently" to the grid will contribute to improve energy efficiency and energy management, which will maximize the integration of renewable energies in buildings and local electrical networks.
Both non-renewable energies and renewable energies need raw material for their operation: For example, coal or oil, in the case of non-renewable energies; or wind or water in the case of renewable energies.In the case of photovoltaic solar energy, the raw material used is the solar radiation received in the photovoltaic installation [11,12].Correctly estimating this global radiation or available solar resource is one of the main aspects that can help the development and improvement of photovoltaic systems.Depending on the available solar resource, the energy obtained from photovoltaic systems can also be evaluated, as well as the development of diagnostic tools that favor energy self-consumption based on this type of energy.By measuring global radiation, an optimal location [13] of solar prospecting can be found that maximizes operational efficiency and also helps make investment decisions [14,15].The objective of this work is to present a registered utility model with which the global radiation is monitored.This utility model will be especially indicated for applications based on photovoltaic solar energy since it has good characteristics for its integration in the monitoring of photovoltaic systems [16][17][18].
The work presented here has been organized as follows.This first part is the introduction.Subsequently, the different methods that are usually used to obtain global radiation will be indicated.As a third part, the utility model developed by the authors of this work with the aim of setting up a low-cost monitoring system is presented.This section consists of two parts, one dedicated to the hardware of the measurement system developed and another to the software of the same.Some of the first results obtained are presented in part 4, to finalize the work with the conclusions obtained, as well as indication of possible improvements and future actions.

Obtaining Global Radiation in Photovoltaic Applications, Previous Experiences
As previously indicated, in any photovoltaic system it is important to have the most reliable knowledge possible of the solar radiation incident on it.The global radiation (G) that affects a horizontal surface is formed by three components: the beam or direct component (B), the diffuse component (D) and the albedo or reflected component (R).The direct component is that which comes directly from the sun, while the diffuse component is that which comes from the rest of the atmosphere, mainly by dispersion of part of the solar radiation incident on it.Finally, the albedo component corresponds to the percentage of radiation that comes from the reflection of any surface [19].In Equation (1) the expression that defines the global radiation is shown as the sum of its different components: where α and β represent the orientation and inclination of the surface from which the measurement is made respectively.In very sunny climates between 20% and 30% of the radiation on horizontal surfaces is diffuse.More typically, the beam diffuse mix lies in the range 40-60% according to mean sunniness.Diffuse radiation thus forms a significant part of the resource [20].It should also be noted that obtaining the measure of radiation can be useful in other fields that require knowledge of this variable, such as meteorological studies related to climate change [21], analysis of passive solar systems, or agriculture, as well as programming irrigation systems or bioclimatic architecture, among many others [22,23].
Knowing the global radiation received by photovoltaic systems is necessary for its design and for the evaluation of its energy productivity [24], as well as knowing its economic profitability.To carry out initial studies of the energy behavior of a photovoltaic installation, it is usually sufficient to know the monthly averages of global radiation.However, it may be necessary to know the value of G at a specific time, with different temporal resolutions when monitoring a photovoltaic installation in order to know the energy productivity of each moment as well as detecting faults in its operation.Also, if the photovoltaic installation has a certain inclination and orientation the different values of the global radiation in the plane of the generator under study can be obtained by applying the corresponding mathematical expressions or any software application that solves this problem [25,26].
In the next section, some experiments for obtaining global radiation, obtained from the scientific literature, will be summarized, focusing specifically on photovoltaic applications.

Pyranometers
The instrument to measure the global radiation traditionally used is the pyranometer [27,28].The pyranometers have a field of vision equivalent to a half sphere.A pyranometer is usually formed of a black surface, consisting of a set of thermocouple junctions, a white disc that limits angular acceptance, and two transparent, semicircular and concentric shells made of glass.These dome-shaped covers protect the sensor from thermal convection, and from rain, wind and dirt.
With the pyranometer you can measure both the global radiation and the diffuse and albedo components.To measure only the diffuse component of the global irradiance, a screen-like system will be placed to perform the shading, thereby hindering the direct component.In the case of measuring the albedo radiation, the pyranometer is placed in inverted position.Finally, it is frequently used to measure the global solar radiation received at the same inclination as the receiving surface.In this case, it is placed coplanar to the receiving surface.
It is considered that the measurement of global solar irradiation incident on a flat surface through a pyranometer in the field of photovoltaic applications is the most reliable [29,30], since the desired physical magnitude is directly measured, and not estimated from other observations.Although it is important to note that the use of a pyranometer for the measurement of global solar radiation outside the field of research is not widespread, due to its high cost.

Satellites
The second method used to obtain the available solar resource in a certain area is the use of satellite images [31,32].Generally, geostationary satellites are used.The pioneers in this methodology were Tarpley (1979 [33] and Gautier (1980) [34].)There are satellites that store images of areas and this information is then processed by models of image processing, which allow estimation of G.The data are presented in databases (sometimes for the use of the databases the researcher must pay, but other times they are freely available).
In the case that solar horizontal global radiation data are used by means of satellite images, the parameter value of large areas is obtained simultaneously, favoring the analysis in our case of the study of the photovoltaic potential in a given area.It is important to take into account that, in this case, these are not monitored data of the PV so when they are used in photovoltaic applications, it may not match the data of a certain time because of the changing sky conditions in times of cloudiness.

Calibrated Cells or Modules
The third option began to be used in the first monitoring of photovoltaic systems, where there were not enough records of solar radiation data.So the use of calibrated cells or calibrated modules manufactured with the same materials as the photovoltaic modules of the installation itself were used.The methodology followed in this case, is to take advantage of the relationship between the electrical power they generate and the solar irradiance that these components receive.
In order to perform this measurement reliably, it is necessary that the cells or photovoltaic modules are calibrated.The calibration can be done in a laboratory, or using a pyrometer as a pattern [35].Otherwise, the cell or module can be calibrated using a solar simulator [36].To automate its measurement process, a shunt resistor is placed and its short-circuit current is measured, which will be proportional to the received radiation.In this way, the intensity is directly transformed into an electrical signal.They have the advantage that the values that both provide, electrical power generated and received solar radiation, are very reliable since the cells or modules are calibrated by using the same technology as those installed in the photovoltaic system that you want to measure.Later, there are mathematical models to evaluate solar irradiation using a cell or a photovoltaic module [37][38][39].

Other Devices
Finally, many other devices that are used or have been used throughout the evolution of solar radiation measurement methods such as photodiodes, calorimetric sensors, thermomechanical sensors or thermoelectric sensors can be highlighted.
Of these devices, one of the most used is photodiodes [40].These devices are based on the photovoltaic effect and are often used when portable and low cost meters are required.The photodiodes present a linear response to the visible spectrum, which is used to measure the solar radiation that is sought.Initially, an exhaustive study of the photodiode characteristics sheet should be carried out to verify if the response and the wavelength of the radiation to be measured is adequate.It will also be taken into account that the photodiode is encapsulated with its corresponding signal conditioning to obtain a better response and greater immunity to noise [41].Other aspects that should be taken into account when using these devices are the area sensitive to radiation (mm 2 ) and the spectral sensitivity (A/W), to obtain the value of global horizontal irradiance (GHI) (W/m 2 ).There are also complete experiences, such as in our case, in which the complete data acquisition system is designed, including signal conditioning [42,43].

Materials and Methods Used for the Patented Utility Model for the Measurement of Solar Radiation
Knowing the different methods that are used to obtain the data of the horizontal global solar radiation received in a certain place, it is deduced, as has been emphasized in the previous point, that they are usually very expensive methods and systems and that it is difficult to have the data in real time in the photovoltaic installation that is going to be analyzed.
With the idea of improving these two characteristics, it is proposed to create a low-cost solar radiation measurement system, in which it is easy to integrate these data with the data of the installation to be studied and to allow solar radiation to be evaluated in real time.Our team of researchers has developed a prototype that has been protected as a utility model submitted for evaluation by the Spanish Patent and Trademark Office [44].After the expert evaluation process, it has been protected with publication number ES1214734, which is described below [45].
In the diagram of Figure 3 the hardware solution of the utility model is shown.It can be seen that the developed utility model obtains the global horizontal irradiance (GHI) and acquires and transmits it using an internet of things (IoT) channel to be integrated into the monitoring system of a photovoltaic generator.In this sense the GHI data can be integrated and will make possible the energy evaluation of the photovoltaic system.
Electronics 2019, 8, x FOR PEER REVIEW 6 of 17 photovoltaic generator.In this sense the GHI data can be integrated and will make possible the energy evaluation of the photovoltaic system.

The Sensor and Its Conditioning
The sensor used for the measurement of GHI is the integrated circuit TSL230RD (Texas Advanced Optical Systems (TAOS), Premstaetten, Austria) that accurately measures solar radiation using a matrix of photodiodes.The assembly is based on the demonstrated utility of this sensor for the reliable measurement of horizontal global radiation.
The TSL230RD is programmable and, as shown in Figure 4, combines a configurable silicon photodiode and a current-to-frequency converter into a single complementary metal-oxidesemiconductor (CMOS) integrated circuit.Table 1 shows the functionality of its entries.The sensitivity of the device can be selected with the inputs S1 and S0.So the number of active receivers of the photodiode matrix is controlled.Depending on the application for which it is used, in this case, the value of GHI to be measured a higher or lower sensitivity will be selected, Table 2.If we select a very high sensitivity, it will be able to detect small GHI levels.

The Sensor and Its Conditioning
The sensor used for the measurement of GHI is the integrated circuit TSL230RD (Texas Advanced Optical Systems (TAOS), Premstaetten, Austria) that accurately measures solar radiation using a matrix of photodiodes.The assembly is based on the demonstrated utility of this sensor for the reliable measurement of horizontal global radiation.
The TSL230RD is programmable and, as shown in Figure 4, combines a configurable silicon photodiode and a current-to-frequency converter into a single complementary metal-oxide-semiconductor (CMOS) integrated circuit.Table 1 shows the functionality of its entries.
Electronics 2019, 8, x FOR PEER REVIEW 6 of 17 photovoltaic generator.In this sense the GHI data can be integrated and will make possible the energy evaluation of the photovoltaic system.

The Sensor and Its Conditioning
The sensor used for the measurement of GHI is the integrated circuit TSL230RD (Texas Advanced Optical Systems (TAOS), Premstaetten, Austria) that accurately measures solar radiation using a matrix of photodiodes.The assembly is based on the demonstrated utility of this sensor for the reliable measurement of horizontal global radiation.
The TSL230RD is programmable and, as shown in Figure 4, combines a configurable silicon photodiode and a current-to-frequency converter into a single complementary metal-oxidesemiconductor (CMOS) integrated circuit.Table 1 shows the functionality of its entries.The sensitivity of the device can be selected with the inputs S1 and S0.So the number of active receivers of the photodiode matrix is controlled.Depending on the application for which it is used, in this case, the value of GHI to be measured a higher or lower sensitivity will be selected, Table 2.If we select a very high sensitivity, it will be able to detect small GHI levels.The sensitivity of the device can be selected with the inputs S1 and S0.So the number of active receivers of the photodiode matrix is controlled.Depending on the application for which it is used, in this case, the value of GHI to be measured a higher or lower sensitivity will be selected, Table 2.If we select a very high sensitivity, it will be able to detect small GHI levels.In the case of the utility model presented, a "1x" sensitivity will be used, so the pins would be in "S0 High (H)" and "S1 Low(L)".A high sensitivity is not necessary since, being a GHI meter for photovoltaic applications, values lower than 150 W/m 2 are values that do not allow the operation of the installations to generate energy [46].
Pins S2 and S3 control the scaling of the output frequency, as shown in Table 3; this adaptation in frequency will allow the microprocessor of the data acquisition system to use synchronization for the reading of the square wave that is obtained as a function of the value of GHI.The option of pins "S2 and S3 High" has been selected, so the value of the frequency is divided by 100.For the capture of the frequency and its later interpretation, a very precise sampling time control is necessary.Therefore, one of the interruption inputs available in the microprocessor will be used, which ensures that any changes that will allow the number of pulses per second of the integrated circuit to be quantified in a very precise manner are taken care of as a priority.
The sensor has been protected from the weather by a dome in a waterproof box that allows it to measure properly on the outside, as shown in Figure 5.
Electronics 2019, 8, x FOR PEER REVIEW 7 of 17 In the case of the utility model presented, a "1x" sensitivity will be used, so the pins would be in "S0 High (H)" and "S1 Low(L)".A high sensitivity is not necessary since, being a GHI meter for photovoltaic applications, values lower than 150 W/m 2 are values that do not allow the operation of the installations to generate energy [46].
Pins S2 and S3 control the scaling of the output frequency, as shown in Table 3; this adaptation in frequency will allow the microprocessor of the data acquisition system to use synchronization for the reading of the square wave that is obtained as a function of the value of GHI.The option of pins "S2 and S3 High" has been selected, so the value of the frequency is divided by 100.For the capture of the frequency and its later interpretation, a very precise sampling time control is necessary.Therefore, one of the interruption inputs available in the microprocessor will be used, which ensures that any changes that will allow the number of pulses per second of the integrated circuit to be quantified in a very precise manner are taken care of as a priority.
The sensor has been protected from the weather by a dome in a waterproof box that allows it to measure properly on the outside, as shown in Figure 5.

Data Acquisition and Communications System
The measurement systems based on microcontroller are also often used for solar photovoltaic system, driven by economic reasons [47].Microcontrollers were used to measure humidity, temperature and solar radiation (photovoltaic sensor cell) parameters [48].Weather monitoring stations have also used microcontrollers as data acquisition (DAQ) devices in order to measure the wind speed, wind direction, ambient temperature, atmospheric pressure and solar radiation [49][50][51].A remote monitoring system for photovoltaic water pumping systems was designed and tested using a microcontroller; the prototype could measure both weather and electrical parameters [52].A microcontroller was used as the DAQ device, which is part of a low cost system to measure irradiance and temperature with BPW34 photo diode LM35 DZ temperature sensors [42].Open-source electronic platforms, which combine hardware and software, are quite widespread.An example of these platforms is Arduino, which has been used in a variety of designs.A low-cost prototype based on Arduino allows a real-time and remote control of wine physical and chemical parameters in the barrel [53].Mini Arduino Nanos were presented as cost effective and versatile components for acquiring and recording data to measure the current and voltage parameters of photovoltaic systems, loads and battery, as well as to estimate state of charge of the battery [54].
The acquisition of GHI data measured by the TSL230RD sensor is done with the data acquisition card (TAD) Arduino UNO.As mentioned above, it is a low cost card whose use is quite widespread, due to the large amount of existing documentation on monitoring projects that use devices based on Arduino, [55].The Arduino platform allows the use of free software, as well as exchanging opinions with the community that uses this platform which encourages learning in a self-taught way.Table 4 shows the characteristics of the TAD used.Another important aspect is that the acquisition of the data includes a temporary reference of the moment in which the data of GHI is taken.To incorporate this functionality, the acquisition of data is completed with the installation of a real time clock (RTC), model DS1307 (Maxim Integrated TM, San Jose, CA, USA).In this way each data of GHI has its temporal reference in the form of seconds, minutes, hours, day, month and year in which the measure is taken.In this way, parameter G will be part of the procedure that evaluates the energy and operation of the photovoltaic system under study.
The sensor, TSL230, has two types of results: a pulse train and a square wave.In the case of the developed prototype, the square wave output that has a 50% duty cycle will be used with the Arduino data acquisition card.To connect the sensor to the data acquisition card, a 100 nF capacitor is placed as close as possible to the power pins.The sensor connects terminals 1, 5, 7 and 8 to 5 V; pin 6 to pin 2; and terminals 2, 3 and 4 to ground.For communications, the circuit is connected through the I 2 C communication bus to the Arduino card, in addition to assigning a temporary reference to the data acquired to control the sampling time of the GHI, in this case it is 1 min.
The system is completed by selecting the means by which a user of the system accesses the measured data of GHI.For this, the device that has been used is an Arduino expansion card: Arduino Ethernet Shield, which enables communication via Ethernet, connecting to a local network socket and the TAD through the serial peripheral interface (SPI).Now the system will have an IP address that can be accessed when it is connected to a router.Finally, to store the information of the utility model, an internet of things (IoT) platform will be used.Nowadays, there are numerous free access IoT platforms.Although all of them allow storing data in real time, the one chosen in the proposed monitoring system is ThingSpeak, which was chosen due to its compatibility with the data acquisition system used and its possibilities for the analysis and visualization of the data.Access to it can be configured so that a username and password are required, or so that it is accessible to anyone who knows the web address.The IoT platform will allow storage and processing of information of the utility model in addition to having the information in any site that has a network

Software Solution for the Utility Model
To perform the code that controls the utility model, follow the steps explained in the flow chart shown in Figure 6.
Electronics 2019, 8, x FOR PEER REVIEW 9 of 17 Finally, to store the information of the utility model, an internet of things (IoT) platform will be used.Nowadays, there are numerous free access IoT platforms.Although all of them allow storing data in real time, the one chosen in the proposed monitoring system is ThingSpeak, which was chosen due to its compatibility with the data acquisition system used and its possibilities for the analysis and visualization of the data.Access to it can be configured so that a username and password are required, or so that it is accessible to anyone who knows the web address.The IoT platform will allow storage and processing of information of the utility model in addition to having the information in any site that has a network

Software Solution for the Utility Model
To perform the code that controls the utility model, follow the steps explained in the flow chart shown in Figure 6.Part (a) shows the initial sequence of the programming in which the software solution in the utility model must configure the system to recognize the hardware that composes it.
Firstly, the libraries to be used are included so that Arduino is able to detect the sensor model, as well as the rest of the electronic components that have been connected to it.The next step is to define all the variables involved in the monitoring that is going to be carried out.Later, the specific parameters of the Wi-Fi communication system and the RTC clock are configured for the temporary reference of the design system.Finally, the programming to store the data in the ThingSpeak channel is addressed.In order to carry out the programming of the part dedicated to communications, the Part (a) shows the initial sequence of the programming in which the software solution in the utility model must configure the system to recognize the hardware that composes it.
Firstly, the libraries to be used are included so that Arduino is able to detect the sensor model, as well as the rest of the electronic components that have been connected to it.The next step is to define all the variables involved in the monitoring that is going to be carried out.Later, the specific parameters of the Wi-Fi communication system and the RTC clock are configured for the temporary reference of the design system.Finally, the programming to store the data in the ThingSpeak channel is addressed.In order to carry out the programming of the part dedicated to communications, the channel and password must be specified in ThingSpeak, so that it is possible to write the monitored data of horizontal global radiation in said channel.
In Figure 7 the flow chart of the procedure for programming the radiation sensor (TSL230RD) is shown.The technical data are obtained from the sensor's data sheet.Its numerical values have been described previously.At the programming level, it must be taken into account that each time the sensor produces a pulse with rising edge, an interruption will be activated and the counting of the number of pulses will begin.The program, in order to operate with the sensor signal, in frequency, must perform the conversion between the numbers of pulses between the time it takes to obtain them according to the value of the horizontal global radiation to which it is exposed.Next, the constant that must be entered is calculated by making a query on the sensor's data sheet.With this last step, the scale factor for the frequency is obtained, as well as the correspondence factor between the output and its value in a µW/cm 2 .
Electronics 2019, 8, x FOR PEER REVIEW 11 of 17 In part (b) of Figure 6, the execution sequence for the acquisition of horizontal global radiation by Arduino is shown.The main program supports two modes of operation: check mode and normal mode.Therefore, you can do a system check or off-line mode in which you can make system adjustments.In this case, for the software adjustments to be made, the status of a control variable is queried.If the answer is positive, the data is sent to the serial port (operating mode as test or test) and if it is negative, they are not sent (normal operating mode).In normal operation mode or online operation mode in which horizontal global radiation data will be available in the ThingSpeak channel with the above mentioned sampling specifications.

Experimental Results and Discussion
Among the methods for obtaining the global solar radiation reviewed above, it can be highlighted that the two methods most commonly used in research are pyranometers and In Figure 6b, the execution sequence for the acquisition of horizontal global radiation by Arduino is shown.The main program supports two modes of operation: check mode and normal mode.Therefore, you can do a system check or off-line mode in which you can make system adjustments.In this case, for the software adjustments to be made, the status of a control variable is queried.If the answer is positive, the data is sent to the serial port (operating mode as test or test) and if it is negative, they are not sent (normal operating mode).In normal operation mode or online operation mode in which horizontal global radiation data will be available in the ThingSpeak channel with the above mentioned sampling specifications.

Experimental Results and Discussion
Among the methods for obtaining the global solar radiation reviewed above, it can be highlighted that the two methods most commonly used in research are pyranometers and methodologies based on the use of satellite images, both due to the quality of the data from solar radiation obtained with them.Nevertheless, they present some drawbacks: In the case of the pyranometer, it is a very economically expensive system; and in the case of horizontal global radiation data obtained with satellite images, it has the disadvantage that it does not provide real-time data in the photovoltaic system that is being analyzed.For these reasons, now there are other options used for the measurement of the horizontal global radiation, and often these are lower cost systems.
Initially the alternatives focused on the photovoltaic devices by means of calibrated cells or modules.Their response to the variation of solar radiation is well known, although a little reliability of the measurement is lost.Currently more and more studies are using other devices that provide low-cost solutions with real-time analysis, to measure the behavior of a photovoltaic installation, as well as the integration of information in smart grids.
In the results section we want to show the behavior of the sensor used to measure the horizontal global radiation in the calibration procedure of the utility model (Figures 8-10).The utility model has been calibrated using a reference meteorological station, Meteodata Geonic model (Geonica, Madrid, Spain), are provided with Eppley Piranometers (which are classified as "Secondary standards" per ISO 9060) located on the terrace of the Center for Advanced Studies in Energy and Environment of the University of Jaen (latitude 37.826 • N), to obtain the calibration constant to relate the output of the sensor with its corresponding value of G in W/m 2 .Figures 8-10 show in a superimposed manner the data of the pyranometer of the meteorological station that has been used as a standard and those obtained by the utility model in the calibration process.Three days have been chosen so that the behavior of the prototype can be shown in three very different days: a clear day (Figure 8), a very cloudy day with low global radiation (Figure 9) and a very cloudy day, but with a high global radiation value (Figure 10).   in a superimposed manner the data of the pyranometer of the meteorological station that has been used as a standard and those obtained by the utility model in the calibration process.Three days have been chosen so that the behavior of the prototype can be shown in three very different days: a clear day (Figure 8), a very cloudy day with low global radiation (Figure 9) and a very cloudy day, but with a high global radiation value (Figure 10).show in a superimposed manner the data of the pyranometer of the meteorological station that has been used as a standard and those obtained by the utility model in the calibration process.Three days have been chosen so that the behavior of the prototype can be shown in three very different days: a clear day (Figure 8), a very cloudy day with low global radiation (Figure 9) and a very cloudy day, but with a high global radiation value (Figure 10).In Figure 11 the measured global horizontal irradiance, expressed in W/m 2 of the two types of equipment (the pyranometer pattern and the utility model) is shown, obtaining a correlation coefficient R 2 = 0.9945, which gives an idea of the relative measure of the degree of linear association between both measures, as well as the reliability of the designed utility model.In Figure 11 the measured global horizontal irradiance, expressed in W/m 2 of the two types of equipment (the pyranometer pattern and the utility model) is shown, obtaining a correlation coefficient R 2 = 0.9945, which gives an idea of the relative measure of the degree of linear association between both measures, as well as the reliability of the designed utility model.In Figure 11 the measured global horizontal irradiance, expressed in W/m 2 of the two types of equipment (the pyranometer pattern and the utility model) is shown, obtaining a correlation coefficient R 2 = 0.9945, which gives an idea of the relative measure of the degree of linear association between both measures, as well as the reliability of the designed utility model.The campaign of measures has been one full year with a broad sample of days with different meteorological profiles.Finally, Figure 12 shows graphs representing the temporal evolution of global horizontal irradiance in the city of Jaen (Spain) on the days corresponding to seasonal changes:

Conclusions
The aim of this work is to describe an electronic device that has been registered as a utility model in the Spanish patent and trademark office.This device measures the global radiation on a horizontal surface.Once calibrated with a reference pyranometer and tested, it has obtained a correlation coefficient R 2 = 0.9945, a value that confirms the reliability of the designed utility model.The latter

Conclusions
The aim of this work is to describe an electronic device that has been registered as a utility model in the Spanish patent and trademark office.This device measures the global radiation on a horizontal surface.Once calibrated with a reference pyranometer and tested, it has obtained a correlation coefficient R 2 = 0.9945, a value that confirms the reliability of the designed utility model.The latter will be especially suitable for photovoltaic solar energy applications since it provides, apart from great accuracy, good characteristics for its integration in the monitoring of photovoltaic systems.
The proposed prototype has a novel use of a sensor which provides a frequency output proportional to the radiation it is exposed.The sensor has been evaluated for one year.For the evaluation, it has been subjected to real operating conditions.The utility model is completed with a data acquisition system in which sensor's frequency signal is directly connected to the interruption of the microprocessor of the Arduino UNO board.This solution allows a measurement of the signal by the microprocessor (16 MHz), which will be a priority.
In addition to its reliability, the researchers highlight its low cost and the prompt availability of radiation data, wherever it is located, since it uses an IoT channel as data storage.This data ubiquity makes the prototype an interesting irradiance meter to be used in smart grid type applications.
Moreover, if the irradiance at a given photovoltaic installation is measured, the harvested energy may be estimated by the photovoltaic generator at different operating conditions and at different reporting intervals.In order to contribute to intelligent distributed energy, further investigation may be achieved in order to manage the detection of failures in the system (i.e., the production in the next hours is not as expected, regarding the consumption that the system has previously estimated) and take the appropriate measures to ensure the availability of energy.
Author Contributions: All authors contributed equally to this work.
Funding: This research was funded by the Agencia Estatal de Investigación (AEI) and the Fondo Europeo de Desarrollo Regional (FEDER) aimed at the Challenges of Society (Grant No. ENE 2017-83860-R "Nuevos servicios de red para microredes renovables inteligentes.Contribución a la generación distribuida residencial").The authors wish to thank the Centrefor Advanced Studies in Energy and Environment CEAEMA, of the University of Jaen to Project Nuevos parámetros para la optimización del autoconsumo con sistemas fotovoltaicos.Contribución a la generación de energía distribuida inteligente.

Figure 2 .
Figure 2. Evolution of the cumulative PV installations in GW from 2007 to 2017.Source IEA [4].

Figure 2 .
Figure 2. Evolution of the cumulative PV installations in GW from 2007 to 2017.Source IEA [4].

Figure 2 .
Figure 2. Evolution of the cumulative PV installations in GW from 2007 to 2017.Source IEA [4].

Figure 3 .
Figure 3. Architecture implemented for the development of the utility model that measures global radiation (G).Real time clock (RTC).

Figure 4 .
Figure 4. (a) Block diagram of the integrated circuit (b) Description of the sensor terminals.

Figure 3 .
Figure 3. Architecture implemented for the development of the utility model that measures global radiation (G).Real time clock (RTC).

Figure 3 .
Figure 3. Architecture implemented for the development of the utility model that measures global radiation (G).Real time clock (RTC).

Figure 4 .
Figure 4. (a) Block diagram of the integrated circuit (b) Description of the sensor terminals.

Figure 4 .
Figure 4. (a) Block diagram of the integrated circuit (b) Description of the sensor terminals.

Figure 5 .
Figure 5. Image of the sensor before encapsulation.Figure 5. Image of the sensor before encapsulation.

Figure 5 .
Figure 5. Image of the sensor before encapsulation.Figure 5. Image of the sensor before encapsulation.

Figure 6 .
Figure 6.(a) Initial hardware configuration utilized (b) Flow diagram of the software solution of the utility model.

Figure 6 .
Figure 6.(a) Initial hardware configuration utilized (b) Flow diagram of the software solution of the utility model.

Figure 7 .
Figure 7. Flow diagram of signal acquisition of the radiation sensor.

Figure 7 .
Figure 7. Flow diagram of signal acquisition of the radiation sensor.
Electronics 2019, 8, x FOR PEER REVIEW 12 of 17the University of Jaen (latitude 37.826 0 N), to obtain the calibration constant to relate the output of the sensor with its corresponding value of G in W/m 2 .

Figures 8- 10
show in a superimposed manner the data of the pyranometer of the meteorological station that has been used as a standard and those obtained by the utility model in the calibration process.Three days have been chosen so that the behavior of the prototype can be shown in three very different days: a clear day (Figure8), a very cloudy day with low global radiation (Figure9) and a very cloudy day, but with a high global radiation value (Figure10).
show in a superimposed manner the data of the pyranometer of the meteorological station that has been used as a standard and those obtained by the utility model in the calibration process.Three days have been chosen so that the behavior of the prototype can be shown in three very different days: a clear day (Figure8), a very cloudy day with low global radiation (Figure9) and a very cloudy day, but with a high global radiation value (Figure10).

Figures 8- 10
show in a superimposed manner the data of the pyranometer of the meteorological station that has been used as a standard and those obtained by the utility model in the calibration process.Three days have been chosen so that the behavior of the prototype can be shown in three very different days: a clear day (Figure8), a very cloudy day with low global radiation (Figure9) and a very cloudy day, but with a high global radiation value (Figure10).

Figure 9 . 2 )Figure 9 .
Figure 9. Evolution of global horizontal irradiance on a cloudy day of low radiation, May 8, 2016.

Figure 10 .
Figure 10.Evolution of global horizontal irradiance on a cloudy day of high radiation, May 22, 2016.

2 )Figure 10 .
Figure 10.Evolution of global horizontal irradiance on a cloudy day of high radiation, 22 May 2016.

Figure 10 .
Figure 10.Evolution of global horizontal irradiance on a cloudy day of high radiation, May 22, 2016.

Figure 11 .
Figure 11.Correlation coefficient R 2 , obtained by means of two methods.

Figure 11 .
Figure 11.Correlation coefficient R 2 , obtained by means of two methods.The campaign of measures has been one full year with a broad sample of days with different meteorological profiles.Finally, Figure 12 shows graphs representing the temporal evolution of global horizontal irradiance in the city of Jaen (Spain) on the days corresponding to seasonal changes: 20 March 2016 (spring equinox), 21 June 2016 (summer solstice), 22 September 2016 (autumn equinox) and 21 December 2016 (winter solstice).

Table 1 .
Terminals of the TSL230RD with which the sensitivity of the integrated circuit is selected.

Table 2 .
Values of the terminals of the TSL230RD for the adjustment of the sensitivity in the integrated circuit.

Table 3 .
Values of the TSL230RD terminals for the adjustment of the frequency in the integrated circuit.

Table 1 .
Terminals of the TSL230RD with which the sensitivity of the integrated circuit is selected.

Table 2 .
Values of the terminals of the TSL230RD for the adjustment of the sensitivity in the integrated circuit.

Table 3 .
Values of the TSL230RD terminals for the adjustment of the frequency in the integrated circuit.

Table 4 .
Characteristics of the data acquisition card.