1. 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
2. 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
3. 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.
4. 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
5. 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
------------------------------------------------------------- signalcont : STD_LOGIC_VECTOR (27 downto
--------------------- 0);
------------------------------------------------------------- signalreg: STD_LOGIC_VECTOR (2 downto 0);
--------------------- signalhab: STD_LOGIC;
-- Unversidad Técnica Particular de Loja --
-- Proyecto de Sistemas begin
Digitales Avanzados --
-- Realizado por franklin Obaco y Byron process (clk) begin
Ganazhapa --
if (clk'event and clk='1')then
------------------------------------------------------------- t <= t + 1;
--------------------- cont<= cont + 1;
------------------------------------------------------------- ---------------------------------------------------
--------------------- -------------------------------------------------------------
library IEEE; ---
use IEEE.STD_LOGIC_1164.ALL; --habilitacion de los servos
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL; if (enc = '1') then
casehab is
when '1'=>
entity mano_5 is if (t>=x"61A8")then
Port ( sal<= '0';
a1,b1,c1,d1,e1,a2,b2,c2,d2,e2,enc,clk: in end if;
STD_LOGIC; If (t = x"00AC1E8")then
servo1, servo2, servo3,servo4,servo5,sal t <= x"0000000";
: out STD_LOGIC); sal<= '1';
end mano_5; end if;
when others =>
architecture Behavioral of mano_5 is end case;
end if;
signal t : STD_LOGIC_VECTOR (27 downto 0);
6. Electrónica y Telecomunicaciones
--------------------------------------------------- t <= x"0000000";
------------------------------------------------------------- servo1 <= '1';
--- end if;
-- Control del servomotor 1 end case;
if (a1= '1') then end if;
casereg is when
"000"=> if (a2= '1') then
if(t>=x"61A8")then casereg is
servo1 <= '0'; when "000"=> if
end if; (t>=x"1E848")then
if (t = x"00AC1E8")then servo1 <= '0';
t <= x"0000000"; end if;
servo1 <= '1'; if (t = x"00AC1E8")then
end if; reg<= t <= x"0000000";
"001"; servo1 <= '1';
when "001" => end if;
if (t>=x"C350")then reg<= "001";
servo1 <= '0'; when "001" => if
end if; (t>=x"186A0")then
if (t = x"00AC1E8")then servo1 <= '0';
t <= x"0000000"; end if;
servo1 <= '1'; if (t = x"00AC1E8")then
end if; t <= x"0000000";
reg<= "010"; servo1 <= '1';
when "010" => end if;
if (t>=x"124F8")then reg<= "010";
servo1 <= '0'; when "010" => if
end if; (t>=x"124F8")then
if (t = x"00AC1E8")then servo1 <= '0';
t <= x"0000000"; end if;
if (t = x"00AC1E8")then
t <= x"0000000";
servo1 <= '1'; servo1 <= '1';
end if; end if;
reg<= "011"; reg<= "011"; when
when "011" => "011" => if
if (t>=x"186A0")then (t>=x"C350")then
servo1 <= '0'; servo1 <= '0';
end if; end if;
if (t = x"00AC1E8")then if (t = x"00AC1E8")then
t <= x"0000000"; t <= x"0000000";
servo1 <= '1'; servo1 <= '1';
end if; end if;
when others => if when others =>
(t>=x"1E848")then if (t>=x"61A8")then
servo1 <= '0'; servo1 <= '0';
end if; end if;
if (t = x"00AC1E8")then if (t = x"00AC1E8")then
7. Electrónica y Telecomunicaciones
t <= x"0000000"; end if;
servo1 <= '1'; if (t = x"00AC1E8")then
end if; end case; t <= x"0000000";
servo2 <= '1';
end if; end if;
--------------------------------------------------- end case;
------------------------------------------------------------- end if;
---
-- Control del servomotor 2 if (b2= '1') then
if (b1= '1') then case case reg is
reg is when when "000"=> if
"000"=> if (t>=x"1E848")then
(t>=x"61A8")then servo2 <= '0';
servo2 <= '0'; end if;
end if; if (t = x"00AC1E8")then
if (t = x"00AC1E8")then t <= x"0000000";
t <= x"0000000"; servo2 <= '1';
servo2 <= '1'; end if;
end if; reg<= "001";
reg<= "001"; when when "001" =>
"001" => if if (t>=x"186A0")then
(t>=x"C350")then servo2 <= '0';
servo2 <= '0'; end if;
end if; if (t = x"00AC1E8")then
if (t = x"00AC1E8")then t <= x"0000000";
t <= x"0000000"; servo2 <= '1';
servo2 <= '1'; end if; end if;
reg<= "010"; reg<= "010";
when "010" => if when "010" => if
(t>=x"124F8")then (t>=x"124F8")then
servo2 <= '0'; servo2 <= '0';
end if; end if;
if (t = x"00AC1E8")then if (t = x"00AC1E8")then
t <= x"0000000"; t <= x"0000000";
servo2 <= '1'; servo2 <= '1';
end if; end if; reg<= "011";
reg<= "011"; when "011" =>
when "011" => if if
(t>=x"186A0")then (t>=x"C350")then
servo2 <= '0'; servo2 <= '0';
end if; end if;
if (t = x"00AC1E8")then if (t = x"00AC1E8")then
t <= x"0000000"; t <= x"0000000";
servo2 <= '1'; servo2 <= '1';
end if; end if; when others
when others => if => if (t>=x"61A8")then
(t>=x"1E848")then servo2 <= '0';
servo2 <= '0'; end if;
8. Electrónica y Telecomunicaciones
if (t = x"00AC1E8")then servo3 <= '0';
t <= x"0000000"; end if;
servo2 <= '1'; end if; if (t = x"00AC1E8")then
end case; t <= x"0000000";
end if; servo3 <= '1';
--------------------------------------------------- end if;
------------------------------------------------------------- end case;
--- end if;
-- Control del servomotor 3
if (c1= '1') then if (c2= '1') then
case reg is case reg is
when "000"=> when "000"=> if
if (t>=x"1E848")then (t>=x"61A8")then
servo3 <= '0'; servo3 <= '0';
end if; end if;
if (t = x"00AC1E8")then if (t = x"00AC1E8")then
t <= x"0000000"; t <= x"0000000";
servo3 <= '1'; servo3 <= '1';
end if; end if;
reg<= "001"; reg<= "001";
when "001" => if when "001" => if
(t>=x"186A0")then (t>=x"C350")then
servo3 <= '0'; servo3 <= '0';
end if; end if;
if (t = x"00AC1E8")then if (t = x"00AC1E8")then
t <= x"0000000"; t <= x"0000000";
servo3 <= '1'; servo3 <= '1'; end if;
end if; reg<= "010";
reg<= "010"; when "010" => if
when "010" => if (t>=x"124F8")then
(t>=x"124F8")then servo3 <= '0';
servo3 <= '0'; end if;
end if; if (t = x"00AC1E8")then
if (t = x"00AC1E8")then t <= x"0000000";
t <= x"0000000"; servo3 <= '1';
servo3 <= '1'; end if; reg<= "011";
end if;
reg<= "011"; when "011" => if
when "011" => (t>=x"186A0")then
if (t>=x"C350")then servo3 <= '0';
servo3 <= '0'; end if;
end if; if (t = x"00AC1E8")then
if (t = x"00AC1E8")then t <= x"0000000";
t <= x"0000000"; servo3 <= '1';
servo3 <= '1'; end if;
end if; when others =>
when others => if (t>=x"1E848")then
if (t>=x"61A8")then servo3 <= '0';
9. Electrónica y Telecomunicaciones
end if; servo4 <= '1';
if (t = x"00AC1E8")then end if;
t <= x"0000000"; when others =>
servo3 <= '1'; if (t>=x"61A8")then
end if; servo4 <= '0';
end case; end if;
end if; if (t = x"00AC1E8")then
t <= x"0000000";
--------------------------------------------------- servo4 <= '1';
------------------------------------------------------------- end if;
--- end case;
-- Control del servomotor 4 end if;
if (d1= '1') then if (d2= '1') then
case reg is case reg is
when "000"=> when "000"=> if
if (t>=x"1E848")then (t>=x"61A8")then
servo4 <= '0'; servo4 <= '0';
end if; end if;
if (t = x"00AC1E8")then if (t = x"00AC1E8")then
t <= x"0000000"; t <= x"0000000";
servo4 <= '1'; servo4 <= '1';
end if; end if;
reg<= "001"; reg<= "001";
when "001" => if when "001" =>
(t>=x"186A0")then if (t>=x"C350")then
servo4 <= '0'; servo4 <= '0';
end if; end if;
if (t = x"00AC1E8")then if (t = x"00AC1E8")then
t <= x"0000000"; t <= x"0000000";
servo4 <= '1'; servo4 <= '1';
end if; end if;
reg<= "010"; reg<= "010";
when "010" => when "010" => if
if (t>=x"124F8")then (t>=x"124F8")then
servo4 <= '0'; servo4 <= '0';
end if; end if;
if (t = x"00AC1E8")then if (t = x"00AC1E8")then
t <= x"0000000"; t <= x"0000000";
servo4 <= '1'; servo4 <= '1';
end if; end if;
reg<= "011"; reg<= "011";
when "011" => when "011" => if
if (t>=x"C350")then (t>=x"186A0")then
servo4 <= '0'; servo4 <= '0';
end if; end if;
if (t = x"00AC1E8")then if (t = x"00AC1E8")then
t <= x"0000000"; t <= x"0000000";
10. Electrónica y Telecomunicaciones
servo4 <= '1'; end if;
end if; if (t = x"00AC1E8")then
when others => if t <= x"0000000";
(t>=x"1E848")then servo5 <= '1';
servo4 <= '0'; end if;
end if; end case;
if (t = x"00AC1E8")then end if;
t <= x"0000000";
servo4 <= '1'; if (e2= '1') then
end if; case reg is
end case; when "000"=> if
end if; (t>=x"1E848")then
--------------------------------------------------- servo5 <= '0';
------------------------------------------------------------- end if;
--- if (t = x"00AC1E8")then
-- Control del servomotor 5 t<= x"0000000";
servo5 <= '1';
if (e1= '1') then end if;
case reg is reg<= "001";
when "000"=> if when "001" => if
(t>=x"124F8")then (t>=x"186A0")then
servo5 <= '0'; servo5 <= '0';
end if; end if;
if (t = x"00AC1E8")then if (t = x"00AC1E8")then
t <= x"0000000"; t <= x"0000000";
servo5 <= '1'; servo5 <= '1';
end if; end if;
reg<= "001"; reg<= "010";
when "001" => if when "010"=> if
(t>=x"186A0")then (t>=x"124F8")then
servo5 <= '0'; servo5 <= '0';
end if; end if;
if (t = x"00AC1E8")then if (t = x"00AC1E8")then
t <= x"0000000"; t <= x"0000000";
servo5 <= '1'; servo5 <= '1';
end if; end if;
reg<= "010"; when others =>
when "010"=> if if (t>=x"124F8")then
(t>=x"1E848")then servo5 <= '0';
servo5 <= '0'; end if;
end if; if (t = x"00AC1E8")then
if (t = x"00AC1E8")then t <= x"0000000";
t <= x"0000000"; servo5 <= '1';
servo5 <= '1'; end if;
end if; end case;
when others=> end if;
if (t>=x"1E848")then
servo5 <= '0';
11. Electrónica y Telecomunicaciones
--------------------------------------------------- end Behavioral;
-------------------------------------------------------------
---
end if;
end process;
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.
12. 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: