Electronic multiplex system using the Arduino platform to control and record the data of the temperatures profiles in heat storage tank for solar collector

This work aims to build a monitoring thermal system based on low cost and using the Arduino MEGA platform. To the temperature, measurements are used thirty (30) digital sensors (DS18B20 Dallas) boarded together using three (3) wires, therefore, requiring the “One Wire” library to allow a correct read in the Arduino software. Using the Dallas sensors and the Arduino programming, it is possible monitoring the temperatures of up to 100 and twenty (120) different points, thereby significantly reducing electric problems and also the diameter of the thermal probe from uses only three (3) wires. The use of thirty (30) digital sensors significantly reduces the electrical problems and increases the processing speed using the multiplexing through the electrical connection to three (3) wires, called “normal power mode”. Using the thermal probe, which is installed, vertically inside the reservoir, it is possible to obtain the temperature graphical points, thus allowing the analysis of thermal stratification. The software used is Arduino IDE based in a language called CCS (C, C++ and “Wiring”). The water inside the reservoir stores energy in the form of sensible heat, based on the importance of the thermodynamics analysis result for this research, therefore, with some temperature, data samples obtained in thermal probe are possible to analyze the thermal stratification in the reservoir. The thermal efficiency of the energy stored in the water, either thermally stratified or homogeneous, analyzed to the first law of thermodynamics, it is the same. In the case of the second law of thermodynamics, the heat efficiency to heat homogenized water is less than the thermal efficiency in the stored water thermally stratified in the reservoir and both of them are lower than the first law of thermodynamics.


Introduction
The solar collector is a device able to capture solar energy, which is absorbed by a fluid which is later stored in a reservoir used for a specific purpose [1,2] and [3], Fig. 1.
Also was investigated by [4], the thermal efficiency of the photovoltaic air heating using fins attached to the collector. There are many examples for electronic monitoring as in clothing used in hospitals and health centers [5], with the Arduino platform as a cheap and simple system control. It was developed by [6] an efficiency monitoring system to control a photovoltaic solar power plant.
In the case of thermal stratification, [7,8] studied the turbulence in the inlet region of the reservoir and temperature profiles at different levels of height of the same reservoir.
One of the energy storage techniques is by fluid thermal stratification into a vertical reservoir [9]. In this classic process of energy storage in the form of internal energy, a mass of liquid is held in an isolated reservoir for a time. This form of storage is known as thermal storage sensible heat. Another process used is the thermal latent heat storage, where the fluid is maintained at a constant temperature while provides or absorbs energy. The stratification process is a liquid thermal front that moves into the reservoir, as it occurs incidence of the solar heat collector. Therefore, this thermal's front velocity can be obtained by the time measuring and the distance between the sensors each other (DH). The study of the effect on storage due to water inlet and outlet in a reservoir was conducted by [10], stratification of the study by [11], and developed by [12], using comparisons about the theoretical values from experiments in the thermal stratification study, thus validating the thermal transient model.
A simulation study was realized by [11][12][13][14][15][16], analyzing the thermal stratification, where the isoclines were obtained and compared with the experimental studies in the literature. Besides, [17] studied the non-linear thermal stratification with a water sample that contained fifty (50) layers of electrically heated water in different temperatures, proving the reduction of 15 % in the electric energy consumer, using this technique. Due to the reservoir crosssectional area is known, it is possible to measure the water flow in the system.
A wireless low-cost system board of sensors to warm the water in forced circulation using the Arduino UNO and sensors DS18B20 was built by [18], analyzing the temperatures inside the thermal reservoir. In addition, [17][18][19][20] built a system to acquire to temperature data measures using the Arduino platform. Besides, [21] developed a system of catch and wireless monitoring data using the Arduino MEGA 2560.
A low-cost monitoring system using the Arduino UNO was built by [22], and a graphic demonstration made with the Octave GUI software.
The logical address location (serial number) of the Dallas sensors is ordinate in 64-bits and represented in hexadecimal code, example given: 28 DA CA 27 5 0 0 49. The software to identify this address and the electric system was developed by [23], such as the basic program to read the DS18B20 sensors, and was presented by [24], an alternative to program the sensors reading, and highlights the need to use the ''One Wire'' library [25] that must be uploaded in the Arduino IDE.

Mathematical modeling and methodology
In the mathematical model of thermal stratification, the height of the reservoir was divided into ''n'' nodes, resulting in a system of ''n'' differential equations to ''n'' unknowns T(z,t) and their boundary conditions and initial conditions, resulting energy balance, as resolved by [17]. In addition, [26] studied the temperature profile and speed of the front of thermal stratification in a laminar boundary layer.
From any instant of the initial and final time (t and t final ) during thermal loading operation of the reservoir, the temperature profiles obtained T(z,t) and its T min reference temperature permitted between the points analyzed are possible to determine the available transiently energy stored. Thus, the energy of the stratified fluid is stored until that moment in load operation, that is, injection of hot fluid on top of the reservoir, according to [27], and, mathematically by [9], can be obtained by the relationship: The transient thermal efficiency by the first law of thermodynamics, for a thermally stratified fluid in the reservoir, is obtained by the relationship: where E max : maximum of energy admitted in the reservoir, that is, when T(z,t) equals to T max.
To study the second law of thermodynamics, the available work is able to obtain by determining the capacity than the constant mass in the reservoir to realize a reversible process [9]. Thus, the expression of work between time any (t) and the final time (t final ), for thermally stratified mass in the reservoir, developed by [9], is obtained by the following relationship: Using Eq. (3), it is possible to calculate the thermal system efficiency from the second law of thermodynamics for stratified fluid, according to the relationship: where W max : maximum of work obtained in a reversible process, when the mass of the fluid in the reservoir reaches a homogeneous temperature, that is, T(z,t) equals to T max. When the mass of fluid in the reservoir reaches a homogeneous temperature, only time-dependent, Eq. (3) reduces to the following relationship: Thus, the thermal efficiency by the second law of thermodynamics, for thermally homogeneous mass, inside the reservoir is given by the relationship: where W max : maximum of work obtained when the mass of the fluid in the reservoir reaches a homogeneous temperature, that is, T(t) equals to T max. To calculate the instantaneous temperature average of the fluid, it was used the relationship: or, Experimental In this study, the thermal probe formed by 30 digital temperature sensors (Dallas DS18B20) [28] spaced of 50 mm records the temperature of the transient profiles to generate the isoclines that compose the thermal stratification, as shown in Fig. 2. The sensors are controlled by an Arduino MEGA [29] boards system [20,21].
The records of temperatures stored in an SD card at every time interval of 5 s.
It is installed in the circuit of the thermal probe of protection system against voltage disturbances composed by a Zener diode (1N4733) [30] and a 63 Ohms resistor against the electrical current peak. The sensor signals are sent by a communication protocol called ''1-wire'' [25]. This is possible due to Dallas architecture that contains a ROM memory of addressing.
The Real-Time Clock (RTC), which uses an encapsulated chip DS1307 [31], records the date and instant time of measurements of temperature data, sending them to the MEGA board, as shown in Fig. 3.
The 30 sensors are connected to the MEGA board with three electrical wires, eliminating thereby the inconvenience of many analog connections.
The MEGA Arduino 2560, programmed in CCS language, presented in the flowchart 4, that after referred processing of the temperature data, date and time, received from the thermal probe and RTC, respectively, stores them in XML (Extensible Markup Language) in an SD memory card (Fig. 4).
The XML language facilitates the treatment of these data, either by automatic or manual interpretation of the data spreadsheet programs.
The communication between the MEGA board and its peripherals is shown in the block diagram in Fig. 5.

Results and discussion
The signals recorded by the Arduino board show a series of temperature transients points called isoclines, that make up the thermal stratification, as shown in Fig. 6. For better viewing of the spots, these were unified by straight segments. Fig. 7 shows the transients profiles of temperature versus the height of the reservoir during its dynamic loading process. It is observed, in referred figure, the transient deformation of the initial profile of temperature between the initial time and final time. It is possible to notice, in this case, the thermal short circuit shown by the increase in water temperature in the bottom of the reservoir, about 26 to 27.5°C. This is because of the heat flow across in the wall between the top and the bottom of the reservoir.
Figs. 6 and 7 show the temperature profiles of each height position of the thermal probe, where the measures variables make it possible to obtain the quantities of work and storage energy inside the reservoir, being possible, thus   (Fig. 8). Figure 8 shows the thermal efficiency result by the First as the Second law of the thermodynamics to each technique of heat storage, thermally stratified or thermally homogeneous.

Conclusion
The great advantage of using the multiplex system is the elimination of thermocouple wires which produce an electrical cable larger than the diameter of the thermal probe, whose installation modifying fluid flows in the thermal reservoir. Another interesting aspect is the low cost of Arduino boards and open source programming. The information obtained from the thermal probe, it is also possible to verify that by applying Eqs. (4) and (6) together with Eq. (7) shows that for the same T max and T min , the thermal efficiency of stratified fluid by the second law of thermodynamics is, at any time, greater than that for the homogeneous fluid. Without this feature, measurement transient temperature is impossible to determine the values and parameters of thermal efficiency reservoir and also the efficiency of solar energy collection system as proposed in Fig. 1.
The thermal efficiency of storage energy in the water, either thermally stratified or thermally homogeneous, by the first law of thermodynamics is equal. In the case of the second law of thermodynamics, the thermal efficiency of the water thermally homogeneous is less than the thermal efficiency to water storage thermally stratified, both of them lower than by the first law of thermodynamics.  The thermal probe must receive special care about your assembly, because the incorrect connections and handling can occur in problems like an electrical short circuit in the sensors or a thermal over-load in the system.
To allow the correct operate in the sensors, the thermal probe is necessary a careful with the system, applying protections, such as: electrical isolation do not generate a short circuit by the water contact, and correct connection of