Robot Humanoide JEIS
Members:
Jose Illescas, Oscar Mora
jillescass1@est.ups.edu.ec, omora@est.ups.edu.ec
General
Perspective:
JEIS is a robotic prototype which will be
used in the HICP "Institute of Cerebral Palsy of the Azuay". This
prototype is based on a construction of humanoid type with the intention to
assist in the tasks of teaching of teachers and therapists of the institution
before named.
The prototype account with robotic joints
which allow you to perform movientes of laterality similar to those performed
by a person.
In the same way the robotic prototype will
have two basic functions which are identified as:
Fulfils the role of a teacher where by
means of orders this indicates that the patient movement must perform.
Fulfils the role of student where the
patient interacts with the robot through a mobile application where the patient
chooses a movement represented by images in the mobile application, given the
order the robot performs the move is indicated by the patient in the mobile
application.
Objectives:
- The prototype should be able to
make movements with their limbs either with the arms or legs.
- The prototype must be able to
identify by capturing images using a raspicam which identifies the movement
made by the patient and checks if there is wisdom in the order.
- The prototype must be able to
receive orders through the mobile application and perform them correctly.
- The prototype must be able to
log successes and errors through the process of conducting the therapy.
- The prototype must be able to
perform facial expressions such as the movement of eyebrows and blinked her
eyes.
Proposed Solution:
For the
performance of the various aspects and movements that must be made by the
robotic prototype to implemented the following design of the prototype.
As
noted in the previous image we present the design of the robotic prototype with
servos sg90 in the joints such as shoulders, elbows, knees, etc., which allow
you to perform different movements prototype for the teaching unit.
Schematic diagram:
Mobile app:
The mobile application complies with some
features among the most important thing is that we have the selection of the
student who performs the therapy, students are registered in a database in the
cloud which also has the registration of teachers and courses offered by the
institution
As noted in the previous image presents the
list of students and teachers which are registered in an external server. These
data will be consumed by the mobile application for the realization of the
therapy with the robotic prototype.
As the first point of the mobile
application we have the authentication of the teacher or terapisque performs
the therapy.
With the authentication of the teaching
staff have access to the options page where you can view the tests and courses
available at your expense.
With the option we can visualize the test
reports made by the robotic prototype.
In
the option courses we can observe the courses the teacher has in charge where
by choosing one of the courses that you can view the participants of this and
choose a patient for therapy.
Once you have selected the patient with
which will work in therapy we can access the window for the submission of the
application for the patient.
As noted in the last image in this we can
choose the movement to be performed by JEIS.
Implementation of fuzzy logic in the prototype.
In the process of
programming the prototype has been implemented a system of fuzzy control which
allows you to control the position of a servo motor the same that will balance
the robot.
For the implementation
of the fuzzy system the design of a test circuit which is shown below.
The circuit shown in
the previous image has the functionality to show the operation of the fuzzy
system implemented in the Arduino. As can be seen in the image the circuit
consists of two potentiometers of 10K the same you have different functions.
The first
potentiometer has the functionality to deliver a reference point where it is
considered that the robot is balanced. The second potentiometer has the
functionality to deliver the real value of the motor's position that this case
delivers the actual position of the robot.
The LED lights on the
circuit show the balance in the event of a flashing yellow reflects a slight
slip to the left while the red light shows a slight slip to the right.
The integrated circuit
L293D or H-bridge was installed with the intention to perform operation tests
with a DC motor so that its role is to deliver the direction of rotation of the
engine. In the case of the potentiometers have the pins in the middle or pins
of the same signal connected to the analog inputs of the Arduino A0 and A1.
The pins 51 and 52 are
output pins for the rotation of the motor in case the LOW the pin 51 the
rotation will be counterclockwise, by another case if the pin 52 is LOW and the
rotation will be clockwise.
The other connectors
are only supplies energy to the different devices on the circuit. The following
shows the operation of the circuit:
Video of funcionality of the circuit:
Arduino code of the prototype:
// Librerias necesarias para el funcionamiento del controlador difuzo
#include <FuzzyRule.h>
#include <FuzzyComposition.h>
#include <Fuzzy.h>
#include <FuzzyRuleConsequent.h>
#include <FuzzyOutput.h>#include <FuzzyInput.h>
#include <FuzzyIO.h>#include <FuzzySet.h>
#include <FuzzyRuleAntecedent.h>
// Libreria necesaria para el funcionamiento y control del servo motor
#include <Servo.h>
// Declaracion de la variable para el servo motorServo bD1;
// Invocacion de un objeto de nombre fuzzy perteneciente a la clase
FuzzyFuzzy* fuzzy = new Fuzzy();
// Declaramos que el pin A0 del arduino se llamara referencia pin
// Y que atravez del mismo se recuperar el valor en voltaje entregado por
// el potenciometro de referencia
// Este valor es el senalado por el usuario para la pocicion deseada
int const referenciaPin = A0;
float referenciaValor = 0;
float referenciaValorGrados = 0;
// Declaramos que el pin A1 del arduino se llamara sensor pin
// Y que atravez del mismo se recuperar el valor en voltaje entregado por
// el potenciometro sensor de la pocicion actual del motor
// Este valor es el senalado por el sistema para el equilibrio
int const sensorPin = A1;
float sensorValor = 0;
float sensorValorGrados = 0;
// Declaramos el pin del arduino A2 como salida del sistema
int const salidaControl = A2;
float senalControl = 0;
//DECLARACION DE VARIABLES PARA EL CONTROL DE SENTIDO DE GIRO DEL MOTOR
int IN1 = 51;
int IN2 = 52;
// DECLARACION DE VARIABLES PARA EL "FILTRO"
int sensorLectura[10];
int referenciaLectura[10];
int sensor = 0;
int referencia = 0;
int sensorTotal = 0;
int referenciaTotal = 0;
int sensorPromedio = 0;
int referenciaPromedio = 0;
void setup(){
// Declaramos el pin 4 como senal del servo motor
bD1.attach(4);
// Senalos las variables como salida
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
// Este blucle se encarga del llenado de las 10 muestras entragadas por el potenciometro sensor
for( sensor = 0; sensor < 10; sensor++){
sensorLectura[sensor] = 0;
}
sensor = 0;
// Este blucle se encarga del llenado de las 10 muestras entragadas por el potenciometro referencia
for(referencia = 0; referencia < 10; referencia++){
referenciaLectura[referencia] = 0;
}
referencia = 0;
// Implementacion del controlador difuzo en el arduino
// Variable ENG "Error negativo grande"// Variable ENP "Error negativo pequeno"
// Variable EC "Error cero"// Variable EPP "Error positivo pequeno"
// Variable EPG "Error positivo grande"
// Declaramos un objeto tipo error es la entreda del controlador difuzo
FuzzyInput* error = new FuzzyInput(1);
// Declaramos el primer conjunto difuzo del objeto
// Declaramos una funcion tipo trapesoidal por lo que se ingresa 4 parametros
FuzzySet* ENG = new FuzzySet(-300, -300, -150, -75);
// Adicionamos el conjunto difuzo al objeto error
error -> addFuzzySet(ENG);
// Funcion tipo triangular
FuzzySet* ENP = new FuzzySet(-150, -75, -75, 0);
error -> addFuzzySet(ENP);
FuzzySet* EC = new FuzzySet(-75, 0, 0, 75);
error -> addFuzzySet(EC);
// Funcio Triangular
FuzzySet* EPP = new FuzzySet(0, 75, 75, 150);
error -> addFuzzySet(EPP);
// Funcion Trapesoidal
FuzzySet* EPG = new FuzzySet(75, 150, 300, 300);
error -> addFuzzySet(EPG);
fuzzy -> addFuzzyInput(error);
// Declaracion de un objeto de nombre volatje
// Este objeto es de tipo salida
FuzzyOutput* voltaje = new FuzzyOutput(1);
// Funcion trapesoidal
FuzzySet* VNG = new FuzzySet(-12, -12, -6, -3);
voltaje -> addFuzzySet(VNG);
// Funcion Triangular
FuzzySet* VNP = new FuzzySet(-6, -3, -3, 0);
voltaje -> addFuzzySet(VNP);
// Funcion Triangular
FuzzySet* VC = new FuzzySet(-3, 0, 0, 3);
voltaje -> addFuzzySet(VC);
// Funcion Triangular
FuzzySet* VPP = new FuzzySet(0, 3, 3, 6);
voltaje -> addFuzzySet(VPP);
// Funcion trapesoidal
FuzzySet* VPG = new FuzzySet(3, 6, 12, 12);
voltaje -> addFuzzySet(VPG);
fuzzy -> addFuzzyOutput(voltaje);
// Deficnicion de las reglas de control
// Definimos el primer objeto que pertencese al la clase FuzzyRuleAntecedent
FuzzyRuleAntecedent* siErrorNegativoGrande = new FuzzyRuleAntecedent();
siErrorNegativoGrande -> joinSingle(ENG);
// Definimos el objeto consequente perteneciente a la clase FuzzyRuleConsequent
FuzzyRuleConsequent* entoncesVoltajeNegativoGrnade = new FuzzyRuleConsequent();
entoncesVoltajeNegativoGrnade -> addOutput(VNG);
// Definimos la primera regla difusa
FuzzyRule* reglaDifusa1 = new FuzzyRule(1, siErrorNegativoGrande, entoncesVoltajeNegativoGrnade);
fuzzy -> addFuzzyRule(reglaDifusa1);
// Definimos las reglas necesarias para el controlador difuso
FuzzyRuleAntecedent* siErrorNegativoPequeno = new FuzzyRuleAntecedent();
siErrorNegativoPequeno -> joinSingle(ENP);
FuzzyRuleConsequent* entoncesVoltajeNegativoPequeno = new FuzzyRuleConsequent();
entoncesVoltajeNegativoPequeno -> addOutput(VNP);
FuzzyRule* reglaDifusa2 = new FuzzyRule(1, siErrorNegativoPequeno, entoncesVoltajeNegativoPequeno);
fuzzy -> addFuzzyRule(reglaDifusa2);
FuzzyRuleAntecedent* siErrorCero = new FuzzyRuleAntecedent();
siErrorCero -> joinSingle(EC);
FuzzyRuleConsequent* entoncesVoltajeCero = new FuzzyRuleConsequent();
entoncesVoltajeCero -> addOutput(VC);
FuzzyRule* reglaDifusa3 = new FuzzyRule(1, siErrorCero, entoncesVoltajeCero);
fuzzy -> addFuzzyRule(reglaDifusa3);
FuzzyRuleAntecedent* siErrorPositivoPequeno = new FuzzyRuleAntecedent();
siErrorPositivoPequeno -> joinSingle(EPP);
FuzzyRuleConsequent* entoncesVoltajePositivoPequeno = new FuzzyRuleConsequent();
entoncesVoltajePositivoPequeno -> addOutput(VPP);
FuzzyRule* reglaDifusa4 = new FuzzyRule(1, siErrorPositivoPequeno, entoncesVoltajePositivoPequeno);
fuzzy -> addFuzzyRule(reglaDifusa4);
FuzzyRuleAntecedent* siErrorPositivoGrande = new FuzzyRuleAntecedent();
siErrorPositivoGrande -> joinSingle(EPG);
FuzzyRuleConsequent* entoncesVoltajePositivoGrande = new FuzzyRuleConsequent();
entoncesVoltajePositivoGrande -> addOutput(VPG);
FuzzyRule* reglaDifusa5 = new FuzzyRule(1, siErrorPositivoGrande, entoncesVoltajePositivoGrande);
fuzzy -> addFuzzyRule(reglaDifusa5);
}
// Fucnion loop la cual ejecuta el programe
void loop(){
referenciaTotal = referenciaTotal - referenciaLectura[referencia];
// Recuperamos el dato analogo que se encuentra en el pin A0
referenciaLectura[referencia] = analogRead(referenciaPin);
// Almacenamos el valor el vector
referenciaTotal = referenciaTotal + referenciaLectura[referencia];
referencia = referencia + 1;
if(referencia >= 10){
referencia = 0;
referenciaPromedio = referenciaTotal / 10;
referenciaValor = referenciaPromedio;
referenciaValor = referenciaValor * 100 / 1023;
referenciaValorGrados = map(referenciaValor, 0, 100, 0, 300);
}
sensorTotal = sensorTotal - sensorLectura[sensor];
// Recuperamos el dato analogo que se encuentra en el pin A1
sensorLectura[sensor] = analogRead(sensorPin);
// Almacenamos el valor el vector
sensorTotal = sensorTotal + sensorLectura[sensor];
sensor = sensor + 1;
if(sensor >= 10){
sensor = 0;
sensorPromedio = sensorTotal / 10;
sensorValor = sensorPromedio;
sensorValor = sensorValor * 100 / 1023;
sensorValorGrados = map(sensorValor, 0, 100, 0, 300);
}
// Declaramos la variable para almacenar el valor del sensor en grados
float e = referenciaValorGrados - sensorValorGrados;
// Fusificamos el valor en grados
fuzzy -> setInput(1, e);
fuzzy -> fuzzify();
// defusificamos el valor del voltaje
float v = fuzzy -> defuzzify(1);
if (v < 0){
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
senalControl = map(v, -8, 0, 0, 255);
bD1.write(90);
analogWrite(salidaControl, senalControl);
}
if (v > 0){
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
senalControl = map(v, 0, 8, 0, 255);
analogWrite(salidaControl, senalControl);
bD1.write(0);
}
if (v = 0){
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
v = 0;
senalControl = v;
analogWrite(salidaControl, senalControl);
bD1.write(0);
}
}
Code in Java for generate graphics of the functions of membership:
File with the rules:
Code in Java:
Video of the project:
Conclusions:
The prototype is in a
state of half the functionality which will improve with the implementation and
printing the final design of the same in which you will need to design
corrections to improve the balance of this. The mobile application is
functional so we will have to make changes only in the design of the interface.
References:
[1]. Preising, B., Hsia, T. C., & Mittelstadt, B. (1991). A literature review: robots in medicine. IEEE Engineering in Medicine and Biology Magazine, 10(2), 13-22.
[2]. Rodríguez-Prunotto, L., Cano-de la Cuerda, R., Cuesta-Gómez, A., Alguacil-Diego, I. M., & Molina-Rueda, F. (2014). Terapia robótica para la rehabilitación del miembro superior en patología neurológica. Rehabilitación, 48(2), 104-128.
[3]. Valdivia, C. H. G., Ortega, A. B., Salazar, M. A. O., & Rivera, H. R. A. (2014). Modelado y Simulación de un Robot Terapéutico para la Rehabilitación de Miembros Inferiores (Modeling and Simulation of a Therapeutic Robot for Lower Limbs Rehabilitation/Modelagem e Simulação de um robô terapêutico de Reabilitação de Membros Inferiores). Revista Ingeniería Biomédica, 7(14).
[4]. Pérez Rodríguez, A. J. (2015). Adopción de un robot CRS-PLUS para su control usando Arduino.
[5]. Arredondo, A. T. O., & Campiño, S. R. (2017). CONTROL EN LAZO CERRADO DE UN CONVERTIDOR CC/CC TIPO BUCK UTILIZANDO LÓGICA DIFUSA MEDIANTE LA IMPLEMENTACIÓN DE ARDUINO.
Jose Illescas, Oscar Mora
jillescass1@est.ups.edu.ec, omora@est.ups.edu.ec
General
Perspective:
JEIS is a robotic prototype which will be
used in the HICP "Institute of Cerebral Palsy of the Azuay". This
prototype is based on a construction of humanoid type with the intention to
assist in the tasks of teaching of teachers and therapists of the institution
before named.
The prototype account with robotic joints
which allow you to perform movientes of laterality similar to those performed
by a person.
In the same way the robotic prototype will
have two basic functions which are identified as:
Fulfils the role of a teacher where by
means of orders this indicates that the patient movement must perform.
Fulfils the role of student where the
patient interacts with the robot through a mobile application where the patient
chooses a movement represented by images in the mobile application, given the
order the robot performs the move is indicated by the patient in the mobile
application.
Objectives:
- The prototype should be able to make movements with their limbs either with the arms or legs.
- The prototype must be able to identify by capturing images using a raspicam which identifies the movement made by the patient and checks if there is wisdom in the order.
- The prototype must be able to receive orders through the mobile application and perform them correctly.
- The prototype must be able to log successes and errors through the process of conducting the therapy.
- The prototype must be able to perform facial expressions such as the movement of eyebrows and blinked her eyes.
Proposed Solution:
For the
performance of the various aspects and movements that must be made by the
robotic prototype to implemented the following design of the prototype.
As
noted in the previous image we present the design of the robotic prototype with
servos sg90 in the joints such as shoulders, elbows, knees, etc., which allow
you to perform different movements prototype for the teaching unit.
Schematic diagram:
Mobile app:
The mobile application complies with some features among the most important thing is that we have the selection of the student who performs the therapy, students are registered in a database in the cloud which also has the registration of teachers and courses offered by the institution
As noted in the previous image presents the
list of students and teachers which are registered in an external server. These
data will be consumed by the mobile application for the realization of the
therapy with the robotic prototype.
As the first point of the mobile
application we have the authentication of the teacher or terapisque performs
the therapy.
With the authentication of the teaching
staff have access to the options page where you can view the tests and courses
available at your expense.
With the option we can visualize the test
reports made by the robotic prototype.
In
the option courses we can observe the courses the teacher has in charge where
by choosing one of the courses that you can view the participants of this and
choose a patient for therapy.
Once you have selected the patient with
which will work in therapy we can access the window for the submission of the
application for the patient.
As noted in the last image in this we can
choose the movement to be performed by JEIS.
Implementation of fuzzy logic in the prototype.
In the process of
programming the prototype has been implemented a system of fuzzy control which
allows you to control the position of a servo motor the same that will balance
the robot.
For the implementation
of the fuzzy system the design of a test circuit which is shown below.
The circuit shown in
the previous image has the functionality to show the operation of the fuzzy
system implemented in the Arduino. As can be seen in the image the circuit
consists of two potentiometers of 10K the same you have different functions.
The first
potentiometer has the functionality to deliver a reference point where it is
considered that the robot is balanced. The second potentiometer has the
functionality to deliver the real value of the motor's position that this case
delivers the actual position of the robot.
The LED lights on the
circuit show the balance in the event of a flashing yellow reflects a slight
slip to the left while the red light shows a slight slip to the right.
The integrated circuit
L293D or H-bridge was installed with the intention to perform operation tests
with a DC motor so that its role is to deliver the direction of rotation of the
engine. In the case of the potentiometers have the pins in the middle or pins
of the same signal connected to the analog inputs of the Arduino A0 and A1.
The pins 51 and 52 are
output pins for the rotation of the motor in case the LOW the pin 51 the
rotation will be counterclockwise, by another case if the pin 52 is LOW and the
rotation will be clockwise.
The other connectors
are only supplies energy to the different devices on the circuit. The following
shows the operation of the circuit:
Video of funcionality of the circuit:
Arduino code of the prototype:
// Librerias necesarias para el funcionamiento del controlador difuzo
#include <FuzzyRule.h>
#include <FuzzyComposition.h>
#include <Fuzzy.h>
#include <FuzzyRuleConsequent.h>
#include <FuzzyOutput.h>#include <FuzzyInput.h>
#include <FuzzyIO.h>#include <FuzzySet.h>
#include <FuzzyRuleAntecedent.h>
// Libreria necesaria para el funcionamiento y control del servo motor
#include <Servo.h>
// Declaracion de la variable para el servo motorServo bD1;
// Invocacion de un objeto de nombre fuzzy perteneciente a la clase
FuzzyFuzzy* fuzzy = new Fuzzy();
// Declaramos que el pin A0 del arduino se llamara referencia pin
// Y que atravez del mismo se recuperar el valor en voltaje entregado por
// el potenciometro de referencia
// Este valor es el senalado por el usuario para la pocicion deseada
int const referenciaPin = A0;
float referenciaValor = 0;
float referenciaValorGrados = 0;
// Declaramos que el pin A1 del arduino se llamara sensor pin
// Y que atravez del mismo se recuperar el valor en voltaje entregado por
// el potenciometro sensor de la pocicion actual del motor
// Este valor es el senalado por el sistema para el equilibrio
int const sensorPin = A1;
float sensorValor = 0;
float sensorValorGrados = 0;
// Declaramos el pin del arduino A2 como salida del sistema
int const salidaControl = A2;
float senalControl = 0;
//DECLARACION DE VARIABLES PARA EL CONTROL DE SENTIDO DE GIRO DEL MOTOR
int IN1 = 51;
int IN2 = 52;
// DECLARACION DE VARIABLES PARA EL "FILTRO"
int sensorLectura[10];
int referenciaLectura[10];
int sensor = 0;
int referencia = 0;
int sensorTotal = 0;
int referenciaTotal = 0;
int sensorPromedio = 0;
int referenciaPromedio = 0;
void setup(){
// Declaramos el pin 4 como senal del servo motor
bD1.attach(4);
// Senalos las variables como salida
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
// Este blucle se encarga del llenado de las 10 muestras entragadas por el potenciometro sensor
for( sensor = 0; sensor < 10; sensor++){
sensorLectura[sensor] = 0;
}
sensor = 0;
// Este blucle se encarga del llenado de las 10 muestras entragadas por el potenciometro referencia
for(referencia = 0; referencia < 10; referencia++){
referenciaLectura[referencia] = 0;
}
referencia = 0;
// Implementacion del controlador difuzo en el arduino
// Variable ENG "Error negativo grande"// Variable ENP "Error negativo pequeno"
// Variable EC "Error cero"// Variable EPP "Error positivo pequeno"
// Variable EPG "Error positivo grande"
// Declaramos un objeto tipo error es la entreda del controlador difuzo
FuzzyInput* error = new FuzzyInput(1);
// Declaramos el primer conjunto difuzo del objeto
// Declaramos una funcion tipo trapesoidal por lo que se ingresa 4 parametros
FuzzySet* ENG = new FuzzySet(-300, -300, -150, -75);
// Adicionamos el conjunto difuzo al objeto error
error -> addFuzzySet(ENG);
// Funcion tipo triangular
FuzzySet* ENP = new FuzzySet(-150, -75, -75, 0);
error -> addFuzzySet(ENP);
FuzzySet* EC = new FuzzySet(-75, 0, 0, 75);
error -> addFuzzySet(EC);
// Funcio Triangular
FuzzySet* EPP = new FuzzySet(0, 75, 75, 150);
error -> addFuzzySet(EPP);
// Funcion Trapesoidal
FuzzySet* EPG = new FuzzySet(75, 150, 300, 300);
error -> addFuzzySet(EPG);
fuzzy -> addFuzzyInput(error);
// Declaracion de un objeto de nombre volatje
// Este objeto es de tipo salida
FuzzyOutput* voltaje = new FuzzyOutput(1);
// Funcion trapesoidal
FuzzySet* VNG = new FuzzySet(-12, -12, -6, -3);
voltaje -> addFuzzySet(VNG);
// Funcion Triangular
FuzzySet* VNP = new FuzzySet(-6, -3, -3, 0);
voltaje -> addFuzzySet(VNP);
// Funcion Triangular
FuzzySet* VC = new FuzzySet(-3, 0, 0, 3);
voltaje -> addFuzzySet(VC);
// Funcion Triangular
FuzzySet* VPP = new FuzzySet(0, 3, 3, 6);
voltaje -> addFuzzySet(VPP);
// Funcion trapesoidal
FuzzySet* VPG = new FuzzySet(3, 6, 12, 12);
voltaje -> addFuzzySet(VPG);
fuzzy -> addFuzzyOutput(voltaje);
// Deficnicion de las reglas de control
// Definimos el primer objeto que pertencese al la clase FuzzyRuleAntecedent
FuzzyRuleAntecedent* siErrorNegativoGrande = new FuzzyRuleAntecedent();
siErrorNegativoGrande -> joinSingle(ENG);
// Definimos el objeto consequente perteneciente a la clase FuzzyRuleConsequent
FuzzyRuleConsequent* entoncesVoltajeNegativoGrnade = new FuzzyRuleConsequent();
entoncesVoltajeNegativoGrnade -> addOutput(VNG);
// Definimos la primera regla difusa
FuzzyRule* reglaDifusa1 = new FuzzyRule(1, siErrorNegativoGrande, entoncesVoltajeNegativoGrnade);
fuzzy -> addFuzzyRule(reglaDifusa1);
// Definimos las reglas necesarias para el controlador difuso
FuzzyRuleAntecedent* siErrorNegativoPequeno = new FuzzyRuleAntecedent();
siErrorNegativoPequeno -> joinSingle(ENP);
FuzzyRuleConsequent* entoncesVoltajeNegativoPequeno = new FuzzyRuleConsequent();
entoncesVoltajeNegativoPequeno -> addOutput(VNP);
FuzzyRule* reglaDifusa2 = new FuzzyRule(1, siErrorNegativoPequeno, entoncesVoltajeNegativoPequeno);
fuzzy -> addFuzzyRule(reglaDifusa2);
FuzzyRuleAntecedent* siErrorCero = new FuzzyRuleAntecedent();
siErrorCero -> joinSingle(EC);
FuzzyRuleConsequent* entoncesVoltajeCero = new FuzzyRuleConsequent();
entoncesVoltajeCero -> addOutput(VC);
FuzzyRule* reglaDifusa3 = new FuzzyRule(1, siErrorCero, entoncesVoltajeCero);
fuzzy -> addFuzzyRule(reglaDifusa3);
FuzzyRuleAntecedent* siErrorPositivoPequeno = new FuzzyRuleAntecedent();
siErrorPositivoPequeno -> joinSingle(EPP);
FuzzyRuleConsequent* entoncesVoltajePositivoPequeno = new FuzzyRuleConsequent();
entoncesVoltajePositivoPequeno -> addOutput(VPP);
FuzzyRule* reglaDifusa4 = new FuzzyRule(1, siErrorPositivoPequeno, entoncesVoltajePositivoPequeno);
fuzzy -> addFuzzyRule(reglaDifusa4);
FuzzyRuleAntecedent* siErrorPositivoGrande = new FuzzyRuleAntecedent();
siErrorPositivoGrande -> joinSingle(EPG);
FuzzyRuleConsequent* entoncesVoltajePositivoGrande = new FuzzyRuleConsequent();
entoncesVoltajePositivoGrande -> addOutput(VPG);
FuzzyRule* reglaDifusa5 = new FuzzyRule(1, siErrorPositivoGrande, entoncesVoltajePositivoGrande);
fuzzy -> addFuzzyRule(reglaDifusa5);
}
// Fucnion loop la cual ejecuta el programe
void loop(){
referenciaTotal = referenciaTotal - referenciaLectura[referencia];
// Recuperamos el dato analogo que se encuentra en el pin A0
referenciaLectura[referencia] = analogRead(referenciaPin);
// Almacenamos el valor el vector
referenciaTotal = referenciaTotal + referenciaLectura[referencia];
referencia = referencia + 1;
if(referencia >= 10){
referencia = 0;
referenciaPromedio = referenciaTotal / 10;
referenciaValor = referenciaPromedio;
referenciaValor = referenciaValor * 100 / 1023;
referenciaValorGrados = map(referenciaValor, 0, 100, 0, 300);
}
sensorTotal = sensorTotal - sensorLectura[sensor];
// Recuperamos el dato analogo que se encuentra en el pin A1
sensorLectura[sensor] = analogRead(sensorPin);
// Almacenamos el valor el vector
sensorTotal = sensorTotal + sensorLectura[sensor];
sensor = sensor + 1;
if(sensor >= 10){
sensor = 0;
sensorPromedio = sensorTotal / 10;
sensorValor = sensorPromedio;
sensorValor = sensorValor * 100 / 1023;
sensorValorGrados = map(sensorValor, 0, 100, 0, 300);
}
// Declaramos la variable para almacenar el valor del sensor en grados
float e = referenciaValorGrados - sensorValorGrados;
// Fusificamos el valor en grados
fuzzy -> setInput(1, e);
fuzzy -> fuzzify();
// defusificamos el valor del voltaje
float v = fuzzy -> defuzzify(1);
if (v < 0){
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
senalControl = map(v, -8, 0, 0, 255);
bD1.write(90);
analogWrite(salidaControl, senalControl);
}
if (v > 0){
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
senalControl = map(v, 0, 8, 0, 255);
analogWrite(salidaControl, senalControl);
bD1.write(0);
}
if (v = 0){
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
v = 0;
senalControl = v;
analogWrite(salidaControl, senalControl);
bD1.write(0);
}
}
Code in Java for generate graphics of the functions of membership:
File with the rules:
Code in Java:
Video of the project:
Conclusions:
The prototype is in a
state of half the functionality which will improve with the implementation and
printing the final design of the same in which you will need to design
corrections to improve the balance of this. The mobile application is
functional so we will have to make changes only in the design of the interface.
References:
[1]. Preising, B., Hsia, T. C., & Mittelstadt, B. (1991). A literature review: robots in medicine. IEEE Engineering in Medicine and Biology Magazine, 10(2), 13-22.
[2]. Rodríguez-Prunotto, L., Cano-de la Cuerda, R., Cuesta-Gómez, A., Alguacil-Diego, I. M., & Molina-Rueda, F. (2014). Terapia robótica para la rehabilitación del miembro superior en patología neurológica. Rehabilitación, 48(2), 104-128.
[3]. Valdivia, C. H. G., Ortega, A. B., Salazar, M. A. O., & Rivera, H. R. A. (2014). Modelado y Simulación de un Robot Terapéutico para la Rehabilitación de Miembros Inferiores (Modeling and Simulation of a Therapeutic Robot for Lower Limbs Rehabilitation/Modelagem e Simulação de um robô terapêutico de Reabilitação de Membros Inferiores). Revista Ingeniería Biomédica, 7(14).
[4]. Pérez Rodríguez, A. J. (2015). Adopción de un robot CRS-PLUS para su control usando Arduino.
[5]. Arredondo, A. T. O., & Campiño, S. R. (2017). CONTROL EN LAZO CERRADO DE UN CONVERTIDOR CC/CC TIPO BUCK UTILIZANDO LÓGICA DIFUSA MEDIANTE LA IMPLEMENTACIÓN DE ARDUINO.
[4]. Pérez Rodríguez, A. J. (2015). Adopción de un robot CRS-PLUS para su control usando Arduino.
[5]. Arredondo, A. T. O., & Campiño, S. R. (2017). CONTROL EN LAZO CERRADO DE UN CONVERTIDOR CC/CC TIPO BUCK UTILIZANDO LÓGICA DIFUSA MEDIANTE LA IMPLEMENTACIÓN DE ARDUINO.











No comments:
Post a Comment