2019 Xpotron Paper 1
2019 Xpotron Paper 1
With the data in Table III, we have proceeded to design 4 if (Error is EC) then (pwm is VC)
the membership functions for the exit of the system (see 5 if (Error is EPD) then (pwm is VPI)
Fig.3) 6 if (Error is ED) then (pwm is VMI)
In the same way as for obtaining position data, the 7 if (Error is EGD) then (pwm is VGI)
membership functions have to be crossed so that there is a
umbral where the diffuse logic can discern and make a d) Code for the microcontroller: a Genuine Arduino
decision. MEGA 2560 has been used as a microcontroller, for the
following reasons:
Simple and clear programming environment.
Multi platform.
Open source and extensible software and hardware.
And as a method to find the clear value has been used the
evaluation by maximum center which is a simplified method
of the center of gravity method.
Fig. 6. Funciones de membresia de la velocidad con sus respectivos pesos.
C1= -
VGI (Velocidad Grande Iz) -255 -130
227.5
VMI (Velocidad Media Iz) -200 C2= -130 -70
Fig. 7. maximum center method
VPI (Velocidad Pequeña Iz) -130 C3= -70 0
(0.75 ∗ −130) + (0.25 ∗ −230)
VC (Velocidad Centro) -70 C4= 0 70 𝑂𝑢𝑡𝑝𝑢𝑡 = = −155 (2)
(0.75 + 0.25)
VPD (Velocidad Pequeña De) 0 C5= 70 130
VMD (Velocidad Media Der) 70 C6= 130 200 In order to be able to program and be as loyal as the fuzzy
logic in Matlab is, triangular functions have been thought of
C7=
VGD (Velocidad Grande De) 130
227.5
255 as two lines with positive and negative slopes limited in one
working range and trapezoidal functions as three lines; one
with positive slopes and the other negative slopes and the
c) De-diffusion rules: It is responsible for the scale
third as a constant function in Y, in this way you can break
mapping that converts the range of values of the variables to
down the membership functions, both for position and speed,
their corresponding universe. It is the tool to obtain the clear
as first level equations and in this way you can enter in the
control action from a diffuse control action.
program of the Arduino MEGA 2560 Genuine.
In this section all the essential information is deposited so We rely on the equation of the line:
that the fuzzy logic acts, the expert puts his knowledge of how
the logic must act IF an event happens, THEN he must solve 𝑦2 − 𝑦1
(𝑦 − 𝑦1) = [ ] (𝑥 − 𝑥1) (3)
it. The structure of a fuzzy rule is as follows: 𝑥2 − 𝑥1
𝑦2 − 𝑦1
𝑚=[ ] (4)
𝑥2 − 𝑥1
To find the clear value, it has been posed in the following way for the
microcontroller:
The equation that will be used for any line will be the
following: void desfusificacion(float A,float B, float C,float D,float E,float F){
Y= (A*error -B +C); //valor de pertencia del error en cada-
𝒚 = 𝒎𝒙 − 𝒎 ∗ 𝒙𝟏 + 𝒚𝟏 (𝟓) Y1= (D*error -E +F); //discurso difuso.
pwm= ((Y*r +Y1*r1)/(Y+Y1)); //valor nitido
actuador(pwm); }
It will proceed to transform a trapezoidal function in its
mathematical elements.
Fig. 10. Extract of the Original code (sharp value).
IV. RESULTS
After making tests of the fuzzy logic applied in
the controller and comparing them with the
results that MatLab assumed, it was concluded
that the values obtained in the microcontroller
were close to the theoretical with an acceptance
of 98%
y = 0 ∗ x − 0 ∗ (−360) + 1 (6)
REFERENCES
y=1 (𝟕)
[1] Alarcón, G. A. y Lajo, D. A. F, “Diseño de un Controlador PID con
The first-order equation that defines it is Y = 1. Interfaz Gráfica de Control para un Sistema de Equilibrio Bi-hélice,”
11Th Latin American and Caribbean Conference for Engineering and
Technology. Cancun, Mexico.
For the line with negative slope you have:
[2] Arduino, “¿Que es Arduino?,” Febrero 2019. [online]. Available:
0−1 http://arduino.cl/que-es-arduino
𝑚=[ ] = −0.00833 (8)
−70 + 190
𝒀 = −0.0083333 ∗ 𝑿 + 0.58333 + 𝟎 (𝟗) [3] Trelectronic, “codificadores rotatorio,” 2017. [online]. Available:
http://www.trelectronic.com/products/rotary-encoders.html
The first-order equation that defines it is y = 0.0083 * x [4] Gonzáles Morcillo, c, “Logica difusa. Una traduccion paractica.
+0.8533. Tecnica de sofcomputing,” 2017. [online]. Available:
http://www.esi.uclm.es/www/cglez/downloads/docencia/2011_Sofco
mputing/LogicaDifusa.pdf
So:
[5] Salamanca, J,A. “Implementacion de un sistema posicional con
𝑌 = 1 ; −360 ≤ 𝑥 ≤ −190 motores paso a paso y servo controlados por computadora” thesis.
{ (10) Pontificia Universidad Javeriana, bogota DC, 2009.
𝑌 = −0.00833𝑋 + 0.58333 + 0 ; −190 ≤ 𝑥 ≤ −70
[6] Ponce, P “Inteligencia artificial con aplicaciones a la ingenieria”
Taking all this information to the microcontroller would be Alfaomega 2010.
as follows: