Level Transducer Circuit Implemented by Ultrasonic Sensor and Controlled with Arduino Nano for its Application in a Water Tank of a Fire System

This article aims to describe the design of a circuit of a level transducer implemented by means of an ultrasonic sensor and controlled by Arduino Nano, applied to a water tank of a firefighting system. Initially, the integration of the Siemens 1212C programmable logic controller is described, in the connection between the sensor, the controller and the interfaces that allow to generate the monitoring, control and data recording, conditioned by a PWM pulse width modulated signal controlled by Arduino Nano. When developing the research and performing an analysis of the linear regression model, it is established that the behavior of the controlled variable with respect to time, generates a linear voltage response in the range of 0 to 10 volts; expressing in terms of correlational relationship a factor of R2 equal to 0.997, thus establishing that the designed transducer does not show susceptibility to noise or disturbances in the start-up of the firefighting system. Keywords—Level transducer; ultrasonic sensor; Arduino Nano; control; pulse width


I. INTRODUCTION
A control system essentially seeks to increase the efficiency of the entire process by maintaining the main variables of the system, within the pre-established range as optimal for the process [1]. Control systems seek to reduce the errors or margins of error typical of non-automated systems, reducing the risks of the plant or process working in unstable conditions [2], [3]. In the same line of opinion in [4], the author points out that control systems are implemented with the purpose of controlling the drive of machines or actuators, seeking to reduce the probability of failures and maintaining certain values of variables at determined intervals.
Under the above, and focusing on industrial systems that rely on fluid fill level control mechanisms. In [5], [6] the authors point out that in the industrial field there are several variables that intervene in the control of the altitude level of some type of fluid on tanks or reservoirs, which makes it essential to control with devices capable of monitoring and controlling permanent variable tank fill level. Also in [7] the author points out that liquid level system represents a concrete example of control systems with wide diffusion in industrial settings. And it is that any process that needs to store substances in any of their states requires records on the level of deposit of the same in order to make timely and appropriate decisions in search of ensuring the sustainability of the production process [8].
In the search for quality in the production process, guaranteeing liquid level and flow control in tanks is a common problem in industrial processes [9]. Increasing globalization, quality standards and high production standards are the main foundations for specialists to intensify the study of automatic control strategies [10]. In this sense, the study and analysis of variables that intervene in the behavior of related systems in production processes is important and necessary [11]. In this regard in [12]- [14], the authors point out that taking into account technical aspects for the functioning and operation of the sensors and actuators on which the automation and control technology is based. The level control is intended to keep the level of the liquid or fluid within a predetermined value [15]. The inspection of the level height of a fluid by ultrasound encompasses a family of methods based on the transmission of a high frequency wave [16]- [18]. The level sensor detects the surface echo and sends it back to the microprocessor for a digital representation of the distance between the sensor and the surface level [19]- [21]. Low intensity ultrasound signals or, in other words, high frequency signals provide relevant and appropriate information regarding the characterization of liquids or fluids, being able to penetrate containers and chamber walls without significant degradation [22]- [24]. These signals are waves that can propagate through different media such as liquid, solid and gas [25]. In this regard, in [26], [27], the authors point out that the speed with which ultrasound signals propagate and its effects depend mainly on the density and viscosity of the medium www.ijacsa.thesai.org through which they travel, which is why they are They use these signals in industrial and measurement applications.
The electronic instrumentation used to measure the level of liquids works by measuring the height of liquids above a reference line on the one hand, or by measuring the hydrostatic pressure or by using other phenomena. This is the case of ultrasonic sensors, which incorporate an analog signal converter, a processor and input and output interfaces [28]. In this sense, the functionality of embedded systems built from Arduino technology is highlighted, which under its integrated environment seeks to facilitate the use of electronics in multidisciplinary projects [29]- [32].
In this sense, this article aims to describe the circuit of a level transducer implemented by means of an ultrasonic sensor and controlled by Arduino Nano, applied to a water tank of a firefighting system, for which i will initially proceed to specify the connection logic between the sensor, the controller and the interfaces that allow generating the monitoring, control and data recording of the variable under analysis. Finally, an analysis of the dispersion model of the collected data will be carried out in order to establish the behavior of the controlled variable with respect to time.

A. Design and Research Level
The research method is quantitative, because the filling level of the tank of the firefighting system will be measured with respect to the voltage provided by the transducer output, likewise, the response of the controlled variable is evaluated, in this case the relationship that exists between the altitude measured by the sensor in response to the activation of the fire system.
The research level is descriptive-correlational; it is descriptive because the behavior of the collected data is detailed through statistics in relation to the indicators of the variable under analysis. In addition, it is correlational because it seeks to establish the level of association or relationship between the indicators under analysis in the firefighting system, in order to determine the dispersion model that best describes the data collected by the level transducer circuit.

B. Data Collection Technique and Instrument
In this research, the technique used for data collection was observation, which was put into practice once the level transducer circuit was implemented and was used on the tank of the firefighting system. Likewise, the data collection technique used was the technical report, the same one that was validated in relation to the data collected through Cronbach's Alpha, and whose value turned out to be equal to 0.7349, evidencing a degree of reliability from moderate to optimal.

A. Description and Development of the Circuit
The control process responds to the use of a level transducer circuit implemented by means of an ultrasonic sensor and controlled with Arduino Nano to maintain the filling level of a tank of a firefighting system within the optimal parameters established for correct operation, as well as the sensors and actuators of the tank's water filling system, it is carried out through a Siemens 1212C programmable logic controller, which requires a conditioning circuit that represents the interface between the Arduino Nano controller and the logic controller programmable. In Fig. 1, the block diagram of the entire system is shown, in order to highlight the integration of the elements and the importance of the signal conditioning, to achieve optimal communication between the two controllers.
The level transducer is made up of an ultrasonic sensor plus an Arduino Nano controller, in which the controller has a PWM (pulse width modulation) output signal with a range of 0 to 5 volts, then we will amplify it with a TL081CP integrated circuit, so that the PWM signal converts it from 0 to 10 volts, Fig. 2 shows the connection architecture, highlighting the integration and synergy of the ultrasonic sensor and the Arduino Nano controller.  Once the connection architecture was defined, the Arduino Nano controller programming relationship was carried out, for which three real type variables (float) are declared, the same one that is linked to the input addresses of the Arduino Nano, these are: trigger (terminal 6), echo (terminal 7) and analog (terminal 10), these variables declared with floating point will be used to carry out the respective calculations in the programming, whose indicators to obtain will be time and distance. The setup function is used to declare the variables to know who will be the inputs and outputs on the Arduino Nano, likewise, the loop function is linked to the trigger variable, it is written in two states at a low level for two 2 seconds, then it is written at a high level for 10 seconds, the response time of the sensor is a function of the variable "echo" (when it is at high level) since it is part of the mathematical operation, thus also the variable "distance" of the sensor is the product of the variable "timeult" (which is the response of the variable echo at high level), between the two constants 2 and 29.15, (this constant is by default). It is important to bear in mind that the value of the variable "outputilt" is obtained from the product of the variable "distance" by the constant, whose value is 7.5 (it is specified that how the value of the constant 7.5 is obtained, in the next paragraph).
As the purpose is to obtain an analog signal, it has to be converted to a PWM signal, the equivalent of 0 to 5 volts, but the Arduino Nano works with digitization's from 0 to 255 bits, since the test was carried out with a tank that has a distance of 32 cm, the following calculations are made. The analysis begins considering that 2 times the calibration constant of the distance variable (x) is equal to a digitization of 0 (zero), this due to a possible false alarm that the Arduino Nano controller may generate, thus, 32 is also considered by the calibration constant of the distance variable (x), this because it represents the register that the ultrasonic sensor provided to the tank with a digitization of 255 bits. From the conditions x is obtained, the same that is required, it will help to establish the calibration of the sensor with respect to the distance variable. Adding the two considerations, we have that "34x" is equal to 255, there it is obtained that the value of the calibration constant is 7.5. Adding the two equations, it is determined that the calibration constant of the variable distance (x) is equal to 7.5.
This constant is used to program the Arduino Nano controller. Thus, in Fig. 3, the programming code is shown, in which "analogwrite" is required depending on the operation obtained in the "outputult" variable, in this way we will obtain PWM from 0 to 5 volts.
Another aspect to consider is the amplification stage of the Arduino PWM output from 0 to 5 Volts and from 0 to 10 volts. To achieve such electronic conditioning, the PWM signal from the Arduino Nano was passed through the 4.7 KΩ resistor (R5) and through the 10 uF ceramic capacitor (C1), the sending time of the PWM signal was reduced, this conditioned signal then passes through the 1KΩ resistor (R2) and then connects to terminal 3 of the amplifier. Thus also in terminal 2 of the amplifier the 1KΩ resistor (R3) and the 1KΩ resistor (R4) are placed, in order to achieve a balance of the impedances. Terminals 4 and 7 with 12 volts power the amplifier, and terminals 1 and 5 for the intended purpose will not be used. Terminal 6 is the amplified PWM output of the Arduino Nano, which is now 0-10 volts, in Fig. 4, the connection architecture of the TL081 operational amplifier is shown.

B. Description of PLC Programming
To control the system, the system-M0.0 mark is created, which will be enabled by the start-I0.0 button, while the stop-I0.1 button is used to turn off the entire system (Fig. 5). Once the M0.0 mark is turned on, the level sensor programming is activated, for this a normalization is carried out with a digitization of 0-27648 of the Level sensor-IW0 (integer variable) so that a real variable is output with the name of level sensor norm-MD2, this real variable is scaled with a range of 0-35Liters to give us another real variable but already scaled (Level Sensor Output -MD6), as shown in Fig. 6.    Once the M0.0 mark is lit, the pressure sensor programming is activated. A normalization is carried out with a digitization of 0-27648 of the Pressure sensor-IW2 (integer variable) so that a real variable with the name of Pressure sensor norm-MD10 is output, this real variable is scaled with a range of 0-2 Bar which its value of the real variable but already scaled (Pressure Sensor Output -MD14) (Fig. 7).
Once the M0.0 mark is lit, the flow sensor programming is activated. A normalization is carried out with a digitization of 0-27648 of the Flow sensor-IW4 (integer variable) so that a real variable with the name of Flow Sensor Norm-MD18 is output, this real variable is scaled with a range of 0-4 L / min which its value of the real variable but already scaled (Flow Sensor Output -MD22).
When the system is on, the water pump works at a low speed Q0.0 (low speed output), the pump will stop working when the level sensor (Level Sensor output-MD6) reads less than 27L, at that point it will start other speed. The closed outputs Q0.2, Q0.1 and, Q.0.0 are security variables (that is, they are responsible for not letting work at another speed, other than the programmed one).
In the same way, when the level sensor (Level Sensor output-MD6) reads 26L the pump will work at an average speed Q0.1 (Average Speed output), the pump will stop working when the level sensor (Level Sensor output-MD6) dial less than 16L.
Finally, once the level sensor (Level Sensor output-MD6) reads 15L the pump will work at a high speed Q0.2 (Average Speed output), the pump will stop working when the level sensor (Level Sensor output-MD6) mark less than 2L (when it is at 1L), and in this way the process will be completed. In Fig. 8 the programming of the described is shown.

C. Description of Programming in HMI
When the button I0.2 is pressed, the water pump starts with a low speed of 30 RPM, the level sensor shows a value of 30 liters, the pressure sensor will be at 0.7 Bar and the flow sensor will be at 2.5 L / min., the other speeds will be off. This speed will stop working when the level sensor comparator is less than 27L, which is where the average speed will begin. In Fig. 9 the HMI programming -Low speed is shown.
When the level sensor shows 26L, the water pump starts with an average speed of 45 RPM, the level sensor shows a value of 26 liters, pressure sensor 1 bar and flow rate 3.2 L / min. This speed will stop working when the level sensor comparator is less than 16 L, which will start the low speed. The described is visualized in Fig. 10. Finally, when the level sensor reads 15L, the water pump turns on with a high speed of 45 RPM, the pressure sensor will read 1.2 bar and the flow rate 3.6 L / min. This speed will stop working when the level sensor comparator is less than 2 L, thereby causing the system to turn off. www.ijacsa.thesai.org

A. Results
Likewise, the filling level of the tank of the firefighting system was measured with respect to the voltage provided by the transducer output. Using the curvilinear estimation analysis through the SPSS software, the determination factor R2 for a linear behavior was found to be 0.997, which shows that there is a level of linear scaling of the designed transducer; thus evidencing its optimal performance. It is necessary to indicate that the linear regression model was used because it is the one that provides us with a greater determining factor or R2. In Fig. 11, the data dispersion model is shown, highlighting that it responds to a linear behavior.
In Table I, a detail of the estimate that defines the behavior of the output data of the transducer is shown, with respect to the input voltages, the value of R2 and the constants that show the relationship between voltage and distance are observed.

B. Discussion
According to the findings obtained, it was possible to develop the level transducer, from the use of an Arduino controller and an ultrasonic sensor, guaranteeing the linearity of the results obtained, that is, the response of the sensor whose input signal is the filling level of water from the tank of the firefighting system, allows the conversion or transformation of the physical magnitude into an electrical signal in the range of 0 to 10 volts. In this regard, in [18], [8] and [15], they point out that the integration of the ultrasonic sensor, linked to an Arduino controller, turned out to work correctly in remote decision systems, although they emphasize that although they are susceptible to noise, these were not evidenced at the time of their operation. From my point of view, this scenario manifests itself due to the conditions and processes to which the ultrasonic sensor and the Arduino controller are being subjected, since it can change in other contexts.  Thus, in the analysis of the results, an almost linear behavior is obtained between the variables under analysis (tank filling level and transducer response voltage), in this regard, in [19], [28], [33] and [34] they point out that it is optimal to apply devices such as the Arduino controller to a filling level control system, because they show a linear behavior in their processed data. They do not specify the determining factor of the curvilinear estimate, however they do require that its implementation and assembly were optimal, and these appraisals coincide with the findings obtained in my research, since my determination factor turned out to be 0.997, for a curvilinear estimate. www.ijacsa.thesai.org As indicated in [35] the implementation of the pump alternators system was carried out without major inconvenience when performing the unification of a PLC and Arduino. Both solutions controlled the discrete event system according to the operating requirements set by GRAFCET. The main reasons for using Arduino in automation projects lie in the capabilities of the hardware and its costs. High-end Arduino are known to have superior processing capabilities than many nano PLCs, while PLCs have a high number of inputs and outputs sufficient to automate processes, as well as supporting a large number of open communication protocols.

V. CONCLUSION
As part of the conclusions to be specified, in relation to the findings obtained, the following is specified: It is concluded that the proposed integration between the ultrasonic sensor, the Arduino Nano controller and the Siemens 1212C programmable logic controller was viable, this thanks to the conditioning of the PWM modulated signals from 0 to 5 volts to 0 to 10 volts through the TL081 operational amplifier, thus achieving a synergy between all these devices, and achieving the purpose that is the capture of data on the tank filling level through the transducer designed and described in this article.
Finally, it is concluded that the process of converting the physical magnitude to the electrical signal was not affected by noise or external disturbances in the context of the process (tank used for firefighting systems), since when subjected to operations in the same process of detection and fire showed a linear behavior, that is to say, almost devoid of noise effects. This allows it to be concluded that its application to this type of process is useful.
Regarding future plans, remote monitoring, supervision and control strategies should be considered; as well as mechanisms for the detection of fire to be reported to a reception equipment in the 4G or 5G band, through a GPRS communication interface module.