0% found this document useful (0 votes)
36 views

2019 Xpotron Paper 1

This document describes the design and implementation of a fuzzy logic controller for a robot with one degree of freedom. It discusses the historical development of fuzzy logic by Lotfi Zadeh as an alternative to classical sets. The project uses a DC motor adapted to a gearbox to power the robot. A fuzzy controller is designed using triangular and trapezoidal membership functions to interpret position input data from an encoder. The controller aims to precisely control the robot's position using fuzzy logic instead of a traditional PID controller.

Uploaded by

AV NetworK
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

2019 Xpotron Paper 1

This document describes the design and implementation of a fuzzy logic controller for a robot with one degree of freedom. It discusses the historical development of fuzzy logic by Lotfi Zadeh as an alternative to classical sets. The project uses a DC motor adapted to a gearbox to power the robot. A fuzzy controller is designed using triangular and trapezoidal membership functions to interpret position input data from an encoder. The controller aims to precisely control the robot's position using fuzzy logic instead of a traditional PID controller.

Uploaded by

AV NetworK
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Control of position and speed, using fuzzy logic for

a robot of one degree of freedom.


Ing. Fernando Madrid Guevara MSc. Bach. Alejandro Orestes Aponte Vivas.
dept. Ingenieria Mecatronica dept. Ingenieria Mecatronica
Universidad Nacional de Piura Universidad Nacional de Piura.
Piura, Perú Piura, Perú
[email protected] [email protected]

Abstract—A new form of accurate measurement is presented


using a fuzzy controller, which works in a similar way as a PID II. HISTORICAL DEVELOPMENT
control. The difference you have with a conventional diffuse Lotfi Zadeh, a mathematician, electrical engineer and
controller is the flexibility with which you can modify your Iranian-American professor at the University of California at
setpoint without making any further modifications without
affecting the controller's precision, and this Project is able to
Berkley, was dissatisfied with the classic ensembles (Crisp
adapt to the operation of any actuator (DC motor) with different Sets) since they could only allow two options, belonging to
characteristics to the one mentioned in this research paper. The and not belonging to such ensembles, This limitation when it
project covers a variety of theoretical and mathematical comes to mathematically modeling complex systems,he
concepts in which all the work will be supported, these in turn devised the concept of fuzzy logic, presenting it as the way of
will be put into practice by taking them to a microcontroller for processing information that, in addition to the two options
later application with a robot of one degree of freedom mentioned above, also allowed partial belongings to these
sets.
Keywords—Fuzzy, Controller, Matlab, Arduino, Robotic.

I. INTRODUCTION In 1980 the Danish engineers Peter Holmbland and Jens-


Jurgen Ostergaard developed the first commercial diffuse
The automatic controller is the maintenance of a desired control system, applying this technique in the control of a
value within a quantity or condition, measuring the existing rotary kiln of a cement factory.
value by comparing it with the setpoint and then proceed to
make the appropriate adjustments and thus reduce the error. Diffuse logic is a branch of artificial intelligence that
The drawback of a classical control PI, PD, PID is that it
allows a computer to analyze inaccurate or vague information
requires finding a transfer function for the system to control as would normally be done in the real world, that is, this
and this requires knowing the physics and mathematics of artificial intelligence can handle common linguistic concepts
each actuator, sensor or elements that directly affect; there is among humans and translates it into a mathematical language
also the risk that if the system to be controlled is modified, a Formal, this means that we can control a system by means of
new classical control has to be made for the new linguistic orders.
specifications. That is why research has been done reaching
new proposals, one of them is fuzzy control, this was already III. PROJECT DEVELOPMENT
known since 1974 when the British Ebraim Mandani designs
a fuzzy control for the regulation of a steam engine, this being A. Robot relevant information.
the first successful application where it was used; but with the For the implementation of fuzzy control, a prototype of a
arrival of computers within everyone's reach, its use is Robot of one degree of freedom has been used, which has in
gaining strength and it is diversified by taking out new its design a DC motor with an incremental encoder of 100
applications making it more robust. points, with a direct voltage of 24 volts, and a speed of 2700
RPM. This engine has been adapted to a gearbox of a trico
Diffuse control is gradually being implemented in these engine, with this modification it is possible to reduce the
times in industrial robots, although they still fail to replace speed from 2700 RPM to 47 RPM in order to be able to work
the other controllers completely, it is gaining a place in this with more acceptable speeds and at the same time to gain
area, because it is easy to program and implement at a lower torque
cost cheap and with good results and most importantly no
previous study is needed to find the equations of the transfer
functions but only the inputs and outputs (I / O) and the
knowledge of an expert (knowledge bases) are important for
to begin to devise efficient control.

The project that is presented, seeks in some way to take a


step forward so that fuzzy control is a standard in modern
robotics. Fig. 1. Motor conditioning to the gearbox.
The driver used for the motor is an electronic bridge with YX (1)
Mosfet that uses the same principle of the H bridge, its
operation is like that of a set of switches placed between the where:
source and a motor, this is done in order to invert the current Y= Encoder position
flow to obtain both directions of rotation.
X= End effector position

From Fig. 3 it is necessary to take the values of the input


to a universe of discourse, for this we use observation and
manual manipulation of the robot to create the universe of
discourse.

It has been chosen for the input of the fuzzy controller,


triangular functions for the reason that this function
represents what is sought, to have only one point where the
membership function takes its maximum value; for the
Fig. 2. Driver circuit for the motor. extremes, trapezoidal functions have been taken for design
reasons and to avoid overflows causing the controller to stop
working properly
B. Fuzzy controller design.
Data: for desing reasons 0° was taken as a setpoint; will
be modified later when the code is made to take it to a
microcontroller (Arduino MEGA 2560)

Fig. 3. Diagram of the fuzzy controller.

a) Obtaining position data: After a rigorous procedure


for the system to be controlled, in this case the robot with one Fig. 5. Membership functions of the position with their respective weights.
degree of freedom and knowing from the beginning what is
to be controlled (position), the data of the encoder have been Membership functions intersect so there is a threshold
extracted, obtaining the following data: where diffuse logic can discern if it is more than one function
or is more the weight of the other function and so can decide.
TABLE I. RELEVANT DATA-POSITION VS ENCODER
TABLE II. SUMMARY OF FIG.5
Table

End effector position (°) Encoder position Name of the start (°) Center (°) final (°)
membership
1 0° 0 function.
2 180 7200
EGI (Error Grande -360 -227.5 -70
3 360° 14400 Iz)
EI (Error Izquierda) -190 -70 -35
EPI (Error Pequeño -70 -35 0
Data acquisition has been done through a genuine Iz.)
Arduino mega 2560 board. EC (Error Centro) -35 0 35
EPD (Error Peque 0 35 70
With this information Fig. I you can make a graph with Der.)
which denotes that the function is linear. ED (Error Derecha) 35 130 190
EGD (Error grande 70 227.5 360
Der.)
20000
Encoder position

10000 b) Obtaining velocity data: The observation method


was used to find the velocities using a small arduino code that
0
made possible the readings of the motor's encoder. By
0 100 200 300 400
common sense and by perception, the following limits for
End effector position speeds have been established linguistically.

Fig. 4. Graph, end effector position vs. encoder position.

Using the equation of the line we come to the following:


TABLE III. DIFFUSED SPEED PARAMETERS
Table II and Table IV have proceeded to create the
Table. Parameters speed
decypusification rules:
Linguistic variable Speed (PWM)
TABLE V. RULES OF DIFFUSIFICATION.
Maximun speed Between 130PWM to 255 PWM
Average speed Between 70 PWM to 200 PWM N° Rules of diffusification
Minimum speed Between 0 PWM to 130 PWM 1 if (Error is EGI) then (pwm is VGD)
Repose 0 PWM 2 if (Error is EI) then (pwm is VMD)
3 if (Error is EPI) then (pwm is VPD)

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.

TABLE IV. SUMAARY OF FIG. 6


Table. Speech universe of speed

Name of the membership Minimum Maximun Maximum


function. Value center value

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

IF premise (antecedent), THEN conclusion (consequent) Equation of the slope is as fllows:

𝑦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%

 The diffuse control for the robot of one degree of


Fig. 8. Function EGI.
freedom was achieved after some extra
Table II shows the data and proceeds to calculate the aggregates, since the mechanical part of the robot
horizontal line: was a bit defective, we proceeded to add a torque
gain stage to the code (it does not affect anything
1−1 to the expected results of fuzzy control).
m=[ ]=0 (5)
−190 + 360

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:

if(error >=-360 && error <-190){


U=0 , N=0 , P=1; //egi Error Grande
Izquierda
K=0, I=0, S=0;
r=c7 , r1=0;
desfusificacion(U,N,P,K,I,S); }

if(error >=-190 && error <-70) {


U=-0.008333, N=0.58333 , P=0; //egi Error Grande
Izquierda
K=0.00833, I=-1.58333, S=0; //ei Error Izquierda
r=c7 , r1=c6;
desfusificacion(U,N,P,K,I,S); }

Fig. 9. Extract of the Original code

You might also like