viernes, 17 de junio de 2016

Proyecto 9. Juego de equilibrio

Este proyecto consiste en construir y programar un juego que consiste en hacer girar una bola por unas guías hasta completar el recorrido y caer.

Juego de equilibrio
Para ello consta de:

1 Placa Picaxe 18M2+

Placa Picaxe y regulador a 5v casero

1 Servomotor que nos permite el giro de la plataforma con unos alambreas a ambos extremos.

Servomotor

1 Potenciómetro de 100K que va a ser el encargado de hacer variar los valores de la entrada analógica y así cambiar el ángulo de giro.

Potenciómetro

El esquema de conexiones en la placa es:

Esquema de conexiones


El funcionamiento del proyecto se muestra en el siguiente vídeo:




El código empleado para su programación es:

Inicio:
readadc C.1, b0
DEBUG b4
if b0>87 and b0<95 then goto girarA
if b0>95 and b0<105 then goto girarB
if b0>105 and b0<111 then goto girarC
if b0>111 and b0<117 then goto girarD
if b0>117 and b0<130 then goto girarE
if b0>130 and b0<137 then goto girarF
if b0>137 and b0<143 then goto girarG
if b0>143 and b0<150 then goto girarH
if b0>150 and b0<156 then goto girarI
if b0>156 and b0<162 then goto girarJ
if b0>162 and b0<169 then goto girarK
if b0>169 and b0<180 then goto girarL

if b0>180 and b0<186 then goto girarM
if b0>186 and b0<192 then goto girarN
if b0>192 and b0<197 then goto girarX
if b0>197 and b0<203 then goto girarO
if b0>203 and b0<208 then goto girarP
if b0>208 and b0<214 then goto girarQ
if b0>214 and b0<220 then goto girarR
if b0>220 and b0<225 then goto girarS
if b0>225 and b0<230 then goto girarT
if b0>230 and b0<236 then goto girarU
if b0>236 and b0<245 then goto girarV
if b0>245 and b0<250 then goto girarW
goto inicio

girarA:
Servo 4,87
pause 100
goto inicio
girarB:
Servo 4,95
pause 100
goto inicio
girarC:
Servo 4,105 
pause 100
goto inicio
girarD:
Servo 4,111 
pause 100
goto inicio
girarE:
Servo 4,117
pause 100
goto inicio
girarF:
Servo 4,130 
pause 100
girarG:
Servo 4,137
pause 100
goto inicio
girarH:
Servo 4,143
pause 100
goto inicio
girarI:
Servo 4,150 
pause 100
goto inicio
girarJ:
Servo 4,156 
pause 100
goto inicio
girarK:
Servo 4,162 
pause 100
goto inicio
girarL:
Servo 4,169 
pause 100
goto inicio


girarM:
Servo 4,180
pause 100
goto inicio
girarN:
Servo 4,186
pause 100
goto inicio
girarX:
Servo 4,192 
pause 100
goto inicio
girarO:
Servo 4,197
pause 100
goto inicio
girarP:
Servo 4,203 
pause 100
goto inicio
girarQ:
Servo 4,208 
pause 100
girarR:
Servo 4,214
pause 100
goto inicio
girarS:
Servo 4,220 
pause 100
goto inicio
girarT:
Servo 4,225 
pause 100
goto inicio
girarU:
Servo 4,230 
pause 100
goto inicio
girarV:
Servo 4,236 
pause 100
goto inicio
girarW:
Servo 4,245 
pause 100
goto inicio


Proyecto realizado por:


Victor, Daniel y David



miércoles, 1 de junio de 2016

Proyecto 8. Robot Vigilante-Expulsa intrusos

Este proyecto consiste en un artilugio que gira y detecta cualquier objeto que entra en su perímetro, expulsándolo al ser detectado, para ello consta de:


1 Placa picaxe CHI 035


Placa Picaxe CHI035


1 Servomotor para realizar el giro continuo en toda la zona que debemos vigilar.

Servomotor
1 Sensor de infrarrojos analógico montado sobre una base acoplada al servo, que es capaz de determinar la presencia o no de un objeto a partir de los valores que arroja según la distancia del objeto al sensor.


Robot vigilante
Sensor infrarrojos SHARP
1 válvula neumática 3/2 (Electrica-resorte) que permite mediante su activación eléctrica a través de la placa picaxe, poder dar paso a un chorro de aire a 5 bares de presíón proporcionado por un compresor que permite expulsar la caja situada en la zona de vigilancia.


Electroválvula neumática 3/2

Debido a que la electroválvula necesita un voltaje de 12v para sua activación y la placa picaxe proporciona en sus salidas 5v, es necesario incorporar un relé que se activa a través de la placa Picaxe y así con una pila a 12v o una fuente de alimentación podemos alimentar a dicha válvula.


Relé picaxe
Relé

 Así los cables del lado derecho son el positivo, negativo y salida que van a la placa picaxe. Los cables de la izquierda son los que permiten cerrar el circuito que alimentará a la electroválvula con la pila de 12v.

1 compresor para proporcionar el aire a presión (sobre 5Kp/cm2).

Compresor de pistón


Por último, la base sobre la que va montada todo el sistema.

Plataforma de vigilancia





El esquema de montaje sobre la placa picaxe es el siguiente:




conexion sensor y relé placa picaxe


Este es el vídeo demostrativo del funcionamiento del proyecto:



 Estos son los componentes del grupo que ha realizado el proyecto.


Sergio, Joel y Víctor

Código del programa

'Programa:
'Realizar un sistema que permita vigilar una superficie 
'marcada con forma de media luna e impida el acceso a esta.
'Haviendo dividido la zona de vigilancia en 14 zonas deberemos
'mover el sensor de ultrasonidos con un servomotor hacia cada una de las zonas,
'en poco tiempo por zona, para que pueda detectar a cualquier intruso en cualquier parte.


'Declaracion de entradas y salidas:
'sensor_infrarrojos= C.0
'valvula_electroneumatica= B.0
'pulsador= pin5
'servo= B.7

symbol valvula_electroneumatica= B.0
symbol sensor_infrarojos=C.0
symbol pulsador= pin5
'y el servo en la B.7


inicio:
if pulsador= 1 then goto comenzar
goto inicio


comenzar:
position1:
servo B.7, 75
readadc sensor_infrarojos, b0
debug b0
pause 400


if pulsador= 0 then goto inicio

if b0<27 and b0>23 then gosub chorro_de_aire 
goto position2


position2:
servo B.7, 80
readadc sensor_infrarojos, b0
debug b0
pause 400


if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire  
goto position3


position3:
servo B.7, 85
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire

goto position4

position4:
servo B.7, 90
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto position5


position5:
servo B.7, 95
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto position6


position6:
servo B.7, 100
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto position7


position7:
servo B.7, 105
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto position8


position8:
servo B.7, 110
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto position9


position9:
servo B.7, 115
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire  
goto position10


position10:
servo B.7, 120
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto position11


position11:
servo B.7, 125
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto position12


position12:
servo B.7, 130
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire  
goto position13

position13:
servo B.7, 135
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto position14

position14:
servo B.7, 140
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto position15

position15:
servo B.7, 145
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto position16

position16:
servo B.7, 150
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto position17

position17:
servo B.7, 155
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto position18

position18:
servo B.7, 160
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto position19

position19:
servo B.7, 165
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto position20

position20:
servo B.7, 170
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire  
goto position21

position21:
servo B.7, 175
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire  
goto position22

position22:
servo B.7, 180
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto vuelta21

'Regresa al inicio

vuelta21:
servo B.7, 180
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire  
goto vuelta20

vuelta20:
servo B.7, 175
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire  
goto vuelta19

vuelta19:
servo B.7, 170
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire  
goto vuelta18

vuelta18:
servo B.7, 165
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto vuelta17

vuelta17:
servo B.7, 160
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto vuelta16

vuelta16:
servo B.7, 155
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto vuelta15

vuelta15:
servo B.7, 150
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto vuelta14

vuelta14:
servo B.7, 145
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire  
goto vuelta13

vuelta13:
servo B.7, 140
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire  
goto vuelta12

vuelta12:
servo B.7, 135
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto vuelta11

vuelta11:
servo B.7, 130
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto vuelta10

vuelta10:
servo B.7, 125
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto vuelta9

vuelta9:
servo B.7, 120
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto vuelta8

vuelta8:
servo B.7, 115
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto vuelta7

vuelta7:
servo B.7, 110
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto vuelta6

vuelta6:
servo B.7, 105
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire  
goto vuelta5

vuelta5:
servo B.7, 100
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire  
goto vuelta4

vuelta4:
servo B.7, 95
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire  
goto vuelta3

vuelta3:
servo B.7, 90
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto vuelta2

vuelta2:
servo B.7, 85
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto vuelta1

vuelta1:
servo B.7, 80
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto vuelta0

vuelta0:
servo B.7, 75
readadc sensor_infrarojos, b0
debug b0
pause 400

if pulsador= 0 then goto inicio
if b0<27 and b0>23 then gosub chorro_de_aire 
goto position1


chorro_de_aire:
high valvula_electroneumatica
pause 500
low valvula_electroneumatica
pause 500
return