Introduction: Robots With a Beat

I watched a Ted Talk on robots with a sense of feeling. Guy Hoffman shows his newest product, a robot that would "feel the beat of the music" from a docked iPod.I decided that I would make my own. I made a rudimentary version of his robot with a simple little toy horse doll.

Step 1: Get the Materials

You will need the following materials to complete this project:
(If you have any questions on alternative materials ask in the comments below)
  • One flexible toy doll (with limbs what can move)
  • One Arduino (Uno, Mega or similar)
  • Lots of jumper wire
  • One rbg led (optional)
  • One or two servos preferably mini
  • Some string or metal picture frame hanging wire
  • One hot glue gun and sticks or double sided foam tape
  • One Xacto Knife
  • 9v Battery or other Arduino power source
  • One small box to hold the servos
  • 3.3 mm audio jack.(headphone jack)

Step 2: Wiring and Placement

Start by following the schematic or breadboard layout on to a pcb or breadboard. Once you are done with wiring you will have to think about where you are going to put your arduino and the circuit. In my robot I had the motor box (discussed next step) on top of a bigger box with all the components and the arduino. I put my multicolored led in the nose of my doll.

Step 3: The Servos

Now it is time to add the servos. With my doll I placed them so that one servo (with the servo horn sticking out of the box) could pull a string to make the head go up and down with the doll on top of the box. I put the other one inside the box with a metal wire connected to the horn to push and pull the leg to make it tap the beat of the song.

Step 4: Upload the Code

One the last things to do is to upload the code. Based on your number of servos that you have or other specifications to your project you will probably have to play with the code.
#define GREEN 3
#define BLUE 5
#define RED 6
#define delayTime 20

#include <Servo.h> <servo.h>

Servo myservo;
Servo myservo1;
int jackpin = 0;
int val;

void setup()
{
pinMode(GREEN, OUTPUT);
pinMode(BLUE, OUTPUT);
pinMode(RED, OUTPUT);
digitalWrite(GREEN, HIGH);
digitalWrite(BLUE, HIGH);
digitalWrite(RED, HIGH);

myservo.attach(9);
myservo1.attach(6);
}


int redVal;
int blueVal;
int greenVal;


void loop()
{
int redVal = 255;
int blueVal = 0;
int greenVal = 0;
for( int i = 0 ; i < 255 ; i += 1 ){
greenVal += 1;
redVal -= 1;
analogWrite( GREEN, 255 - greenVal );
analogWrite( RED, 255 - redVal );
delay( delayTime );
}
redVal = 0;
blueVal = 0;
greenVal = 255;
for( int i = 0 ; i < 255 ; i += 1 ){
blueVal += 1;
greenVal -= 1;
analogWrite( BLUE, 255 - blueVal );
analogWrite( GREEN, 255 - greenVal );


delay( delayTime );
}

redVal = 0;
blueVal = 255;
greenVal = 0;
for( int i = 0 ; i < 255 ; i += 1 ){
redVal += 1;
blueVal -= 1;
analogWrite( RED, 255 - redVal );
analogWrite( BLUE, 255 - blueVal );


delay( delayTime );
}
if(analogRead(jackpin)>8){
val = analogRead(potpin)*20;
val = map(val, 1023, 0, 0, 179);
myservo.write(val*8-50 );
delay(70) ;
myservo1.write(val*6-70);
delay(500);
}
else if (val>300){
myservo.detach();
myservo1.detach();

}
}</servo.h>
Now you are done! Plug it in to your phone, computer or tablet with your favorite song playing and wach it dance!
123D Circuits Contest

Participated in the
123D Circuits Contest

Supercharged Contest

Participated in the
Supercharged Contest