Introduction: Animatronic Singing Pumpkins

This was an idea originally from a friend, that i have bumped to the next level.  The goal is to create singing/ taking pumpkins through the use of an Arduino and Vixen.  We will be using the "Generic Serial" port to align these two awesome resourses.  The Arduino will have to be plugged into a computer during operation, so a laptop is handy.  This is my first instructable, so please comment.

Here is the Finished Product: http://www.youtube.com/watch?v=jn0Bylw9blE&feature=plcp


You will need:

-An Arduino (I used an UNO)
-PCB Prototype Board
-Assorted headers (male and female)
-5V regulator
-.33uf capacitor
-.1uf capacitor
-3 resistors (~600 ohm)
-6 Bright LEDs (for eyes)
-Insulated Wire
-9V battery clip
-9V Battery
-3 styrofoam pumpkins (I used decorative ones from michaels, though we had to hollow them out ourselves)
-3 Servos
-3 plastic knifes
-3 small hinges (I used 1.5'' and 2'')
-Masking and electrical Tape
-Arduino Software
-Vixen Software

Tools

-Hot Glue Gun
-Soldering Iron
-Box Knife
-Carving Tools(if pumpkin isn't hollow)

Step 1: Wiring the Servos/Adruino

The Arduino will not have enough power to run 3 servos at one time.  For this reason, we must use external power, in my case, a 9 volt battery.  Servos function between the range of 4.8 and 6 volts, so i use a 5 volt regulator to be sure not to overload the servos.  Regulators require capacitors to function properly, so i have accounted for that in my schematic.  Make sure that the grounds from both the battery and the arduino are attached!  From my pictures, you can see that I do not have much on my prototyping board.  This is because i use headers.  This is for my convenience.  I can unplug power, the Arduino, the servos, and the LEDs quickly because of this.

Step 2: Carving the Pumpkins

Now for the creative part.  The pumpkins we have were Styrofoam and solid.  This required us to cut them in half, horizontally, and hollow out the insides.  Then we painted the insides orange.  The cut you make when cutting in half will be the shape of the mouth, so plan ahead.  

For the eyes, we didn't carve all the way through to the inside.  After they were cut, we painted the eyes black.  Then We drilled/poke holes through where we wanted the LEDs to be.

Install Small hinges at the back of each pumpkin.

Step 3: Making a Box

This is where you design the base on which your pumpkins will be sitting.  I made a box using plywood for the top and bottom, and 1x2s for three of the sides.  This is where my arduino, board, and battery will sit while in use.  The 4th side was left open for easy access.  We next made steps out of some sound reducing material I had laying around, though Plywood would Work just fine.  Then, we Spray painted the base black, and screwed the pumpkins on into there proper place.  

Step 4: Installing the Servos

We installed our servos on there sides(with hot glue), and hot glued plastic knifes onto them, with excess hanging out for when the mouth opens.  Feed the wires out the back of the pumpkins.  Plug the wires into your homemade board, and hook the Arduino up to it using PWM pins 3, 5, and 6.  Hook the battery up, and double check that the grounds of the arduino and battery are connected in some way.  

Step 5: LEDs

The LED's are fairly self explanatory.  Basically, drill a hole into each eye of each pumpkin, slightly smaller than the LED itself.  Push the LED in through the inside of the pumpkins, and route the wires along the top of the mouth out through the back, and off to your board.    Pictures coming soon.

Step 6: Programming

Okay, so your setup is now complete.  Now its time to make them talk.  Make sure you have both Arduino and Vixen installed on your computer.  Knowing the basics of the arduino language will help a lot.

You will need to start a Vixen Profile specifically for this application.  I suggest 8 channels, as that is what .
 Once setup, adjust the program angles to your pumpkins, as noted in my program.  Default is 45.

Here is the Program that I run, though feel free to experiment with your own:

/*
  This code runs vixen through the arduino, usining pins 3, 5, and 6 with
  3 seperate servos; pins 9, 10, and 11 are used for 3 LED circuits with PWM;
  pins 12, 13 are extra digital pins. 
*/

#include <Servo.h>
Servo Pumpkin1;
Servo Pumpkin2;
Servo Pumpkin3;
int pos = 0;

int Chan1 = 3;     //PWM-Servo 1
int Chan2 = 5;     //PWM-Servo 2
int Chan3 = 6;     //PWM-Servo 3
int Chan4 = 9;     //PWM-Light 1
int Chan5 = 10;    //PWM-Light 2
int Chan6 = 11;    //PWM-Light 3
int Chan7 = 12;     //extra
int Chan8 = 13;    //extra



int i = 0;     // Loop counter
int incomingByte[8];   // array to store the 25 values from the serial port
int val1;
int val2;
int val3;

//setup the pins/ inputs & outputs
void setup()
{
  Serial.begin(9600);   // set up Serial at 9600 bps

  pinMode(Chan1, OUTPUT);
  Pumpkin1.attach(3);
  pinMode(Chan2, OUTPUT);
  Pumpkin2.attach(5);
  pinMode(Chan3, OUTPUT);
  Pumpkin3.attach(6);
  pinMode(Chan4, OUTPUT);
  pinMode(Chan5, OUTPUT);
  pinMode(Chan6, OUTPUT);  
  pinMode(Chan7, OUTPUT);
  pinMode(Chan8, OUTPUT);
}

void loop()
{  // 8 channels are coming in to the Arduino
   if (Serial.available() >= 8) {
    // read the oldest byte in the serial buffer:
    for (int i=0; i<9; i++) {
      // read each byte
      incomingByte[i] = Serial.read();
    }
    //Pumpkin1
    val1 = incomingByte[0];                  
    val1 = map(val1, 0, 255, 0, 45);    //Change the last number according to how far you want the pumpkin to open.
    Pumpkin1.write(val1);                   
    delay(15);                            
    //Pumpkin2
    val2 = incomingByte[1];
    val2 = map(val2, 0, 255, 0, 45);    //Change the last number according to how far you want the pumpkin to open.
    Pumpkin2.write(val2);
    delay(15);
    //Pumpkin3
    val3 = incomingByte[2];
    val3 = map(val3, 0, 255, 0, 45);     //Change the last number according to how far you want the pumpkin to open.
    Pumpkin3.write(val3);
    delay(15);

    analogWrite(Chan4, incomingByte[3]);      //Light 1
    analogWrite(Chan5, incomingByte[4]);      //Light 2
    analogWrite(Chan6, incomingByte[5]);      //Light 3
    digitalWrite(Chan7, incomingByte[6]);       //Extras
    digitalWrite(Chan8, incomingByte[7]);       //Extras
   }
}

Step 7: Final Touches

Make your pumpkins look their best.  At this point, I needed to touch up the paint, both on the foam and the pop sickle sticks(which replaced the plastic knives half way though).  I also covered the servos with orange felt to make them more aesthetically pleasing.  The options are endless, make them awesome.  

Step 8: Get Working

The setup of the pumpkins is now complete.  Time to program the songs using vixen.  This step will take a while, but is totally worth it.  Enjoy!



Halloween Decorations Contest

Participated in the
Halloween Decorations Contest