SciELO - Scientific Electronic Library Online

 
 número35Secado y estimación de coeficientes efectivos de difusión de recubrimientos con contenido reducido de azúcarEstimación del costo hospitalario de las úlceras crónicas de miembros inferiores en Tucumán, Argentina índice de autoresíndice de assuntospesquisa de artigos
Home Pagelista alfabética de periódicos  

Serviços Personalizados

Journal

Artigo

Indicadores

  • Não possue artigos citadosCitado por SciELO

Links relacionados

  • Não possue artigos similaresSimilares em SciELO

Compartilhar


Revista de Ciencia y Tecnología

versão On-line ISSN 1851-7587

Rev. cienc. tecnol.  no.35 Posadas jun. 2021

 

Artículos

Fuzzy logic modelling for the RC series circuit with low cost hardware and software

Modelado con lógica difusa del circuito RC en serie con hardware y software de bajo costo

Edgar Serrano Pérez1 

1 Universidad Tecnológica de México - UNITEC MÉXICO - Campus Atizapán. E-mail: edgar_serrano@my.unitec.edu.mx

Abstract

This work presents the development of modeling for the response to a 5 Volt step of a RC series circuit. The system identification method is presented using an Arduino Nano based board as the data acquisition system. From the experimental data obtained, the input and output membership functions are defined. The implementation was carried out through the Fuzzy Logic Toolbox in Scilab. A set of 11 rules relate inputs to outputs in a Mamdani type inference system. The work includes the combination of low-cost hardware elements with open source software for the didactic integration that allows introducing fundamental concepts of fuzzy logic in a practical physical application approach. The results of the fuzzy logic model are compared with the experimental, numerical and the classical analytical formulation for the RC series circuit.

Keywords: Fuzzy Logic; Arduino; Modelling; Low cost; Hardware

Resumen

En este trabajo se presenta el desarrollo del modelado de la respuesta a un escalón de 5 Volts de un circuito RC conectado en serie. Se presenta el método de identificación del sistema utilizando una tarjeta basada en Arduino Nano como sistema de adquisición de datos. A partir de los datos experimentales obtenidos, se definieron las funciones de membresía de la entrada y salida del sistema difuso, cuya implementación se realizó a través de la caja de herramientas de lógica difusa en Scilab. Un conjunto de 11 reglas permitió relacionar las entradas con las salidas en un sistema de inferencia de tipo Mamdani. El trabajo engloba la combinación de elementos de hardware de bajo costo con programas de uso libre para la integración didáctica que permite introducir conceptos fundamentales de la lógica difusa en un enfoque de aplicación física práctica. Los resultados del modelado difuso se comparan tanto con los resultados obtenidos experimentales, como los resultados numéricos que se obtienen utilizando la formulación analítica clásica para el sistema de circuito RC conectado en serie.

Palabras Claves: Lógica difusa; Arduino; Modelado; Lowcost; Hardware

Introduction

Today, we are immersed in an increasingly digitized society, numerous applications and technological devices have emerged from applications of artificial intelligence. The development of electronics and household appliances that use fuzzy logic as a decision-making method has increased steadily. Numerous technological advances have been benefited from the development of systems based on fuzzy logic [1]-[3] The learning of various branches of artificial intelligence such as fuzzy logic and neural networks, are generally taught in optional specialization courses in careers related to mechatronics. Theorical sessions and laboratory experiments provide a hands-on approach to developing manual skills and abilities. Through laboratory experiments it is possible to verify theoretical results, make comparisons and contrast them, furthermore where is appropriate, make some adjustments to the models based on the experimental results.

Related work

The exploration of the RC circuit has been used to address fundamental concepts of physics related to electric current, resistance and capacitance with various approaches [4]. In this work it has been proposed to model the response of a resistor-capacitor series circuit, when a unit step input of 5 volts of direct current is connected. The use of fuzzy logic is encouraged for this purpose, implemented through low-cost hardware and open software elements such as Arduino [5] and Scilab for system identification. In the current moments of contingency there is a growing need to transfer educational and academic environments to the home, where engineering students take virtual sessions. It is of great importance the development of laboratory practices in the engineering area [6], they can be carried out using available and low-cost hardware elements, as well as the use of free software that facilitates the processing and interpretation of data.

This engineering experiment could be adapted for students to introduce and gain an understanding of the fuzzy logic modeling process, through a real-life experiment using open hardware instrumentation and open source software. This situation could reduce the inconveniences observed during the transfer of face-to-face engineering education into educational centers, to home confined spaces of virtual distance education.

System identification using the Arduino platform

The modeling of response to a 5 volt step input of a circuit formed by a resistor (100 kΩ) and a capacitor (100 µF) using fuzzy logic start with the experimental identification of the system. The objective is to know the behavior and evolution of the voltage at capacitor terminal as a variable output in time. An Arduino Nano based board has been used for the experiment. The microcontroller board has low cost and it is possible to acquire it with some ease in establishments dedicated to the commercialization of electronic components. Through analog pin A0 it is possible to measure the analog voltage of the capacitor over time. The connection diagram for the physical implementation can be observed in Figure 1.

Fig. 1: Electronic diagram for RC series circuit data acquisition. 

At the beginning of the test, it must be ensured that the capacitor is completely discharged. To ensure that it starts from 0 volts. The capacitor terminals can be connected to the same resistance for a period of 2 minutes without the power source, in order to ensure the initial conditions of the experiment. The data transfer between the Arduino Nano based board and a personal computer is carried out between the Serial monitor enabled by the program, as shown in Figure 2.

Fig. 2: Arduino language program for data acquisition. 

The implementation of the program in Arduino language, performs a data sampling for the analog signal using a time delay 1000 ms, that is, an analog voltage reading is made about one second. Considering that the circuit consists of a 100 kΩ resistor and a 100 µF capacitor, it is observed that the constant of the system is reached around 10 seconds, that is, 63% of the expected final value. The circuit presented is simple, the values of the resistance and the capacitor can be modified and adapted for other educational purposes, where it is necessary to increase or decrease the establishment time of the transient response of the circuit.

The use of the board based on Arduino nano has allowed to obtain experimental results that allow to create a model based on fuzzy logic. The main purpose is estimating the response of the circuit over time, using linguistic variables in an approximate decision-making system. The analog voltage between the capacitor terminals is read by the analogRead function through the A0 physical pin of the board with microcontroller. The analog reading and digital conversion, allows to obtain voltages values between 0 and 5 volts. It is noted that the microcontroller board have an analog-to-digital converter with 10 bit resolution. The experimental results obtained from the reading of analog voltages over time, corresponding to the evolution of the voltage across the capacitor terminals over time, are shown in Table 1. The data were obtained directly from the interface of the serial monitor with the that found in the Arduino program.

Table 1: Experimental data acquisition using the Arduino Nano based board for the RC series circuit. 

The data obtained experimentally represent the evolution in time of the capacitor charge, from when the capacitor is totally discharged, until reaching values close to the total charge, that is, 5 volts.

IV. Fuzzy Logic modelling through Scilab

The 11 data points obtained from the identification of the system, were used to create a Mamdani-type fuzzy logic system in Scilab [7], through the fuzzy logic toolbox. The system consists of a single "Time" input and a single "Voltage" output. The input variable consists of 11 triangular membership functions distributed in the interval that represents the range from -0.1 to 55 seconds as shown in Figure 3. This range is known as the universe of the discourse of the variable.

Fig. 3: Membership distribution for the Input variable “Time”. 

The highest point of each of the triangles represents the highest degree of membership of each function, that is, the core and corresponds to each of the points obtained in the identification of the experimental system through the use of the Arduino Nano board, used as a low cost data acquisition system [8]. The 3 parameters of each proposed triangular functions are: the lower limit, core and upper limit, they can be consulted in Table 2.

Table 2: Triangular membership parameters for the input variable “Time”. 

For the case of the output variable, 11 triangular membership functions are proposed, which were distributed throughout the universe of the variable's discourse, from -0.1 to 5.01 volts, as can be seen in Figure 4. For the case of selecting the upper limit of each membership function, it was proposed that it must coincide with the core value of the following membership function.

Fig. 4: Membership distribution for the Otuput variable “Voltage”. 

The Figure 2 and Figure 4 were created using Open Office Calc for graphical presentation of the data. It is observed that each core of the outgoing membership functions correspond to the point values obtained experimentally from the identification of the system. The distribution of the lower and upper limits of each of the membership functions, for the output variable was made in such a way that the lower limit of the membership function coincides with the core of the membership function. The individual parameters of each of the membership functions, which correspond to the lower, core and upper limits, can be seen in Table 3.

Table 3: Triangular membership parameters for the output variable “Voltage”. 

It is noted that there is a bigger number of membership functions located in the right half of the universe of discourse of the output variable, this situation corresponds to that experimentally, the data obtained for the last time interval are also closer between them, at the end of the time interval. This situation refers to the exponential behavior that first order systems present when a unit step input is applied. Once the input and output variables of the fuzzy system have been defined, a rule base is required for relating each of the inputs with each of the outputs. In this sense, the rule base allows taking a specific action according to a specific input. For this work, 11 rules have been proposed that assign each of the inputs to each of the outputs as can be seen in the Table 4.

Table 4: Fuzzy Logic rule set for the Mamdani Inference system. 

With the definition of the membership functions of both the input variable and the output variable, the set of rules that relate each of the inputs to each of the outputs, we proceed to construct the fuzzy system using the Mamdani type Scilab Toolbox. The implication method selected was the Minimum and the aggregation method was the maximum. The defuzzification method was the centroid, which allows obtaining a numerical value as the output of the system.

Results and Discusion

When implementing the fuzzy system in Scilab and using the surface view function of the fuzzy logic toolbox, the output response of the system is computed, that is, the relationships that exist between the input and the output of the system. The fuzzy logic modeling, generated from the experimental identification of the system with the microcontroller board, shows that the results obtained with the fuzzy system implemented in Scilab are approximate; the analytical solution is close to the experimental data obtained by mean of the microcontroller board, and also close to the values obtained with the fuzzy logic approach proposed, as shown in Figure 5.

Fig. 5: Comparison of the data obtained using the fuzzy model, experimental data and analytic data. 

It is worth highlighting the approximation obtained to model physical systems implementing a fuzzy logic system. Different parameters can be modified to obtain a closer tuning in the modeling, such as membership functions definitions for both, the input and output. The implication and aggregation methods can be used, as well as different defuzzification methods. These characteristics make fuzzy logic a very versatile modeling tool that can be adapted for the analysis of more complex systems with multiple inputs and / or multiple outputs.

Conclusions

The implementation of a Mamdani type fuzzy system has been described, to model the response in time to a unit step of 5 volts in a system composed of a resistor and a capacitor connected in series. Low cost and easily acquired hardware elements are used, as well as free software for its implementation through the Scilab tool. This combination favors the implementation of this type of systems for the analysis of the behavior of physical systems and their evolution in time before different physical conditions. It is intended to promote the understanding of fundamental concepts of fuzzy logic with a practical approach that combines the manipulation of hardware elements as well as free software. The work presented could be adapted as an educational tool that allows engineering students and practitioners to develop skills and abilities for the construction of data acquisition systems. This process is fundamental for the identification of systems and the consequent development of control systems in engineering. An emphasis is placed on the use of accessible and low cost devices and software. This situation can be adapted to circumstances where distance education is transferred to individual virtual environments such as the current situation experienced by virus pandemic.

References

1 M. J. Marinelli, M. B. Otegui, P. D. Zapata, y N. H. Acosta, «Control Difuso de unaCámara de Germinación para Hidroponía», Rev. Cienc. Tecnol., p. 6, 2015. [ Links ]

2J. jose Salazar, «Diseño y Análisis de desempeño de un inversor de voltajeutilizandocontroladoresinteligentes», MASKAY, vol. 3, n.o 1, Art. n.o 1, nov.2013, doi: 10.24133/maskay.v3i1.127. [ Links ]

3A. Díaz, C. Castillo, F. Sáenz, y C. G. Romero, «Sistema embebido de un audífonointeligente para personas con discapacidadauditiva a través de sensoresneurológicos», MASKAY, vol. 5, n.o 1, Art. n.o 1, dic. 2015, doi: 10.24133/maskay.v5i1.124. [ Links ]

4 C. Galeriu, C. Letson, y G. Esper, «An Arduino Investigation of the RC Circuit», Phys. Teach., vol. 53, n.o 5, pp. 285-288, abr. 2015, doi: 10.1119/1.4917435. [ Links ]

5 «Diseño de unprototipo para control de acceso con arduinovíabluetooth | Revista de Ciencia y Tecnología», Accedido: nov. 05, 2020. [Enlínea]. Disponibleen: https://www.fceqyn.unam.edu.ar/recyt/index.php/recyt/article/view/208. [ Links ]

6 D. Ibrahim y T. Alshanableh, «An undergraduate fuzzy logic control lab using a line following robot», Comput. Appl. Eng. Educ., vol. 19, n.o 4, pp. 639-646, 2011, doi: 10.1002/cae.20347. [ Links ]

7 R. C. H. Lara, «Herramientas de Software Libre para AplicacionesenCiencias e Ingeniería», Rev. Politécnica, vol. 32, jul.2013, Accedido: oct. 27, 2020. [Enlínea]. Disponibleen: https://revistapolitecnica.epn.edu.ec/ojs2/index.php/revista_politecnica2/article/view/30. [ Links ]

8 M. Azúa-Barrónet al., «Low cost data acquisition system with the arduino platform», Rev. Mex. Cienc. Agríc., vol. 8, n.o 1, pp. 1-12, feb.2017, doi: 10.29312/remexca.v8i1.67. [ Links ]

Received: November 06, 2020; Accepted: April 19, 2021

Creative Commons License This is an open-access article distributed under the terms of the Creative Commons Attribution License