sábado, 28 de enero de 2012

Arduino 5: Shield Ardurobotronica, muerte de Arduino y fin del proyecto Recly!




He conseguido controlar el brazo ThumbsUp con la placa de control de motores Ardurobotronica. Compre esta porque era la que mejor precio tenia con respecto a lo motores que puede controlar (6).

http://www.juguetronica.com/tienda/detalles/2120/251/robotica/arduino-y-accesorios/ardurobotronica-kit-para-montar-.html

Lo primero que me di cuenta es que no traia documentacion para montar y le faltaba elementos.
Tuve que comprar los componentes. Después de soldarla , la probe en el Arduino con el programa de prueba que traia el manual.


Este era el programa:

int inpuA = 2; // define function INTPUT 1 (IC2)
int inpuB = 12; // define function INTPUT 2 (IC2)
int inpuC = 8; // define function INTPUT 3 (IC2)
int inpuD = 7; // define function INTPUT 4 (IC2)
int pwm1 = 11; // define function ENABLE A (IC2)
int pwm2 = 10; // define function ENABLE A (IC2)
void setup()
{
pinMode (inpuA, OUTPUT); // definir la pa􀁗illa como salida
pinMode (inpuB, OUTPUT); // definir la pa􀁗illa como salida
pinMode (inpuC, OUTPUT); // definir la pa􀁗illa como salida
pinMode (inpuD, OUTPUT); // definir la pa􀁗illa como salida
pinMode (pwm1, OUTPUT); // definir la pa􀁗illa como salida
pinMode (pwm2, OUTPUT); // definir la pa􀁗illa como salida
}
void loop()
{
int i,d ;
i=255; // definir el valor del PWM 0-255 (velocidad)
d=50; // definir el valor del PWM 0-255 (velocidad)
analogWrite(pwm1, i); // Salida del PWM para el ENABLE A (IC2)
digitalWrite (inpuA, HIGH); // Activa el INTPUT 1 (IC2)
digitalWrite (inpuB, LOW); // Desactiva el INTPUT 2 (IC2)
// Resultado del OUT1 = +
// Resultado del OUT2 = -
analogWrite (pwm2, d); // Salida del PWM para el ENABLE B (IC2)
digitalWrite (inpuC, LOW); // Desactiva el INTPUT 3 (IC2)
digitalWrite (inpuD, HIGH); // Activa el INTPUT 4 (IC2)
// Resultado del OUT3 = -
// Resultado del OUT4 = +
}

No funcionaba. Comprobe las soldaduras a contraluz y resulto que habia tres soldaduras mal y una cortocircuitada con otra.Despues de esta prueba el Arduino ya no era reconocido por el ordenador. Mirando el Arduino encontre una mota de estaño, que habria caido de la placa (no estuve soldando con la placa puesta, asi que no se).Esa mota de estaño estaba entre los contactos del chip FTD (el cual se encarga de la conexion Usb). El Arduino ensi seguia ejecutando el ultimo programa que le meti el de prueba. Ahora si funcionaba la placa Ardurobotronica.



Asi que tengo que dar por muerto el Arduino .DEP
Por suerte tenia ekl microkit32, otro microcontrolador 100% compatible con arduino.Con este implemente el seguiente programa:

int inpuA_1 = 11; // define function INTPUT 1 (IC2)
int inpuB_1 = 10; // define function INTPUT 2 (IC2)
int inpuC_1 = 9; // define function INTPUT 3 (IC2)
int inpuD_1 = 6; // define function INTPUT 4 (IC2)
int inpuA_2 = 2; // define function INTPUT 1 (IC2)
int inpuB_2 = 12; // define function INTPUT 2 (IC2)
int inpuC_2 = 8; // define function INTPUT 3 (IC2)
int inpuD_2 = 7; // define function INTPUT 4 (IC2)
int inpuA_3 = 5; // define function INTPUT 1 (IC2)
int inpuB_3 = 3; // define function INTPUT 2 (IC2)
int inpuC_3 = 4; // define function INTPUT 3 (IC2)
int inpuD_3 = 13; // define function INTPUT 4 (IC2)
void setup()
{
Serial.begin(9600);
pinMode (inpuA_1, OUTPUT); // definir la pa􀁗illa como salida
pinMode (inpuB_1, OUTPUT); // definir la pa􀁗illa como salida
pinMode (inpuC_1, OUTPUT); // definir la pa􀁗illa como salida
pinMode (inpuD_1, OUTPUT); // definir la pa􀁗illa como salida
pinMode (inpuA_2, OUTPUT); // definir la pa􀁗illa como salida
pinMode (inpuB_2, OUTPUT); // definir la pa􀁗illa como salida
pinMode (inpuC_2, OUTPUT); // definir la pa􀁗illa como salida
pinMode (inpuD_2, OUTPUT); // definir la pa􀁗illa como salida
pinMode (inpuA_3, OUTPUT); // definir la pa􀁗illa como salida
pinMode (inpuB_3, OUTPUT); // definir la pa􀁗illa como salida
pinMode (inpuC_3, OUTPUT); // definir la pa􀁗illa como salida
pinMode (inpuD_3, OUTPUT); // definir la pa􀁗illa como salida
}
void loop()
{

byte brightness;
byte angulo;
if (Serial.available()) {
brightness = Serial.read();


//IC1
if(brightness == 1){
digitalWrite (inpuA_1, HIGH); // Activa el INTPUT 1 (IC2)
digitalWrite (inpuB_1, LOW); // Desactiva el INTPUT 2 (IC2)
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 40){
digitalWrite (inpuA_1, LOW); // Activa el INTPUT 1 (IC2)
digitalWrite (inpuB_1, HIGH); // Desactiva el INTPUT 2 (IC2)
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 60){
digitalWrite (inpuC_1, HIGH); // Desactiva el INTPUT 3 (IC2)
digitalWrite (inpuD_1, LOW); // Activa el INTPUT 4 (IC2)
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 90){
digitalWrite (inpuC_1, LOW); // Desactiva el INTPUT 3 (IC2)
digitalWrite (inpuD_1, HIGH); // Activa el INTPUT 4 (IC2)
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 120){
digitalWrite (inpuC_1, LOW); // Desactiva el INTPUT 3 (IC2)
digitalWrite (inpuD_1, LOW); // Activa el INTPUT 4 (IC2)
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 91){
digitalWrite (inpuA_1, LOW); // Desactiva el INTPUT 3 (IC2)
digitalWrite (inpuB_1, LOW); // Activa el INTPUT 4 (IC2)
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}



//IC2
if(brightness == 2){
digitalWrite (inpuA_2, HIGH); // Activa el INTPUT 1 (IC2)
digitalWrite (inpuB_2, LOW); // Desactiva el INTPUT 2 (IC2)
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 3){
digitalWrite (inpuA_2, LOW); // Activa el INTPUT 1 (IC2)
digitalWrite (inpuB_2, HIGH); // Desactiva el INTPUT 2 (IC2)
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 4){
digitalWrite (inpuC_2, HIGH); // Desactiva el INTPUT 3 (IC2)
digitalWrite (inpuD_2, LOW); // Activa el INTPUT 4 (IC2)
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 5){
digitalWrite (inpuC_2, LOW); // Desactiva el INTPUT 3 (IC2)
digitalWrite (inpuD_2, HIGH); // Activa el INTPUT 4 (IC2)
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 7){
digitalWrite (inpuC_2, LOW); // Desactiva el INTPUT 3 (IC2)
digitalWrite (inpuD_2, LOW); // Activa el INTPUT 4 (IC2)
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 6){
digitalWrite (inpuA_2, LOW); // Desactiva el INTPUT 3 (IC2)
digitalWrite (inpuB_2, LOW); // Activa el INTPUT 4 (IC2)
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
//IC3
if(brightness == 16){
digitalWrite (inpuA_3, HIGH); // Activa el INTPUT 1 (IC2)
digitalWrite (inpuB_3, LOW); // Desactiva el INTPUT 2 (IC2)
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 12){
digitalWrite (inpuA_3, LOW); // Activa el INTPUT 1 (IC2)
digitalWrite (inpuB_3, HIGH); // Desactiva el INTPUT 2 (IC2)
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 13){
digitalWrite (inpuC_3, HIGH); // Desactiva el INTPUT 3 (IC2)
digitalWrite (inpuD_3, LOW); // Activa el INTPUT 4 (IC2)
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 14){
digitalWrite (inpuC_3, LOW); // Desactiva el INTPUT 3 (IC2)
digitalWrite (inpuD_3, HIGH); // Activa el INTPUT 4 (IC2)
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 7){
digitalWrite (inpuC_2, LOW); // Desactiva el INTPUT 3 (IC2)
digitalWrite (inpuD_2, LOW); // Activa el INTPUT 4 (IC2)
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 15){
digitalWrite (inpuA_3, LOW); // Desactiva el INTPUT 3 (IC2)
digitalWrite (inpuB_3, LOW); // Activa el INTPUT 4 (IC2)
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
}}

Para Processing el de siempre:

import processing.serial.*;
Serial port;
int i;

void setup() {
size(256, 150);
println("Available serial ports:");
println(Serial.list());
port = new Serial(this, Serial.list()[1tt], 9600);
}



//CUIDADO CON LAS MAYUSCULAS

void draw() {
byte prueba;
if (key == 's') {
fill(45);
prueba=40;
port.write(prueba);
}
if (key == 'd') {
fill(90);
prueba=60;
port.write(prueba);
}
if (key == 'f') {
fill(135);
prueba=90;
port.write(prueba);
}
if (key == 'g') {
fill(255);
prueba=120;
port.write(prueba);
}
if (key == 'a') {
fill(0);
prueba=1;
port.write(prueba);
}

if (key == 'w') {
fill(45);
prueba=2;
port.write(prueba);
}
if (key == 'e') {
fill(90);
prueba=3;
port.write(prueba);
}
if (key == 'r') {
fill(135);
prueba=4;
port.write(prueba);
}
if (key == 't') {
fill(255);
prueba=5;
port.write(prueba);
}
if (key == 'q') {
fill(0);
prueba=6;
port.write(prueba);
}
if (key == 'y') {
fill(0);
prueba=7;
port.write(prueba);
}
if (key == 'z') {
fill(0);
prueba=16;
port.write(prueba);
}
rect(25, 25, 50, 50);
if (key == 'x') {
fill(45);
prueba=12;
port.write(prueba);
}
if (key == 'c') {
fill(90);
prueba=13;
port.write(prueba);
}
if (key == 'v') {
fill(135);
prueba=14;
port.write(prueba);
}
if (key == 'b') {
fill(255);
prueba=15;
port.write(prueba);
}



}




Con este controle el bazo ThumbsUp.



También intente seguir con el Proyecto Recly! , pero me he dado cuenta que al no tener motores paso y tener que controlar el movimiento bansandome en encoder hace demasiado complicado que este proyecto se pueda hacer fácilmente con cualquier impresora, por lo que pierde interés realizarlo por haber mucho otros mejores diseños ya disponibles en las web.Por ello doy por concluido el proyecto Recly! Dejo el video:



domingo, 22 de enero de 2012

Arduino 4: Brazo robótico con Arduino



Entre examen y examen he decidido darle un empujoncito a lo del brazo robótico y he estado experimentando con los servos. Este programa seria una ampliación de la cámara robotizada de la entrada Arduino 3.

El programa seria:

Proccesing

import processing.serial.*;
Serial port;
int i;

void setup() {
size(256, 150);
println("Available serial ports:");
println(Serial.list());
port = new Serial(this, Serial.list()[2], 9600);
}



void draw() {
byte prueba;
if (key == 's') {
fill(45);
prueba=40;
port.write(prueba);
}
if (key == 'd') {
fill(90);
prueba=60;
port.write(prueba);
}
if (key == 'f') {
fill(135);
prueba=90;
port.write(prueba);
}
if (key == 'g') {
fill(255);
prueba=120;
port.write(prueba);
}
if (key == 'a') {
fill(0);
prueba=1;
port.write(prueba);
}
rect(25, 25, 50, 50);
if (key == 'w') {
fill(45);
prueba=2;
port.write(prueba);
}
if (key == 'e') {
fill(90);
prueba=3;
port.write(prueba);
}
if (key == 'r') {
fill(135);
prueba=4;
port.write(prueba);
}
if (key == 't') {
fill(255);
prueba=5;
port.write(prueba);
}
if (key == 'q') {
fill(0);
prueba=6;
port.write(prueba);
}


if (key == 'z') {
fill(0);
prueba=16;
port.write(prueba);
}
rect(25, 25, 50, 50);
if (key == 'x') {
fill(45);
prueba=12;
port.write(prueba);
}
if (key == 'c') {
fill(90);
prueba=13;
port.write(prueba);
}
if (key == 'v') {
fill(135);
prueba=14;
port.write(prueba);
}
if (key == 'b') {
fill(255);
prueba=15;
port.write(prueba);
}

rect(50, 25, 50, 50);

}



Arduino

#include


Servo myservo; // crea un objeto tipo servo para controlar el servo
Servo myservo2; // crea un objeto tipo servo para controlar el servo
Servo myservo3; // crea un objeto tipo servo para controlar el servo
int pos = 0; // variable para almacenar la posición del servo

void setup()
{
Serial.begin(9600);
myservo.attach(9); // liga el servo conectado en el pin 9 al objeto servo
myservo2.attach(10); // liga el servo conectado en el pin 9 al objeto servo
myservo3.attach(11); // liga el servo conectado en el pin 9 al objeto servo
}

void loop()
{
byte brightness;
byte angulo;
// check if data has been sent from the computer:
if (Serial.available()) {
// read the most recent byte (which will be from 0 to 255):
brightness = Serial.read();
// set the brightness of the LED:
if(brightness == 1){
angulo=0;
myservo.write(1);
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 40){
angulo=40;
myservo.write(40);
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 60){
angulo=60;
myservo.write(60);
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 90){
angulo=90;
myservo.write(90);
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 120){
angulo=70;
myservo.write(120);
brightness = Serial.read();
delay(30);
brightness = Serial.read();


//Segundo Servo
}
if(brightness == 2){
angulo=45;
myservo2.write(angulo);
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 3){
angulo=90;
myservo2.write(angulo);
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 4){
angulo=120;
myservo2.write(angulo);
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 5){
angulo=180;
myservo2.write(angulo);
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 6){
angulo=1;
myservo2.write(angulo);
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}

//Tercer Servo
if(brightness == 12){
angulo=45;
myservo3.write(angulo);
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 13){
angulo=90;
myservo3.write(angulo);
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 14){
angulo=120;
myservo3.write(angulo);
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 15){
angulo=180;
myservo3.write(angulo);
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
if(brightness == 16){
angulo=1;
myservo3.write(angulo);
brightness = Serial.read();
delay(30);
brightness = Serial.read();
}
}
}


Y el video:



domingo, 8 de enero de 2012

Brazo robotico comercial ThumbsUp!



Con las Navidades llegan los regalos, y a mi esta vez me han regalado un brazo robótico, de la marca ThumbsUp! . Este venia por piezas , así que ha sido entretenido montarlo.




Pagina oficial: http://www.thumbsupworld.co.uk/

El brazo se controla con un pequeño mando que trae. Los actuadores son motores de cc comunes , no llevan encoder ni ningún tipo de finales de carrera.






He decidido "hackearlo", es decir , controlarlo a través de un Arduino. Para ello necesitaba una buena placa de control para los 5 motores que trae. La que mejor precio ofrecía era esta:




http://www.juguetronica.com/tienda/detalles/2120/251/robotica/arduino-y-accesorios/ardurobotronica-kit-para-montar-.html

La había elegido para el proyecto Recly!, pero la probare primero con esto.
En fin, siguiente paso, montar la placa.

Posdata: ¿Alguien sabe porque ultimamente no puedo subir fotografias propias a Blogger?

sábado, 7 de enero de 2012

Película recomendada: WALL-E






WALL·E (siglas de Waste Allocation Load Lifter Earth Class; trad. lit: «Elevador para Asignación de Carga Residual Clase Tierra»

Una película emotiva y aunque sea de animación y puede parecer que por ser para niños no tiene mensaje, lo tiene. Una megacorporación monopolista en conveniencia con un gobierno sea cargado el planeta, un robot que parece el hijo de numero 5 , el de cortocircuito, el único habitante de un planeta muerto y una nave espacial que aparece en medio de una ciudad abandonada cargando con una pequeña sonda con estilo futurista japonesa , tendrán que solucionar el embrollo y volver las aguas a su cauce ¿Se puede pedir más?

Asi que recuerda: ¡COMPRA y GRANDE!


Más información: www.peliculasyonkis.com/pelicula/walle-2008
Seguir @Exergy123