Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Sistemas de Control Digital - Proyecto
Sistemas de Control Digital - Proyecto
BALANCÍN
EVALUACION
CODIGO NOMBRE SUST
PREVIO FINAL NOTA
.
_______________________
90G 11/09/2017
Docente
Observaciones:
P á g i n a 1 | 22
Contenido
UNIVERSIDAD NACIONAL DEL CALLAO .......................................................................... 1
FACULTAD DE ELECTRICA Y ELECTRONICA ................................................................. 1
LABORATORIO DE CONTROL DIGITAL............................................................................. 1
PROYECTO: CONTROL PID – TERCER AVANCE DEL PROYECTO ........................... 1
BALANCÍN .................................................................................................................................. 1
....................................................................................................................................................... 1
Observaciones: ........................................................................................................................... 1
I. Resumen: .......................................................................................................................... 3
II. Objetivos: .......................................................................................................................... 3
III. Materiales: .................................................................................................................... 3
IV. Reglas para sintonizar controladores PID de Ziegler-Nichols ..................................... 4
V. Descripción del problema.............................................................................................. 5-5
VI. Modelo Matemático .................................................................................................. 6-6
VII. ensamblado del proyecto ......................................................................................... 9-8
VIII. diagrama de conexion .............................................................................................. 133
VIII. Programación en Arduino ................................................................................... 133-20
IX. Programación en Processing ................................................................................... 221
X. Bibliografía ...................................................................................................................... 22
P á g i n a 2 | 22
I. Resumen:
III. Materiales:
Producto Cantidad Precio Vista de materiales
Arduino UNO 1 S/. 35
Baterías 9v 2 S/. 8
Chasis de 1 S/. 10
robot
Motores 2 S/. 20
llantas 2 S/. 10
P á g i n a 3 | 22
MPU6050 1 S/. 16
(acelerómetro y
giroscopio)
Primer método
𝐶(𝑠) 𝐾𝑒 −𝐿𝑠
=
𝑈(𝑠) 𝑇𝑠 + 1
P á g i n a 4 | 22
Segundo método
El péndulo invertido es conocido por ser uno de los problemas más importantes
y clásicos de la teoría de control. El sistema se compone de un carro sobre el
cual se monta un péndulo que puede girar libremente. El carro deberá moverse
para compensar el desplazamiento del péndulo y mantenerlo, así, en equilibrio.
P á g i n a 5 | 22
A B
Fig7. A) Esquema péndulo invertido. B) Ejemplo Sedway.
Despejando 𝑥̈ y 𝜃̈ obtenemos:
−𝑀𝐿 𝑏 1
𝑥̈ = 𝜃̈ − 𝑥̇ + 𝑢 … … … … … … … … (12)
(𝑀 + 𝑚) (𝑀 + 𝑚) (𝑀 + 𝑚)
𝑀𝐿 𝑀𝑔𝐿
𝜃̈ = − 2
𝑥̈ + 𝜃 … … … … … … … … (13)
(𝐼 + 𝑀𝐿 ) (𝐼 + 𝑀𝐿2 )
𝑀𝑔𝐿(𝑀 + 𝑚) 𝑀𝐿𝑏 𝑀𝐿
𝜃̈ = 𝜃 + 𝑥̇ − 𝑢 … … (14)
𝐼(𝑀 + 𝑚) + 𝑀𝑚𝐿2 𝐼(𝑀 + 𝑚) + 𝑀𝑚𝐿2 𝐼(𝑀 + 𝑚) + 𝑀𝑚𝐿2
𝑀𝑔𝐿(𝑀 + 𝑚) 𝑀𝐿𝑏
𝑠 2 𝜃(𝑠) = 2
𝜃(𝑠) + 𝑠𝑋(𝑠)
𝐼(𝑀 + 𝑚) + 𝑀𝑚𝐿 𝐼(𝑀 + 𝑚) + 𝑀𝑚𝐿2
𝑀𝐿
− 𝑈(𝑠) … … (16)
𝐼(𝑀 + 𝑚) + 𝑀𝑚𝐿2
ℎ4 ℎ5 ℎ6
𝑠 2 𝑋(𝑠) = − 𝜃(𝑠) − 𝑠𝑋(𝑠) + 𝑈(𝑠) … … (19)
ℎ7 ℎ7 ℎ7
Donde:
ℎ1 = 𝑀𝑔𝐿(𝑀 + 𝑚) … … … … … … … … (20)
ℎ2 = 𝑀𝐿𝑏 … … … … … … … … (21)
ℎ3 = 𝑀𝐿 … … … … … … … … (22)
ℎ4 = 𝑔𝑀2 𝐿2 … … … … … … … … (23)
ℎ5 = 𝑏(𝐼 + 𝑀𝐿2 ) … … … … … … … … (24)
ℎ6 = 𝐼 + 𝑀𝐿2 … … … … … … … … (25)
ℎ7 = 𝐼(𝑀 + 𝑚) + 𝑀𝑚𝐿2 … … … … … … … … (26)
Entonces:
P á g i n a 7 | 22
ℎ1 ℎ2 ℎ4 ℎ2 ℎ6 ℎ3
𝑠 2 𝜃(𝑠) = 𝜃(𝑠) − 2 𝜃(𝑠) + 2 𝑈(𝑠) − 𝑈(𝑠) … … … (27)
ℎ7 𝑠ℎ7 + ℎ5 ℎ7 𝑠ℎ7 + ℎ5 ℎ7 ℎ7
ℎ2 ℎ6 ℎ (𝑠ℎ + ℎ5 )
− 3 7
𝜃(𝑠) 𝑠ℎ7 2 + ℎ5 ℎ7 𝑠ℎ7 2 + ℎ5 ℎ7
𝐻(𝑠) = = … … … … … (29)
𝑈(𝑠) 2 (𝑠ℎ7 + ℎ5 ) ℎ1 (𝑠ℎ7 + ℎ5 ) ℎ2 ℎ4
𝑠 − +
𝑠ℎ7 2 + ℎ5 ℎ7 𝑠ℎ7 2 + ℎ5 ℎ7 𝑠ℎ7 2 + ℎ5 ℎ7
𝜃(𝑠) ℎ2 ℎ6 − ℎ3 (𝑠ℎ7 + ℎ5 )
𝐻(𝑠) = = 2 … … … … … (30)
𝑈(𝑠) 𝑠 (𝑠ℎ7 + ℎ5 ) − ℎ1 (𝑠ℎ7 + ℎ5 ) + ℎ2 ℎ4
𝜃(𝑠) ℎ2 ℎ6 − ℎ3 (𝑠ℎ7 + ℎ5 )
𝐻(𝑠) = = 2 … … … … … (31)
𝑈(𝑠) 𝑠 (𝑠ℎ7 + ℎ5 ) − ℎ1 (𝑠ℎ7 + ℎ5 ) + ℎ2 ℎ4
𝜃(𝑠) −ℎ3 ℎ7 𝑠 + ℎ2 ℎ6 − ℎ3 ℎ5
𝐻(𝑠) = = 3 … … … … … (31)
𝑈(𝑠) 𝑠 ℎ7 + 𝑠 2 ℎ5 − 𝑠ℎ1 ℎ7 − ℎ1 ℎ5 + ℎ2 ℎ4
−2.818𝑒08𝑠 − 8.917𝑒09
𝐻(𝑠) =
𝑠^3 + 143.5 𝑠^2 + 9.29𝑒05 𝑠 + 7.261𝑒06
P á g i n a 8 | 22
VII. Ensamblado del proyecto
Paso 1: Comenzamos con las pequeñas piezas laterales que son los soportes de los motores.
PASO 1: Se coloca una tuerca para sujetar la varilla a la placa inferior y fijamos las baterías de 9v
en la base del chasis y también los tornillos de soporte.
Paso 1: colocamos los motores de las llantas debajo y a la altura de las baterías de 9v.
Paso 1: Fijamos los motores a dichas piezas con sus 2 tornillos de 1.5cm de largo y Observamos
que dicho tornillo no sobresale del lado opuesto al cual lo colocamos.
P á g i n a 9 | 22
PASO 1: Una vista más de cómo queda la rueda y las varillas montadas.
P á g i n a 10 | 22
PASO 1: conectamos el driver ld298n y pegamos el acelerómetro encima del driver.
PASO 1: Observamos desde abajo como quedan las 3 placas montadas una vez ya instalado el
puente “h” junto con el acelerómetro MCU6050 y el microcontrolador arduino UNO.
PASO 1: cableamos todos los materiales a usar y pegamos algunos componentes extras.
P á g i n a 11 | 22
PASO 1: luego limpiamos las impurezas como residuos de pegamento y de soldadura.
P á g i n a 12 | 22
VIII. DIAGRAMA DE CONEXIÓN
A continuación se mostrara las 4 etapas de control del robot balancín como es el control
P,PI,PD,PID.
Control P
P á g i n a 13 | 22
Control PD
P á g i n a 14 | 22
Control PI
P á g i n a 15 | 22
Control PID
#include "I2Cdev.h"
#include "MPU6050_6Axis_MotionApps20.h"
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
#include "Wire.h"
#endif
MPU6050 mpu;
#define OUTPUT_READABLE_YAWPITCHROLL
#define LED_PIN 13 // (Arduino is 13, Teensy is 11, Teensy++ is 6)
bool blinkState = false;
// orientation/motion vars
Quaternion q; // [w, x, y, z] quaternion container
VectorInt16 aa; // [x, y, z] accel sensor measurements
VectorInt16 aaReal; // [x, y, z] gravity-free accel sensor measurements
VectorInt16 aaWorld; // [x, y, z] world-frame accel sensor measurements
VectorFloat gravity; // [x, y, z] gravity vector
float euler[3]; // [psi, theta, phi] Euler angle container
float ypr[3]; // [yaw, pitch, roll] yaw/pitch/roll container and gravity vector
devStatus = mpu.dmpInitialize();
mpu.setXGyroOffset(220);
mpu.setYGyroOffset(76);
mpu.setZGyroOffset(-85);
mpu.setZAccelOffset(1788); // 1688 factory default for my test chip
// set our DMP Ready flag so the main loop() function knows it's okay to use it
Serial.println(F("DMP ready! Waiting for first interrupt..."));
dmpReady = true;
// check for overflow (this should never happen unless our code is too inefficient)
if ((mpuIntStatus & 0x10) || fifoCount == 1024) {
// reset so we can continue cleanly
mpu.resetFIFO();
Serial.println(F("FIFO overflow!"));
// otherwise, check for DMP data ready interrupt (this should happen frequently)
} else if (mpuIntStatus & 0x02) {
P á g i n a 17 | 22
// wait for correct available data length, should be a VERY short wait
while (fifoCount < packetSize) fifoCount = mpu.getFIFOCount();
fifoCount -= packetSize;
#ifdef OUTPUT_READABLE_YAWPITCHROLL
// display Euler angles in degrees
mpu.dmpGetQuaternion(&q, fifoBuffer);
mpu.dmpGetGravity(&gravity, &q);
mpu.dmpGetYawPitchRoll(ypr, &q, &gravity);
// Serial.print("ypr\t");
Serial.print(ypr[0] * 180/M_PI);
Serial.print(",");
Serial.print(ypr[1] * 180/M_PI);
Serial.print(",");
Serial.println(ypr[2] * 180/M_PI);
#endif
P á g i n a 18 | 22
Pasos en Matlab:
P á g i n a 19 | 22
P á g i n a 20 | 22
X. Programación en Processing
import processing.serial.*;
Serial myPort; // The serial port
float valor[];
float mx, my;
void setup () {
size(400, 400);
frameRate(200);
println(Serial.list());
valor=null;
myPort = new Serial(this,Serial.list()[0],115200);
myPort.bufferUntil('\n');
}
void draw () {
background(0);
textSize(50); //Tamaño del texto
if (valor!=null) {
//PROGRAMACION ADICIONAL PARA MOSTRAR LA TOMADA DE DATOS
/*
text('Y', 20, 100);
text(valor[0], 100, 100);
text('P', 20, 200); //Movimiento en Y
text(valor[1], 100, 200);
text('R', 20, 300); //Movimiento en X
text(valor[2], 100, 300); */
P á g i n a 21 | 22
XI. Bibliografía
[Anderson, 2003]
D. P. Anderson “Nbot Balancing Robot”, 2003. Disponible en
http://geology.heroy.smu.edu/~dpa-www/robo/nbot.
[Furuta, 1976]
K. Furuta, H. Nishihara and S. Mori. “Control of Unstable Mechanical Systems:
Control of Pendulum”. International Journal of Control, Vol. 23, pp. 673-692,
1976.
[Grasser, 2002]
F. Grasser, A. D’Arrigo, S. Colombi and A. Rufer. “Joe: A Mobile, Inverted
Pendulum”. Swiss Federal Institute of Technology, 2002.
http://leiwww.epfl.ch/publications/grasser_darrigo_colombi_rufer_mic_01.pdf
[Hassenplug, 2002]
S. Hassenplug. “Legway”, 2002. Disponible en
http://www.teamhassenplug.org/robots/legway.
[Hurbains, 2007]
P. Hurbain’s. “Nxtway”, 2007. http://www.philohome.com/nxtway/.
[Kosko, 1992]
Kosko B. Neural Networks and Fuzzy Systems: A Dynamical System S Approach
to Machine Intelligence Eaglewood. Prentice hall 1992
[Kuo, 1992]
Kuo, Benjamin. Digital Control Systems. Second edition. Oxford University
Press. New York. 1992
[Michigan Engineering]
http://www.engin.umich.edu/group/ctm/examples/pend/invSS.html Michigan
Engineering
[Novakowski, 2006]
N. Novakowski, "Equations os motion and control of an inverted pendulum",
Rensselaer al Harford, CT, Tech. Rep. 2006.
Control inteligente del péndulo invertido
73
[Ogata, 1997]
Ogata, Katsuhiko. Modern Control Engineering. 3º Edition. Prentice Hall. 1997
[Ooi, 2003]
R. Ooi. “Balancing a Two-Wheeled Autonomous Robot”. University of Western
Australia, 2003. Disponible en http://robotics.ee.uwa.edu.au/theses/2003-
Balance-Ooi.pdf
[Sherman, 2003]
B. Sherman. “Balibot, an Inverted Pendulum Robot”, 2003. Disponible en
http://home.comcast.net/~botronics/balibot.html.
[Stimac, 1999]
A. K. Stimac. (1999). Standup and stabilization of the inverted pendulum, B.S.
thesis, Dept. Metch. Eng., Massachusetts Inst.Technol. Cambridge, MA.
P á g i n a 22 | 22