Vous êtes sur la page 1sur 38

MAESTRO

RAFAEL IVAN AYALA

MATERIA
ROBOTICA

CARRERA
ING. MECATRONICA

ALUMNOS

CANO PEREZ ADAM EMMANUEL 14490668


SANCHEZ ANGUIANO MANUEL SALVADOR 14490915
SOSA BLANCO MIGUEL EDUARDO 15490056
TRUJILLO MEZA GABRIEL ANTONIO 1490581

REPORTE
PROYECTO FINAL

03 DE DICIEMBRE DE 2018
INTRODUCCION

Por medio de este documento describiremos todo lo que nos implicó el desde el
diseño y elaboración del brazo robótico así como sus cálculos realizados con
matrices y demostración realizada de una manera gráfica con Matlab y una
manera física con la maqueta.
Este brazo robótico se conforma de 3 de ejes o 3 grados de libertad este será
controlado mediante un arduino para enviarle los pulsos a los micro servos y estos
muevan los ejes del brazo robótico y se pueda llegar a la posición deseada
mediante los pulsos, enviados por potenciómetros conectados a el circuito
realizado con arduino nano.
MARCO TEORICO

Materiales:

3 micro servos sg90


2 resistencias de 10k
2 push buttons
3 potenciómetros
1 Arduino nano

MICRO SERVOS SG90

El servo SG90 Tower Pro un servo miniatura de gran calidad y diminutas


dimensiones, además es bastante económico. Funciona con la mayoría de tarjetas
electrónicas de control con microcontroladores y además con la mayoría de los
sistemas de radio control comercial. Funciona especialmente bien en aeronaves
de aeromodelismo dadas sus características de torque, tamaño y peso.

El servo SG90 tiene un conector universal tipo “S” que encaja perfectamente en la
mayoría de los receptores de radio control incluyendo los Futaba, JR, GWS,
Cirrus, Hitec y otros. Los cables en el conector están distribuidos de la siguiente
forma: Rojo =Alimentación (+), Cafe = Alimentación (–) o tierra, Naranja= Señal
PWM.
Este tipo de servo es ideal para las primeras experiencias de aprendizaje y
prácticas con servos, ya que sus requerimientos de energía son bastante bajos y
se permite alimentarlo con la misma fuente de alimentación que el circuito de
control. Por ejemplo, si se conecta a una tarjeta arduino, se puede alimentar
durante las pruebas desde el puerto USB del PC sin mayor problema.

Características
 Micro Servo Tower-pro
 Velocidad: 0.10 sec/60° @ 4.8V
 Torque: 1.8 Kg-cm @ 4.8V
 Voltaje de funcionamiento: 3.0-7.2V
 Temperatura de funcionamiento: -30 ℃ ~ 60 ℃
 Ángulo de rotación: 180°
 Ancho de pulso: 500-2400 µs
 Longitud de cable de conector: 24.5cm
RESISTENCIAS

La resistencia eléctrica se mide en Ohmios (Ω) y se representa con la letra R. En


un circuito de corriente continua podemos calcular la resistencia despejándola de
la fórmula de la ley de ohm: R = V/I; V en voltios e I en amperios nos dará
la resistencia en Ohmios (Ω).

Símbolos de la resistencia eléctrica en un circuito.


Asociaciones generales de resistencias: a) Serie y b) Paralelo. c) Resistencia equivalente.

Para saber el valor de una resistencia tenemos que fijarnos que tiene 3 bandas de
colores seguidas y una cuarta más separada. Las 3 primeras bandas nos dice
su valor, la cuarta banda nos indica la tolerancia, es decir el valor + - el valor que
puede tener por encima o por debajo del valor que marcan las 3 primeras bandas.

Push botón
INTERRUPTORES
Un interruptor es un operador eléctrico cuya función es abrir o cerrar un circuito de forma
permanente. Al accionarlo, hacemos que varíe su posición, abriendo un circuito que
estaba cerrado o cerrando uno que estaba abierto, y permanece así hasta que lo
volvamos a accionar.
Algunos interruptores se accionan automáticamente. Este es el caso de los interruptores
diferenciales que se colocan como protección y desconectan el circuito rápidamente
cuando se produce una fuga o derivación de corriente, por ejemplo al tocar un cable que
está mal aislado.
La mayoría de los aparatos eléctricos llevan uno o varios interruptores para permitir el
paso de la corriente y regular su funcionamiento.

TIPOS DE PULSADORES E INTERRUPTORES

Existen muchos tipos de pulsadores e interruptores, que se diferencian en la forma que


tienen de accionarse:
- Por medio de llaves: Como sucede en el contacto de los coches, las cerradoras
eléctricas de seguridad, las llaves para bloqueo.

- Por temperatura: Constan de una lámina que se deforma con la temperatura y hace
contacto con otra que está inmóvil. El termostato de una plancha eléctrica funciona al
revés: cuando aumenta la temperatura, la lámina se deforma, abre el contacto y deja de
calentar.

- Por presión: Se accionan por la presión que ejerce un fluido. Por ejemplo, por la presión
del aceite, en el caso del testigo de un automóvil, o del agua, en el caso de la
electroválvula de cierre de paso del agua a la lavadora.

- Por campos magnéticos: Es el caso de los llamados interruptores


REED, que constan de dos láminas metálicas separadas que están colocadas dentro de
una ampolla de vidrio. Al acercarles un imán, las láminas se unen y cierran el circuito.

- Por la propia corriente eléctrica: Su funcionamiento está basado en el electroimán: un


núcleo de acero que se magnetiza al pasar la corriente por una bobina de cobre que tiene
a su alrededor.
Potenciómetro

Un potenciómetro es un resistor eléctrico con un valor de resistencia variable y


generalmente ajustable manualmente. Los potenciómetros utilizan tres
terminales y se suelen utilizar en circuitos de poca corriente, para circuitos de
mayor corriente se utilizan los reóstatos. En muchos dispositivos eléctricos los
potenciómetros son los que establecen el nivel de salida. Por ejemplo, en un
altavoz el potenciómetro ajusta el volumen; en un televisor o un monitor de
ordenador se puede utilizar para controlar el brillo.

El valor de un potenciómetro viene expresado en ohmios (símbolo Ω) como las


resistencias, y el valor del potenciómetro siempre es la resistencia máxima que
puede llegar a tener. El mínimo lógicamente es cero. Por ejemplo un
potenciómetro de 10KΩ puede tener una resistencia variable con valores entre
0Ω y 10.000Ω.

Arduino nano
El Arduino Nano es una pequeña, pero poderosa tarjeta basada en el ATmega328. Posee
las mismas funcionalidades que un Arduino UNO, solo que en un tamaño reducido. Para
programarla solo se necesita de un cable Mini USB.
Características:
 Microcontrolador: ATMega328
 Voltaje de operación: 5V
 Voltaje de alimentación (Recomendado): 7-12V
 I/O Digitales: 14 (6 son PWM)
 Memoria Flash: 32KB
 EEPROM: 1KB
 Frecuencia de trabajo: 16MHz
 Dimensiones: 0.73″ x 1.70″

METODOLOGIA

PROCEDIMIENTO
Primero se hizo el bosquejo del brazo robótico de que estaría conformado y los eslabones
que se ocuparían esto se hizo dibujándolo en papel y sacando las medidas que se
ocuparían para después pasar el bosquejo de las piezas que se ocuparían para el
ensamble del brazo robótico.

Con las medidas obtenidas se pasó a dibujar cada una de las piezas en SOLIDWORDS
que posteriormente se maquinaran en una impresora 3D que es la que se encargara de
hacer físicas las piezas que se ocuparan para el ensamble del brazo robótico.
Eslabón principal

Eslabón secundario
Eslabón final

Ya con las piezas físicas se empezara a hacer el ensamble utilizando los demás
componentes

RESULTADOS
Art. Θi di αi-1 ai-1
1 Θ1 0 0 0
2 Θ2 0 90 6 cm
3 Θ3 0 0 6 cm
4 0 0 0 6 cm
Programación en Matlab
function varargout = RRR_ROBOT(varargin)
% RRR_ROBOT MATLAB code for RRR_ROBOT.fig
% RRR_ROBOT, by itself, creates a new RRR_ROBOT or raises the
existing
% singleton*.
%
% H = RRR_ROBOT returns the handle to a new RRR_ROBOT or the handle
to
% the existing singleton*.
%
% RRR_ROBOT('CALLBACK',hObject,eventData,handles,...) calls the
local
% function named CALLBACK in RRR_ROBOT.M with the given input
arguments.
%
% RRR_ROBOT('Property','Value',...) creates a new RRR_ROBOT or
raises the
% existing singleton*. Starting from the left, property value pairs
are
% applied to the GUI before RRR_ROBOT_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property
application
% stop. All inputs are passed to RRR_ROBOT_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only
one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help RRR_ROBOT

% Last Modified by GUIDE v2.5 03-Dec-2018 14:16:56

% Begin initialization code - DO NOT EDIT


gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @RRR_ROBOT_OpeningFcn, ...
'gui_OutputFcn', @RRR_ROBOT_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before RRR_ROBOT is made visible.


function RRR_ROBOT_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to RRR_ROBOT (see VARARGIN)

% Choose default command line output for RRR_ROBOT


handles.output = hObject;

% Update handles structure


guidata(hObject, handles);

% UIWAIT makes RRR_ROBOT wait for user response (see UIRESUME)


% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = RRR_ROBOT_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure


varargout{1} = handles.output;

function Theta_1_Callback(hObject, eventdata, handles)


% hObject handle to Theta_1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of Theta_1 as text


% str2double(get(hObject,'String')) returns contents of Theta_1 as
a double

% --- Executes during object creation, after setting all properties.


function Theta_1_CreateFcn(hObject, eventdata, handles)
% hObject handle to Theta_1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns
called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function Pos_x_Callback(hObject, eventdata, handles)


% hObject handle to Pos_x (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of Pos_x as text


% str2double(get(hObject,'String')) returns contents of Pos_x as a
double

% --- Executes during object creation, after setting all properties.


function Pos_x_CreateFcn(hObject, eventdata, handles)
% hObject handle to Pos_x (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns
called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function Theta_2_Callback(hObject, eventdata, handles)


% hObject handle to Theta_2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of Theta_2 as text


% str2double(get(hObject,'String')) returns contents of Theta_2 as
a double

% --- Executes during object creation, after setting all properties.


function Theta_2_CreateFcn(hObject, eventdata, handles)
% hObject handle to Theta_2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns
called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function Pos_y_Callback(hObject, eventdata, handles)


% hObject handle to Pos_y (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Pos_y as text
% str2double(get(hObject,'String')) returns contents of Pos_y as a
double

% --- Executes during object creation, after setting all properties.


function Pos_y_CreateFcn(hObject, eventdata, handles)
% hObject handle to Pos_y (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns
called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function Theta_3_Callback(hObject, eventdata, handles)


% hObject handle to Theta_3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of Theta_3 as text


% str2double(get(hObject,'String')) returns contents of Theta_3 as
a double

% --- Executes during object creation, after setting all properties.


function Theta_3_CreateFcn(hObject, eventdata, handles)
% hObject handle to Theta_3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns
called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function Pos_z_Callback(hObject, eventdata, handles)


% hObject handle to Pos_z (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of Pos_z as text


% str2double(get(hObject,'String')) returns contents of Pos_z as a
double

% --- Executes during object creation, after setting all properties.


function Pos_z_CreateFcn(hObject, eventdata, handles)
% hObject handle to Pos_z (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns
called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on button press in btn_Directa.


function btn_Directa_Callback(hObject, eventdata, handles)
% hObject handle to btn_Directa (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

Th_1 = str2double(handles.Theta_1.String)*pi/180;
Th_2 = str2double(handles.Theta_2.String)*pi/180;
Th_3 = str2double(handles.Theta_3.String)*pi/180;

L_1 = 6;
L_2 = 6;
L_3 = 6;

L(1) = Link([0 L_1 0 pi/2]);


L(2) = Link([0 0 L_2 0]);
L(3) = Link([0 0 L_3 0]);

Robot = SerialLink(L);
Robot.name = 'RRR_ROBOT';
Robot.plot([Th_1 Th_2 Th_3]);

T = Robot.fkine([Th_1 Th_2 Th_3]);


handles.Pos_x.String = num2str(floor(T(1,4)));
handles.Pos_y.String = num2str(floor(T(2,4)));
handles.Pos_z.String = num2str(floor(T(3,4)));

% --- Executes on button press in btn_inversa.


function btn_inversa_Callback(hObject, eventdata, handles)
% hObject handle to btn_inversa (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
PX = str2double(handles.Pos_x.String);
PY = str2double(handles.Pos_y.String);
PZ = str2double(handles.Pos_z.String);
L_1 = 6;
L_2 = 6;
L_3 = 6;

L(1) = Link([0 L_1 0 pi/2]);


L(2) = Link([0 0 L_2 0]);
L(3) = Link([0 0 L_3 0]);

Robot = SerialLink(L);
Robot.name = 'RRR_ROBOT';

T = [ 1 0 0 PX;
0 1 0 PY;
0 0 1 PZ;
0 0 0 1];

J = Robot.ikine(T, [0 0 0],'mask', [1 1 1 0 0 0]) * 180/pi;


handles.Theta_1.String = num2str(floor(J(1)));
handles.Theta_2.String = num2str(floor(J(2)));
handles.Theta_3.String = num2str(floor(J(3)));

Robot.plot(J*pi/180);

Programación en arduino
/*

serial config:

Board: Arduiono Pro / Pro Mini

Port: tty.usbseriala400eMNr

Programmer: USBtinyISP
*/

// Definitionen

#include <Servo.h> // servo treiber

Servo servo_0;

Servo servo_1;

Servo servo_2;

Servo servo_3;

int sensorPin0 = A0; // Schulter

int sensorPin1 = A1; // Handfind

int sensorPin2 = A2; // Ellbogen

int sensorPin3 = A3; // Zange

int count0, arrayStep, arrayMax, countverz, Taster, stepsMax, steps, time = 1000, del = 1000, temp;

// arraystep = memory what pos in the array

// arrayMax = max steps we safed to array

// countverz = seems to be something to calculate the delay between complete moves

// Taster = Button

// stepsMax = longest way a servo have to travel

// steps = single steps for a move between stored positions

unsigned int verz = 0;

long previousMillis1 = 0;

long previousMillis2 = 0;

long previousMillis3 = 0;

long previousMillis4 = 0;

long previousMicros = 0;
unsigned long currentMillis = millis();

unsigned long currentMicros = micros();

// arrays

int Delay[7] = {0,0,1,3,15,60,300}; // array to map gripper pot to delay in seconds

int SensVal[4]; // sensor value

float dif[4], ist[4], sol[4], dir[4]; // difference between stored position and momentary position

int joint0[180];// array for servo(s)

int joint1[180];

int joint2[180];

int joint3[180];

int top = 179; // we should not write over the end from a array

// status

boolean playmode = false, Step = false;

void setup()

pinMode(4, INPUT); // sets the digital pin 4 as input

pinMode(6, INPUT);

pinMode(13, OUTPUT); // sets the digital pin 13 as outtput

digitalWrite(13, HIGH); // sets the LED on

servo_0.attach(3); // attaches the servo

servo_1.attach(10);

servo_2.attach(9);

servo_3.attach(11);

Serial.begin(115200); // Baudrate have to be same on the IDE

Serial.println("mini robot ready...");

//delay(1000);
digitalWrite(13, LOW);

void loop() // here we go!

currentMillis = millis(); // all is about timing

currentMicros = micros();

// read the button

Button();

if(!playmode) // manualy modus

if(currentMillis - previousMillis1 > 25) // 25miliseconds until next manual mode update

if (arrayStep < top)

previousMillis1 = currentMillis; //reset

readPot(); // get the value from potentiometers

mapping(); // map to milliseconds for servos

move_servo(); // setz newservo position

//record();

} // end counter < max

} // end step check

} // ende manualy move

else if(playmode) // play

{
if (Step) // next step read from array

digitalWrite(13, HIGH); //LED

if (arrayStep < arrayMax) // we not reach the end from stored data

arrayStep += 1; // next array pos

Read(); // from the arrays

calculate(); // find biggest travel distance and calculate the other 3 servos (the have to do
smaler steps to be finished at same time!)

Step = 0;

digitalWrite(13, LOW);

else // array read finished > start over

arrayStep = 0; //

calc_pause(); // delay between moves read from potentiometer

countverz = 0; // used for the delay

while(countverz < verz) // verz = time getting from calc_pause();

{ // here we do loop and wait until next start over

countverz += 1;

calc_pause();

digitalWrite(13, HIGH); delay(25);

digitalWrite(13, LOW); delay(975);

//Serial.println(arrayStep);

else // do the servos!

{
if (currentMicros - previousMicros > time) // here we do a single micro step

{ //

previousMicros = currentMicros;

play_servo();

}// ende playmode

// ---------------------------------------------------------------------------------Hardware pause switch PIN 6

while (digitalRead(4) == false)

digitalWrite(13, HIGH); delay(500);

digitalWrite(13, LOW); delay(500);

// ---------------------------------------------------------------------------------- Textout serial

// serial ausgabe 1 sek

/*if(currentMillis - previousMillis2 > 5000)

previousMillis2 = currentMillis;

/*count0 = 0;

while(count0 < 4)

int val = SensVal[count0];

// val = map(val, 142, 888, 0, 180);

Serial.println(val);

//Serial.println("test");

count0 += 1;

}
Serial.println(playmode);

Serial.println(arrayStep);

Serial.println(arrayMax);

Serial.println(" ");

}*/

// ---------------------------------------------------------------------------------------- sub routinen

void calc_pause() // read pot and map to usable delay time after a complete move is done

readPot();

temp = SensVal[3];

if (temp < 0) temp = 0;

temp = map(temp, 0, 680, 0 ,6);

verz = Delay[temp]; // verz = delay in second

/*Serial.print(temp);

Serial.print(" ");

Serial.print(verz);

Serial.print(" ");

Serial.println(countverz);*/

void readPot() // read analog inputs and add some offsets (mechanical corrections)

SensVal[0] = analogRead(sensorPin0); //SensVal[0] += -10; // rotate

SensVal[1] = analogRead(sensorPin1); //SensVal[1] += 280; // Shoulder

SensVal[2] = analogRead(sensorPin2); //SensVal[2] += -50; // hand

SensVal[3] = analogRead(sensorPin3); // SensVal[3] += 0;// gripper


Serial.print(SensVal[2]);Serial.print(" "); // CHECK

void mapping() // we need microsecond for the servos instead potentiometer values

ist[0] = map(SensVal[0], 150, 900, 600, 2400);// drehen

ist[1] = map(SensVal[1], 1000, 100, 550, 2400);// Schulter

ist[2] = map(SensVal[2], 120, 860, 400, 2500);// Hand

ist[3] = map(SensVal[3], 1023, 0, 500, 2500);// Zange

Serial.println(ist[2]); // CHECK

void record()

joint0[arrayStep] = ist[0]; // write positions in servo array

joint1[arrayStep] = ist[1];

joint2[arrayStep] = ist[2];

joint3[arrayStep] = ist[3];

void Read()

sol[0] = joint0[arrayStep]; // read from the array

sol[1] = joint1[arrayStep];

sol[2] = joint2[arrayStep];

sol[3] = joint3[arrayStep];

void move_servo()

servo_0.writeMicroseconds(ist[3]); // send milissecond values to servos

servo_1.writeMicroseconds(ist[2]);
servo_2.writeMicroseconds(ist[0]);

servo_3.writeMicroseconds(ist[1]);

// ------------------------------------------------------------ single steps calculating

void calculate()

// travel distance for each servo

dif[0] = abs(ist[0]-sol[0]);

dif[1] = abs(ist[1]-sol[1]);

dif[2] = abs(ist[2]-sol[2]);

dif[3] = abs(ist[3]-sol[3]);

// biggest travel way from all 4 servos

stepsMax = max(dif[0],dif[1]);

stepsMax = max(stepsMax,dif[2]);

stepsMax = max(stepsMax,dif[3]);

// stepsMax is the biggest distance a servo have to do beween momentary position and new
pos read from the array

//Serial.println(stepsMax);

if (stepsMax < 500) // del(ay) between a single step is bigger is move is smaler. just looks cool

del = 1200;

else

del = 600;

// calculating single (micro) step for each servo

// need that to do move all servos in a loop (stepsMax times done) with different values.
// This makes all servos have done the traveling distance at same time

if (sol[0] < ist[0]) dir[0] = 0-dif[0]/stepsMax; else dir[0] = dif[0]/stepsMax;

if (sol[1] < ist[1]) dir[1] = 0-dif[1]/stepsMax; else dir[1] = dif[1]/stepsMax;

if (sol[2] < ist[2]) dir[2] = 0-dif[2]/stepsMax; else dir[2] = dif[2]/stepsMax;

if (sol[3] < ist[3]) dir[3] = 0-dif[3]/stepsMax; else dir[3] = dif[3]/stepsMax;

//Serial.println(dir4);

void play_servo()

steps += 1;

if (steps < stepsMax) // sure we not reach the end from a move

//time = del*5;// anfahr rampe

if(steps == 20) time = del*4; // ramp up

else if(steps == 40) time = del*3; // time is the delay in microsecns we wait in the mainloop
until

else if(steps == 80) time = del*2; // a micro step will be done

else if(steps == 100) time = del-1; // cannot explain here is not del*1

if(steps == stepsMax-200) time = del*2; // stop ramp down (200 microsteps before end time
will be increased

else if(steps == stepsMax-80) time = del*3;

else if(steps == stepsMax-40) time = del*4;

else if(steps == stepsMax-20) time = del*5;

ist[0] += dir[0]; // set new pos

ist[1] += dir[1];

ist[2] += dir[2];
ist[3] += dir[3];

servo_0.writeMicroseconds(ist[3]); // Zange //anschlüsse gemappt!

servo_1.writeMicroseconds(ist[2]); // Hand

servo_2.writeMicroseconds(ist[0]); // Schulter

servo_3.writeMicroseconds(ist[1]); // Ellbogen

else

Step = 1; // next step aus array lesen

steps = 0; // servo zwischenschritte

void data_out() // just to write the recorded data to serial

int i = 0;

while(i < arrayMax)

digitalWrite(13, HIGH);

i += 1;

Serial.print(joint0[i]); Serial.print(", ");

Serial.println("Joint0");

i = 0;

while(i < arrayMax)

digitalWrite(13, HIGH);
i += 1;

Serial.print(joint1[i]); Serial.print(", ");

Serial.println("Joint1");

i = 0;

while(i < arrayMax)

digitalWrite(13, HIGH);

i += 1;

Serial.print(joint2[i]); Serial.print(", ");

Serial.println("Joint2");

i = 0;

while(i < arrayMax)

digitalWrite(13, HIGH);

i += 1;

Serial.print(joint3[i]); Serial.print(", ");

Serial.println("Joint3");

void Button() // check buttons for single and doubleclick

if (digitalRead(6) == false)

delay(1);

if (digitalRead(6) == true) // taster losgelassen


{

if (Taster == 0)

Taster = 1;

previousMillis3 = currentMillis;

//Serial.print("Status Record "); Serial.println(Taster);

else if ((Taster == 1) && (currentMillis - previousMillis3 < 250))

Taster = 2;

//Serial.println(Taster);

/*else if ((Taster == 2) && (currentMillis - previousMillis3 < 500))

Taster = 3;

Serial.println(Taster);

}*/

if ((Taster == 1) && (currentMillis - previousMillis3 > 1000)) // write to array

arrayStep += 1;

arrayMax = arrayStep;

record();

Taster = 0;

playmode = false;

Serial.print("Record Step: "); Serial.println(arrayStep);


digitalWrite(13, HIGH);

delay(100);

digitalWrite(13, LOW);

else if (Taster == 2)

arrayStep = 0;

playmode = true;

Taster = 0;

Step = 1;

Serial.println("playmode ");

data_out();

delay(250);

digitalWrite(13, LOW);

/*if (Taster == 3)

// ++ arrayStep

// playmode = 1;

Taster = 0;

Serial.println("Clear ");

}*/

if (currentMillis - previousMillis3 > 2000) // button Status clear

Taster = 0;

//Serial.println("restart ");

}
Evidencias

Piezas impresas en 3D
Ensamblaje de piezas en soliworks y físico
Conclusión

En conclusión en este proyecto se utilizaron los conocimientos en la materia sacando las tramas del
brazo así como el cálculo del efector final y la cinemática inversa esto no ayudo a realizar todo el
análisis necesario para la elaboración del brazo, también se utilizo el conocimiento de Matlab
impartido por el profesor para diseñar una comprobación en Matlab, el proyecto tuvo sus
contratiempos por material defectuoso o por error a la hora de calibrar el brazo ya que las piezas
impresas fueron diseñadas específicamente para nuestros materiales, dando como resultado un
proyecto exitoso como conclusión del curso.
BIBLIOGRAFIA

http://www.ee.ic.ac.uk/pcheung/teaching/DE1_EE/stores/sg90_datasheet.pdf

https://electronilab.co/tienda/micro-servo-9g-towerpro/

http://www.areatecnologia.com/electricidad/resistencia-electrica.html

http://www.abc.com.py/edicion-impresa/suplementos/escolar/tecnologia-de-los-pulsadores-e-
interruptores-904222.html

http://www.ingmecafenix.com/electronica/potenciometro/

https://components101.com/potentiometer

http://irishelectronics.ie/10K-16mm-Linear-Potentiometer

https://arduino.cl/arduino-nano/

Vous aimerez peut-être aussi