Proyecto Mano Robotica

1

description

Este es un proyecto sencillo de una mano robotica en una FPGA

Transcript of Proyecto Mano Robotica

Page 1: Proyecto Mano Robotica

Electrónica y Telecomunicaciones

UNIVERSIDAD TÉCNICA PARTICULAR DE LOJA

SISTEMAS DIGITALES AVANZADOS

Proyecto Bimestral- Mano Robótica

Profesor:

Ing. Carlos Carrión

Integrantes: Byron Ganazhapa Franklin Obaco

Ciclo:

5to “A”

Fecha:

Sábado, 15 de Enero de 2011

Page 2: Proyecto Mano Robotica

Electrónica y Telecomunicaciones

TEMA:

Mano Robótica controlada mediante un FPGA.

Objetivo General: Manipulación y control del movimiento giratorio de servomotoresaplicados al prototipo “Mano Robótica” usando el FPGA Spartan 3-Emodelo XC3S500E. Objetivos Específicos:

1. Generación de una señal PWM para el control de las articulaciones delprototipo (servomotores).

2. Manipulación de las articulaciones del prototipo mediante unaplataforma manual lógica (Placa PCB, diseño adicional).

Componentes delPrototipo Mano-Robótica

La descripción de los componentes del prototipo mano-robótica se muestran gráficamente en la fig. 1, donde se incluye un diagrama funcional del mismo.

Fig. 1Componentes del Sistema

Descripción de Componentes del Prototipo-Mano Robótica

1. Bloque Estructura-Mano Robótica La mano robótica básicamente encoge y se estira sus articulaciones momentáneamente. Estos movimientos son permitidos por medio de los switches de la tarjeta – usados para el estiramiento- y por medio de los pulsadores de la placa PCB –para el encogimiento-. Además estos movimientos

Page 3: Proyecto Mano Robotica

Electrónica y Telecomunicaciones

son momentáneos es decir, suceden cuando el estado lógico de activación proveniente tanto de los switches como de los pulsadores se habilita. En la fig. 2 se muestra la estructura del prototipo de la mano robótica.

Fig. 2 Estructura Mano-Robótica

En la fig 2.1 se muestra la estructura real de la mano robótica.

Fig. 2.1 Estructura física del Prototipo Mano-Robótica

2. Bloque FPGA Usamos el FPGA de la familia Spartan 3e, dispositivo XC3S1200E, con paquete FG320, con velocidad de -4. La misma se muestra e la fig. 3. El FPGA programa a la tarjeta de tal manera que nos permite encoger y estirar las articulaciones de la mano-robótica deacuerdo a como el usuario decida.

Page 4: Proyecto Mano Robotica

Electrónica y Telecomunicaciones

Fig. 3Spartan xc3s1200e

a. Señales PWM

En esta fase describiremos el software implementado. Para poder implementar la modulación por ancho de pulso usando el Software Xilinxs (ISE vs 8.1), se realizó lo siguiente: Establecimos una entidad “ser”, en donde como entradas de tipo

std_logic son declaradas -clk,a,b,c,d,e-.Además, se establece las variables -servo1, servo2, servo3, servo4, servo5- del mismo tipo como salidas.

Creamos un contador ascendente el mismo que se incremente en cada transición de flanco positivo.

Finalmente, asignamos la propiedad a cada entrada de ocupar uno de dos estados lógicos (1 o 0 lógico). Estas entradas son asignadas a dipswitches. Así, dependiendo de un 1 lógico lo que hará el programa es llevar el contador hacia un valor seteado de conteo y luego regresar a la posición inicial seteadas ambas con anterioridad.

b. Tiempo del Contador

Si tenemos en cuenta que la tarjeta Spartan de Xilinxs Xc3s500E, posee

un reloj interno de 50MHz, deducimos un periodo total de .

Debido a que el servomotor usado S0208, tiene las siguientes

características deacuerdo a [1], sabemos que:

Para girar el servomotor a 00 necesitamos una señal con un TH=0,5ms.

De manera similar para:

450, un TH=1ms

900, un TH=1,5ms

1800, un TH=2,5ms

Page 5: Proyecto Mano Robotica

Electrónica y Telecomunicaciones

Así, el valor máximo hasta donde el contador debe llegar, viene dado por

la expresión 1

Adicionalmente, debido a que el servomotor trabaja a 60Hz, el valor de

(60Hz-1–TH) es lo que colocamos en la sentencia en donde una entrada

(dipswitch) adquiere un 0 lógico. Luego, para la generación de nuestro

código nos basamos en [1].

A continuación se presenta el código usado en nuestro programa:

CÓDIGO PWM

---------------------------------------------------------------------------------- ---------------------------------------------------------------------------------- -- Unversidad Técnica Particular de Loja -- -- Proyecto de Sistemas Digitales Avanzados -- -- Realizado por franklin Obaco y Byron Ganazhapa -- ---------------------------------------------------------------------------------- ---------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity mano_5 is Port ( a1,b1,c1,d1,e1,a2,b2,c2,d2,e2,enc,clk: in STD_LOGIC; servo1, servo2, servo3,servo4,servo5,sal : out STD_LOGIC); end mano_5; architecture Behavioral of mano_5 is signal t : STD_LOGIC_VECTOR (27 downto 0);

signalcont : STD_LOGIC_VECTOR (27 downto 0); signalreg: STD_LOGIC_VECTOR (2 downto 0); signalhab: STD_LOGIC; begin process (clk) begin if (clk'event and clk='1')then t <= t + 1; cont<= cont + 1; ------------------------------------------------------------------------------------------------------------------- --habilitacion de los servos if (enc = '1') then casehab is when '1'=> if (t>=x"61A8")then sal<= '0'; end if; If (t = x"00AC1E8")then t <= x"0000000"; sal<= '1'; end if; when others => end case; end if;

Page 6: Proyecto Mano Robotica

Electrónica y Telecomunicaciones

------------------------------------------------------------------------------------------------------------------- -- Control del servomotor 1 if (a1= '1') then casereg is when "000"=> if(t>=x"61A8")then servo1 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo1 <= '1'; end if; reg<= "001"; when "001" => if (t>=x"C350")then servo1 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo1 <= '1'; end if; reg<= "010"; when "010" => if (t>=x"124F8")then servo1 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo1 <= '1'; end if; reg<= "011"; when "011" => if (t>=x"186A0")then servo1 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo1 <= '1'; end if; when others => if (t>=x"1E848")then servo1 <= '0'; end if; if (t = x"00AC1E8")then

t <= x"0000000"; servo1 <= '1'; end if; end case; end if; if (a2= '1') then casereg is when "000"=> if (t>=x"1E848")then servo1 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo1 <= '1'; end if; reg<= "001"; when "001" => if (t>=x"186A0")then servo1 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo1 <= '1'; end if; reg<= "010"; when "010" => if (t>=x"124F8")then servo1 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo1 <= '1'; end if; reg<= "011"; when "011" => if (t>=x"C350")then servo1 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo1 <= '1'; end if; when others => if (t>=x"61A8")then servo1 <= '0'; end if; if (t = x"00AC1E8")then

Page 7: Proyecto Mano Robotica

Electrónica y Telecomunicaciones

t <= x"0000000"; servo1 <= '1'; end if; end case; end if; ------------------------------------------------------------------------------------------------------------------- -- Control del servomotor 2 if (b1= '1') then case reg is when "000"=> if (t>=x"61A8")then servo2 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo2 <= '1'; end if; reg<= "001"; when "001" => if (t>=x"C350")then servo2 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo2 <= '1'; end if; reg<= "010"; when "010" => if (t>=x"124F8")then servo2 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo2 <= '1'; end if; reg<= "011"; when "011" => if (t>=x"186A0")then servo2 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo2 <= '1'; end if; when others => if (t>=x"1E848")then servo2 <= '0';

end if; if (t = x"00AC1E8")then t <= x"0000000"; servo2 <= '1'; end if; end case; end if; if (b2= '1') then case reg is when "000"=> if (t>=x"1E848")then servo2 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo2 <= '1'; end if; reg<= "001"; when "001" => if (t>=x"186A0")then servo2 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo2 <= '1'; end if; reg<= "010"; when "010" => if (t>=x"124F8")then servo2 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo2 <= '1'; end if; reg<= "011"; when "011" => if (t>=x"C350")then servo2 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo2 <= '1'; end if; when others => if (t>=x"61A8")then servo2 <= '0'; end if;

Page 8: Proyecto Mano Robotica

Electrónica y Telecomunicaciones

if (t = x"00AC1E8")then t <= x"0000000"; servo2 <= '1'; end if; end case; end if; ------------------------------------------------------------------------------------------------------------------- -- Control del servomotor 3 if (c1= '1') then case reg is when "000"=> if (t>=x"1E848")then servo3 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo3 <= '1'; end if; reg<= "001"; when "001" => if (t>=x"186A0")then servo3 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo3 <= '1'; end if; reg<= "010"; when "010" => if (t>=x"124F8")then servo3 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo3 <= '1'; end if; reg<= "011"; when "011" => if (t>=x"C350")then servo3 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo3 <= '1'; end if; when others => if (t>=x"61A8")then

servo3 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo3 <= '1'; end if; end case; end if; if (c2= '1') then case reg is when "000"=> if (t>=x"61A8")then servo3 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo3 <= '1'; end if; reg<= "001"; when "001" => if (t>=x"C350")then servo3 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo3 <= '1'; end if; reg<= "010"; when "010" => if (t>=x"124F8")then servo3 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo3 <= '1'; end if; reg<= "011"; when "011" => if (t>=x"186A0")then servo3 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo3 <= '1'; end if; when others => if (t>=x"1E848")then servo3 <= '0';

Page 9: Proyecto Mano Robotica

Electrónica y Telecomunicaciones

end if; if (t = x"00AC1E8")then t <= x"0000000"; servo3 <= '1'; end if; end case; end if; ------------------------------------------------------------------------------------------------------------------- -- Control del servomotor 4 if (d1= '1') then case reg is when "000"=> if (t>=x"1E848")then servo4 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo4 <= '1'; end if; reg<= "001"; when "001" => if (t>=x"186A0")then servo4 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo4 <= '1'; end if; reg<= "010"; when "010" => if (t>=x"124F8")then servo4 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo4 <= '1'; end if; reg<= "011"; when "011" => if (t>=x"C350")then servo4 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000";

servo4 <= '1'; end if; when others => if (t>=x"61A8")then servo4 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo4 <= '1'; end if; end case; end if; if (d2= '1') then case reg is when "000"=> if (t>=x"61A8")then servo4 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo4 <= '1'; end if; reg<= "001"; when "001" => if (t>=x"C350")then servo4 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo4 <= '1'; end if; reg<= "010"; when "010" => if (t>=x"124F8")then servo4 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo4 <= '1'; end if; reg<= "011"; when "011" => if (t>=x"186A0")then servo4 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000";

Page 10: Proyecto Mano Robotica

Electrónica y Telecomunicaciones

servo4 <= '1'; end if; when others => if (t>=x"1E848")then servo4 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo4 <= '1'; end if; end case; end if; ------------------------------------------------------------------------------------------------------------------- -- Control del servomotor 5 if (e1= '1') then case reg is when "000"=> if (t>=x"124F8")then servo5 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo5 <= '1'; end if; reg<= "001"; when "001" => if (t>=x"186A0")then servo5 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo5 <= '1'; end if; reg<= "010"; when "010"=> if (t>=x"1E848")then servo5 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo5 <= '1'; end if; when others=> if (t>=x"1E848")then servo5 <= '0';

end if; if (t = x"00AC1E8")then t <= x"0000000"; servo5 <= '1'; end if; end case; end if; if (e2= '1') then case reg is when "000"=> if (t>=x"1E848")then servo5 <= '0'; end if; if (t = x"00AC1E8")then t<= x"0000000"; servo5 <= '1'; end if; reg<= "001"; when "001" => if (t>=x"186A0")then servo5 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo5 <= '1'; end if; reg<= "010"; when "010"=> if (t>=x"124F8")then servo5 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo5 <= '1'; end if; when others => if (t>=x"124F8")then servo5 <= '0'; end if; if (t = x"00AC1E8")then t <= x"0000000"; servo5 <= '1'; end if; end case; end if;

Page 11: Proyecto Mano Robotica

Electrónica y Telecomunicaciones

------------------------------------------------------------------------------------------------------------------- end if; end process;

end Behavioral;

Fig. 4 Código PWM, generado en Xilinx- ISE 8.1

3. Bloque Servomotores Este bloque describe los servomotores usados para la aplicación presente, estos son los servomotores Hs311 de HITECH, los cuales tienen un torque de 3kg/cm. Su posicionamientova de -900 a +900 –demás características, se citan en su hoja de especificaciones [2]-. En la fig. 5 se muestra un servomotor de este tipo.

Fig.5 Servomotor Hs311, de Hitech

3. Bloque Circuito adicional-Placa PCB

De la placa PCB, controlamos el encogimiento momentáneo de las articulaciones, la misma se muestra en la fig. 6.

Page 12: Proyecto Mano Robotica

Electrónica y Telecomunicaciones

Fig. 6 Placa PCB

CONCLUSIONES

La Generación de PWM, permite controlar el giro de los servomotores en base a una señal

proveniente de un contador, la misma que implica alcanzar el tiempo necesario del ancho de un pulso

positivo de una señal rectangular.

Debido a que por medio del lenguaje VHDL, se hace una descripción de hardware, esto permite que

el proceso sea más comprensible. Nos referimos a la generación del código usado.

Fotos:

Page 13: Proyecto Mano Robotica

Electrónica y Telecomunicaciones

Page 14: Proyecto Mano Robotica

Electrónica y Telecomunicaciones

Page 15: Proyecto Mano Robotica

Electrónica y Telecomunicaciones