Creando un robot humanoide – paso 1: los brazos

Hoy comencé con el armado de una robota humanoide.
Como primer paso me concentré en el armado de los brazos.
Utilicé dos motores para uno de los dos brazos, basándome en la idea de web-robotica.com

¿Cómo lo hice?
Pegando con cinta, atando con alambre, uní los motores al cuerpo (una botella vacía de lavandina), y conecté los motores de la siguiente manera:

  • Cable rojo: positivo
  • Cable marrón: negativo
  • Cable anaranado: pin pwm

Tomé el ejemplo “sweep” del Arduino IDE y lo modifiqué para tres motores, quedando así:

void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
myservo2.attach(10); // attaches the servo on pin 9 to the servo object
myservo3.attach(11); // attaches the servo on pin 9 to the servo object
}

void loop() {
for (pos = 0; pos <= 90; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(25); // waits 15ms for the servo to reach the position
}
for (pos = 0; pos <= 90; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo2.write(pos); // tell servo to go to position in variable 'pos'
delay(25); // waits 15ms for the servo to reach the position
}
for (pos = 90; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(25); // waits 15ms for the servo to reach the position
}
for (pos = 90 ; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo2.write(pos); // tell servo to go to position in variable 'pos'
delay(25); // waits 15ms for the servo to reach the position
}
for (pos = 90 ; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo3.write(pos); // tell servo to go to position in variable 'pos'
delay(25); // waits 15ms for the servo to reach the position
}
for (pos = 0; pos <= 90; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo3.write(pos); // tell servo to go to position in variable 'pos'
delay(25); // waits 15ms for the servo to reach the position
}
}

Los “ojos” son parte de una lectora de CD que desarmé para sacarle el motor.