Animatronic Talking Takeout Container
Intro: Animatronic Talking Takeout Container
The animatronic talking takeout container is a fun little toy that is good for hours of amusement. This idea came about after having taken a special effects film class when I was in college. While in the class, I made a short film of myself talking to a takout container with a face drawn on it. However, not having the know-how to do anything with electronics, the initial version was being controlled by a friend pulling upon and releasing a thin fishing line. While I do not doubt that my friend was skilled at controlling the lid in this manner, I couldn't help but thinking that it would be great if I could automate the whole thing -- at the very least -- less embarassing. Even though more than a decade has passed and I no longer have much desire to be an experimental filmmaker, this idea has lingered with me. I always tell people that if given enough time, I will finish any project I start. Thus, I have finally made this long-time dream of having conversations with an autonomous takeout container a reality.
STEP 1: Go Get Stuff
You will need:
(x1) Arduino Mega (Radioshack #276-127)
(x1) Seeed Studio Music Shield v1.0
(x1) 2GB (or less) micro SD card
(x1) PC Board (Radioshack #276-150)
(x1) LM741 op amp (Radioshack #276-007)
(x1) LM386 amplifier (Radioshack #276-1731)
(x1) 470K resistor (Radioshack #271-1133)
(x2) 100K resistor (Radioshack #271-1131)
(x2) 10K resistor (Radioshack #271-1126)
(x1) 1K resistor (Radioshack #271-1118)
(x1) 220uF capacitor (Radioshack #272-1029)
(x1) 10uF capacitor (Radioshack #272-1025)
(x3) 0.1uF capacitor (Radioshack #272-135)
(x1) 10K trimmer (Radioshack #271-282)
(x1) Speaker (Radioshack #273-092)
(x1) Standard servo (Radioshack #273-766)
(x1) M-type plug (Radioshack #274-1569)
(x1) 8 x AA battery holder (Radioshack #270-387)
(x8) AA batteries (Radioshack #23-1582)
(x1) 6" x 6" x 1/8" clear acrylic square
(x1) Fake food (of your choosing)
(x1) Takeout container
(x2) Googily eyes
(x1) Assorted zip ties
(x1) Arduino Mega (Radioshack #276-127)
(x1) Seeed Studio Music Shield v1.0
(x1) 2GB (or less) micro SD card
(x1) PC Board (Radioshack #276-150)
(x1) LM741 op amp (Radioshack #276-007)
(x1) LM386 amplifier (Radioshack #276-1731)
(x1) 470K resistor (Radioshack #271-1133)
(x2) 100K resistor (Radioshack #271-1131)
(x2) 10K resistor (Radioshack #271-1126)
(x1) 1K resistor (Radioshack #271-1118)
(x1) 220uF capacitor (Radioshack #272-1029)
(x1) 10uF capacitor (Radioshack #272-1025)
(x3) 0.1uF capacitor (Radioshack #272-135)
(x1) 10K trimmer (Radioshack #271-282)
(x1) Speaker (Radioshack #273-092)
(x1) Standard servo (Radioshack #273-766)
(x1) M-type plug (Radioshack #274-1569)
(x1) 8 x AA battery holder (Radioshack #270-387)
(x8) AA batteries (Radioshack #23-1582)
(x1) 6" x 6" x 1/8" clear acrylic square
(x1) Fake food (of your choosing)
(x1) Takeout container
(x2) Googily eyes
(x1) Assorted zip ties
STEP 2: Glue
Glue your googily eyes onto the front of the takeout container.
STEP 3: Drill and Attach
Use the attached template as a guide for cutting a clear plastic lever out of the 1/8" acrylic sheet.
Drill two pairs of 1/8" holes along the outside of the servo horn, such that they line up with the holes in the clear plastic lever.
Zip tie the two together and trim away the excess zip tie tail in order to ensure that extra bit won't interfere withn rotation.
Drill two pairs of 1/8" holes along the outside of the servo horn, such that they line up with the holes in the clear plastic lever.
Zip tie the two together and trim away the excess zip tie tail in order to ensure that extra bit won't interfere withn rotation.
STEP 4: Trim
Trim a thin slot in the back portion of your fake food to acomodate the clear lever.
STEP 5: Program the Arduino
Load a micro SD card with audio as specified on this page and insert it into the music shield.
Place your music shield onto the Arduino Mega.
Upload the following code the Arduino:
/* Animatronic Talking Takeout Container for more info visit: https://wwww.instructables.com/id/Animatronic-Talking-Takeout-Container/ */ #include <Arduino.h> #include <avr/io.h> #include "config.h" #include "player.h" #include "vs10xx.h" #include <Fat16.h> #include <Fat16Util.h> #include "newSDLib.h" #include <ServoTimer2.h> #define rollPin 30 ServoTimer2 servoRoll; boolean talking; boolean waiting = 0; int volumeLevels = 0; void setup() { cli();//stop interrupts //set timer0 interrupt at 2kHz TCCR0A = 0;// set entire TCCR2A register to 0 TCCR0B = 0;// same for TCCR2B TCNT0 = 0;//initialize counter value to 0 // set compare match register for 2khz increments OCR0A = 255;// = (16*10^6) / (2000*64) - 1 (must be <256) // turn on CTC mode TCCR0A |= (1 << WGM01); // Set CS01 and CS00 bits for 64 prescaler TCCR0B |= (1 << CS02) | (1 << CS00); // enable timer compare interrupt TIMSK0 |= (1 << OCIE0A); TCCR1A = 0;// set entire TCCR1A register to 0 TCCR1B = 0;// same for TCCR1B TCNT1 = 0;//initialize counter value to 0 // set compare match register for 1hz increments OCR1A = 512;// = (16*10^6) / (1*1024) - 1 (must be <65536) // turn on CTC mode TCCR1B |= (1 << WGM12); // Set CS10 and CS12 bits for 1024 prescaler TCCR1B |= (1 << CS12) | (1 << CS10); // enable timer compare interrupt TIMSK1 |= (1 << OCIE1A); sei();//allow interrupts servoRoll.attach(rollPin); // attach a pin to the servos and they will start pulsing servoRoll.write(1500); pinMode(21, OUTPUT); Serial.begin(9600); InitSPI(); InitIOForVs10xx(); InitIOForKeys(); InitIOForLEDs(); Mp3Reset(); if (!initialSDCard()) return; RED_LED_ON();//light red LED } void loop() { file.traverseDir("MP3");//find all the .mp3 files in the root directory. while(1)playFile(); //shuffle your music you find in the root directory of SD card. } ISR(TIMER0_COMPA_vect) { Serial.println(waiting); if (waiting<=0){ if (talking){ servoRoll.write(1000); } else { servoRoll.write(0); } waiting = 2; } } ISR(TIMER1_COMPA_vect) {//Interrupt at freq of 1kHz to measure reed switch//generates pulse wave of frequency 8kHz/2 = 4kHz (takes two cycles for full wave- toggle high then toggle low) volumeLevels = analogRead(A10); if (abs(volumeLevels-512)>100){ digitalWrite(21, HIGH); talking = true; } else { talking = false; digitalWrite(21, LOW); } waiting--; }
Place your music shield onto the Arduino Mega.
Upload the following code the Arduino:
/* Animatronic Talking Takeout Container for more info visit: https://wwww.instructables.com/id/Animatronic-Talking-Takeout-Container/ */ #include <Arduino.h> #include <avr/io.h> #include "config.h" #include "player.h" #include "vs10xx.h" #include <Fat16.h> #include <Fat16Util.h> #include "newSDLib.h" #include <ServoTimer2.h> #define rollPin 30 ServoTimer2 servoRoll; boolean talking; boolean waiting = 0; int volumeLevels = 0; void setup() { cli();//stop interrupts //set timer0 interrupt at 2kHz TCCR0A = 0;// set entire TCCR2A register to 0 TCCR0B = 0;// same for TCCR2B TCNT0 = 0;//initialize counter value to 0 // set compare match register for 2khz increments OCR0A = 255;// = (16*10^6) / (2000*64) - 1 (must be <256) // turn on CTC mode TCCR0A |= (1 << WGM01); // Set CS01 and CS00 bits for 64 prescaler TCCR0B |= (1 << CS02) | (1 << CS00); // enable timer compare interrupt TIMSK0 |= (1 << OCIE0A); TCCR1A = 0;// set entire TCCR1A register to 0 TCCR1B = 0;// same for TCCR1B TCNT1 = 0;//initialize counter value to 0 // set compare match register for 1hz increments OCR1A = 512;// = (16*10^6) / (1*1024) - 1 (must be <65536) // turn on CTC mode TCCR1B |= (1 << WGM12); // Set CS10 and CS12 bits for 1024 prescaler TCCR1B |= (1 << CS12) | (1 << CS10); // enable timer compare interrupt TIMSK1 |= (1 << OCIE1A); sei();//allow interrupts servoRoll.attach(rollPin); // attach a pin to the servos and they will start pulsing servoRoll.write(1500); pinMode(21, OUTPUT); Serial.begin(9600); InitSPI(); InitIOForVs10xx(); InitIOForKeys(); InitIOForLEDs(); Mp3Reset(); if (!initialSDCard()) return; RED_LED_ON();//light red LED } void loop() { file.traverseDir("MP3");//find all the .mp3 files in the root directory. while(1)playFile(); //shuffle your music you find in the root directory of SD card. } ISR(TIMER0_COMPA_vect) { Serial.println(waiting); if (waiting<=0){ if (talking){ servoRoll.write(1000); } else { servoRoll.write(0); } waiting = 2; } } ISR(TIMER1_COMPA_vect) {//Interrupt at freq of 1kHz to measure reed switch//generates pulse wave of frequency 8kHz/2 = 4kHz (takes two cycles for full wave- toggle high then toggle low) volumeLevels = analogRead(A10); if (abs(volumeLevels-512)>100){ digitalWrite(21, HIGH); talking = true; } else { talking = false; digitalWrite(21, LOW); } waiting--; }
STEP 6: Build the Circuit
Start to build the circuit as specified in the schematic, with the exception of the audio connections and the servo motor.
STEP 7: Plug
Cut the audio cable and expose the signal wire and ground connection.
Solder those to the circuit board as indicated in the schematic.
Basically, the signal connection should connect to the 0.1uF capacitor at the audio in connection, and the ground wire should go to the circuit board's ground plane.
Solder those to the circuit board as indicated in the schematic.
Basically, the signal connection should connect to the 0.1uF capacitor at the audio in connection, and the ground wire should go to the circuit board's ground plane.
STEP 8: Plug Things In
Plug the circuit board's audio connection into the audio-in jack on the music shield.
Connect the servo motor to the Arduino with solid core wire as specified in the schematic.
Basically....
The servo's red wire should connect to 5V on the PCB.
The servo's brown wire should connect to ground on the PCB.
The servo's orange wire should connect to pin 30 on the Arduino Mega.
Now would also be a good time to connect the Arduino Mega's ground and the 5V connections to the appropriate spots on the PCB (if you have not done so already).
Connect the servo motor to the Arduino with solid core wire as specified in the schematic.
Basically....
The servo's red wire should connect to 5V on the PCB.
The servo's brown wire should connect to ground on the PCB.
The servo's orange wire should connect to pin 30 on the Arduino Mega.
Now would also be a good time to connect the Arduino Mega's ground and the 5V connections to the appropriate spots on the PCB (if you have not done so already).
STEP 9: Plug
Twist the M-type plug apart and slide the protective casing onto the wires from the battery holder.
Solder the red wire to the plug's center terminal.
Solder the black wire to the plug's outer ground terminal.
Make sure that the two connections are not touching and then twist the casing back onto the plug.
Solder the red wire to the plug's center terminal.
Solder the black wire to the plug's outer ground terminal.
Make sure that the two connections are not touching and then twist the casing back onto the plug.
STEP 10: Batteries
Insert batteries into the battery holder.
STEP 11: Speaker
Solder the red wire from the speaker to the audio-out connection on the circuit board, and the black wire to ground.
Insulate the solder joints with either shrink tube or electical tape.
Insulate the solder joints with either shrink tube or electical tape.
STEP 12: Put It Together
Place the circuitry at the bottom of the takeout container.
Position the servo motor in the back such that the lever is situated between the slot in the fake food and it is elevated enough to push the lid up and down.
Place the fake food on top and close the lid of the container.
It should now be doing its animatronic thing.
Position the servo motor in the back such that the lever is situated between the slot in the fake food and it is elevated enough to push the lid up and down.
Place the fake food on top and close the lid of the container.
It should now be doing its animatronic thing.
16 Comments
JayJ15 7 years ago
techiebot 10 years ago
And I don't see the second capacitor going to the 386 op amp. Also, should pin 6 of the 386 chip have power going to it?
techiebot 10 years ago
Hello - From what I can tell of the schematic and the photo of your board, there is a diode connected to ground and the line going to the Arduino analog input. In the parts list, there is a potentiometer listed, but I don't see it in the schematic or on the board. Am I missing something?
Lindie 10 years ago
Pretty funny! Nice job. I hope I don't open my fridge one day and get scared! :-)
tinyweasel 10 years ago
I love this.
Vampyra65 10 years ago
Where did you get that fake food ? It really looks real. Did you make it ?
askjerry 10 years ago
It's interesting... I did a search for "Fake Food" just to see what's "out there"... they have just about everything... and most of it isn't cheap! Must be big business.
See: CLICK ME
Jerry
marcellahella 10 years ago
randofo 10 years ago
brichins 10 years ago
My first thought was to add a motion sensor (with short delay) and leave this in the fridge at work to freak out co-workers.
marcellahella 10 years ago
jaybo2099 10 years ago
Really nice, but how about a video showing the device in operation with out a voice over? You talked over the top of everything, so I'm not sure how well the prop sounds or works.
J-Five 10 years ago
I see someone had too much time on their hands, but it's still pretty interesting!
andrea biffi 10 years ago
shan_2004 10 years ago
blissful2015 10 years ago
thank you for inspiring!