PUPPET CONTROLLER

PUPPET CONTROLLER
«
  • DSCF5108.JPG
  • DSCF5096.JPG
  • DSCF5100.JPG
  • DSCF5075.JPG
  • IMG_1308closed.JPG
  • DSCF5077.JPG
  • IMG_1317.JPG
  • IMG_1334.JPG
  • IMG_1335.JPG
  • last photo ←
»
Three kinds of motion:  Human, Mechanical,  Animation.  Blend them together to build a puppet controller for the real and virtual world.

Or, Pacman - three ways.

This Instructable includes:
   - Using an adjustable resistor as input to the Arduino Micro-controller
   - Controlling two servo motors from the Arduino
   -Controlling animation on the computer from the Arduino

Here are the basic steps:
    - Servo control with Arduino and potentiometer
   - Replace potentiometer with a flexible sensor
   - Create animation on the computer screen 
   - Setup communication between the computer and Arduino
   - Mount everything in a usable way and test it out!

There are videos, photos, and code along the way.







 
Remove these adsRemove these ads by Signing Up
 

Step 1Servo Code for Arduino

Servo Code for Arduino
Basic setup to controll a motor with Arduino based on input from a sensor.

Parts:
      2 servo motors
      Arduino board ( i have a screw shield on it, but that is not critical)
      Potentiometer (this one is 0 to 100Kohm)
      Jumper wires
     Pipe cleaners (for show).

1 - Wire the servo motors.  These are special motors, you can input an angle and the motor will do it.  The servos have three wires: Power (red, 5V)  - Ground (black)   - Yellow (communication - angle info goes in here).
          In this setup: Red goes the Arduino 5V,  Black goes to Arduino Ground, Yellow will go         to specific input/ouput pins on the Arduino. 
         Servo 1: Yellow -----  Pin 9
        Servo 2: Yellow   -----pin 10

2 - Wire the potentiometer
       This has three leads.
                     Lead 1 ----- 5V
                     Lead 2 ----- Pin 0
                    Lead 3 ------ Ground

3 - Code - 
     The code below is from the Arduino example for servo motor control.  It includes the servo library, which makes it easy to communicate to the servo.
      This also maps (scales) the input from the pot into an angle (in radians) for the servo motor.  We want the two motors to go in opposite directions.  To do this I've translated the the low pot values to the high angle values. 
     You'll lnotice there are some references to 'serial'  - this stuff lets you send data from the Arduino over the USB to the computer.  You can then view the values, this is useful.

NOTE: The instructables editor drops the line to include the servo motor.
It should be like this:
                #include < Servo.h >; //use servo library



Puppet Mouth Controls
   -two servos
  -opposite angles
  -Pot input


////////// Arduino Code ///////////////
//This is from an example inluded with Arduino IDE download.
//    Controlling a servo position using a potentiometer (variable resistor)
//    by Michal Rinott
//MPC - added serial output 'n stuff

/*
Here is the wiring:

Wiring -
|------Arduino Gnd
Encoder |------Analog 0
|------Arduino 5V

| Yellow ------ Digi 9 (PWM)
Top servo | Red -----------5V
| Brown -------Gnd

| Yellow ------ Digi 10 (PWM)
Bottom servo | Red -----------5V
| Brown ------


*/
#include < Servo.h >;               //use servo library

Servo myservo; // create servo object to control a servo
Servo otherServo ;

int potpin = 0; // analog pin used to connect the potentiometer
int val; // variable to read the value from the analog pin
int valComp;

void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
otherServo.attach(10);
Serial.begin(9600);
}

void loop()
{
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
valComp = analogRead(potpin);
Serial.println(val);
val = map(val, 0, 1023, 90, 179); // scale it to use it with the servo (value between 0 and 180)
valComp = map(valComp, 1023, 0, 0, 90);
myservo.write(val); // sets the servo position according to the scaled value
delay(15);
otherServo.write(valComp);
delay(25); // waits for the servo to get there
}
 
« Previous StepDownload PDFView All StepsNext Step »
6 comments
Aug 20, 2011. 2:55 PMêH says:
Great example.
Feb 3, 2011. 2:58 PMDumchicken says:
waka waka waka waka waka waka waka waka waka waka
Jan 29, 2011. 6:29 PMxyz0zero says:
so cute~
Jan 8, 2011. 1:43 PMmagicpocket says:
Love it.
Dec 2, 2010. 6:20 AMGreasetattoo says:
GREAT instructable..
Really enjoyed it!

Just trying to think of what else could be done with it!
Nov 28, 2010. 7:05 PMcowscankill says:
That is one of the coolest things I have seen. I really need to learn how to program.

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
29
Followers
13
Author:marc.cryan