Introduction: Animatronic Eyes and Wii Nunchuck Part 2 - Give It a Voice
After I built the animatronic eyes in PART 1, I wanted to complete the face with a voice and possibly moving eyebrows. If you look back at my PART 1, you'll see that for the base I used a model from Thingiverse. Once you have the model 3D printed, you will need to add in the 9 gram servos.
A quick check of Ebay gives you Tower Pro MG 90 S MG90s Full Metal Gear 9 gram Servo. They are very inexpensive at about $5.00 each.
Once you get your servos, you'll also need hardware between the servo and the eye and eyelids. You will need Dubro EZ connectors ($9/dozen), threaded rods ( $3/six), and ball links ( $18/dozen for the heavy duty ones). If you live in a larger city ( larger than mine) it would be best to go to a hobby store and purchase the parts so you can see the size and how the connections work. Otherwise, there are many online stores with remote control parts.
After you get it all connected, it's time to figure out how to adjust the servos. If you send a command to move the servo too far, you will burn the motor out (I destroyed two). Then I wrote an Arduino program that allows you to use a potentiometer to move the servo back and forth. Looking at the computer serial monitor you can read the values as you adjust the servo motion back and forth.
To make that work, use the code attached. Make sure that your Pololu servo controller is connected to your Arduino. The code has some links to let you know how to connect the potentiometer. Record the settings for each servo and use them in the later code to control the eyes.
You will also want to test out your Neopixel eyes if you decide to use them. The Adafruit site has a great tutorial on wiring up the Neopixels and some code to test them. You'll want to set the number of Neopixel units to 2, otherwise the second eye won't light up.
WOW - That's a lot, but now you're set up to make this robot head even more complex!
You will notice that the eyes go through the Adafruit "rainbow" sequence between sound files.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Materials:
Well, there are lots of materials...I will only list a few here:
- *I used and Arduino Uno for the brain
- *You will need a VS1053 sound module or some other sound module compatible with the Arduino
- *Also a servo controller. There are a bunch out there to choose from. I am using a Pololu 8 servo controller.
- *a pop-rivet gun and pop-rivets or alternately 1/2" bolts and nuts to hold the head together
- *file folders for the prototype
- *aluminum flashing for the skin
- *a couple of ICs and some components if you choose to build a sound detector yourself instead of using the Sparkfun one.
- *a moderately heavy set of scissors
- *some flat brass or other metal, or possibly rigid plastic for the jaw
- *some foam core for the electronics platform
- *a dremel tool for various drilling
- *a steel ruller and ballpoint pen and fine sharpie
Step 2: How to Make a Jaw React to Sound.
How to make the jaw of an animatronic robot coordinate with a recorded voice?
I found this fun Instructable that seemed to hold the solution:
Randolfo figured out a circuit that takes the audio input and sends an analog output to the Arduino. That way you can look at the level of sound and have the mouth open more with a louder sound, and less with a softer sound, and close with no sound.
However, if you don't want to build your own sound sensor, I found this possible replacement from Sparkfun. If you look down the comments, you'll find someone who wants to de-solder the mic and hook it to an audio output. Apparently, if you do that and remove one resistor, you can use all of its sensor data. That means an analog readout as well as a gate. You could use the gate for two positions: open or closed. Or you could use the analog readout to set the servo position: louder=mouth more open.
http://www.thingiverse.com/thing:32189 by Kongorilla.
Step 3: Make Some Noise-
You have many choices for how to handle audio.
During my testing of the sound detection circuit, I used my iPod for a sound source. That way I could confirm that the sound was playing, and also watch the servo move if the sound level was set correctly.
I really like Adafruit's VS10538 board. For only $25 you get a recorder, a player, and a MIDI. Use header pins and you could use it on other projects that would benefit from voice or music. You'll need a micro SD card to hold your sound files. The Adafruit site has a great tutorial on assembling and using the unit. It also has the basic code to run tests on playing your sound files. One negative thing is that the unit uses 8 of the Arduino IO pins. The servo controller really only uses one, and the Neopixel eyes use only one. Check out the Arduino code attached later to see which pins I used.
I used a standard stereo 1/8" male plug into the unit, and then sent the audio into the sound sensor from the previous step.
The photos above look a little like a hodgepodge, but it works.
I cut out a semicircle of white foam core to mount all of the electronics to.
Then I cut a rectangular piece for a second layer. I used standoffs to separate the two layers.
Step 4: Gimmie Some Skin-
At first I made some drawings of some fairly typical robot faces. They all looked very mechanical and cartoony. Then I ran across this Instructable. It uses a Thingiverse file - Low Poly Mask by kongorilla:
The Instructable uses heavy printer stock. The Thingiverse link has people using a variety of materials including 3D printed plastic. I decided to use aluminum flashing that you can find at the hardware store. It comes in different widths and lengths and is not expensive. You can cut it with a heavy pair of scissors.
I downloaded the Thingiverse files. Then I measured between the eyes of my animatronic face. I wish I had written it down, but I think that I used Gimp (any graphics program will do) and enlarged it to 160%. Then I printed out the pieces onto ledger sized paper. If your printer won't take that size, you could go to a print shop, or print it in 8 1/2 x 11 sections and tape them together.
Next I cut out the pieces and transferred them onto file folders. I like how stiff file folders are and also how cheap. I only had to do a little in alterations to get the cardstock mask to fit onto the eyes. I have a piece of pvc pipe as a support for the eye mechanism, so the weight is held by the pvc.
I still had the program for using the Wii Nunchuck, so I moved the eyes all around to see if there were any problems with the animatronic mechanisms rubbing against the cardstock face.
Step 5: Metalhead
I just used a fine Sharpie to transfer the patterns onto the aluminum. A ruler helped to make better lines.
After cutting out the shape, use a ballpoint pen to score the fold lines. Run the ballpoint over the crease line several times. I used needlenoses pliers to help bend the aluminum.
If you bend it too much, the aluminum will snap along the fold line. You have to be gentle and bend some, test, bend some more, etc. till you get it right.
I used a drill to make holes in the aluminum for attachment points. Then I used pop rivets to hold the aluminum together. I did adapt the pattern a bit to allow tabs that were larger so that drilling for the pop rivets was easier and the pieces fit together better.
As I worked I kept fitting it to the animatronic eyes to see if folds had to be adapted. All in all, it was pretty easy and fit very well.
I made the side panels of the head larger than the pattern. That way they wrapped around the 3D printed eye frame. I drilled a couple of holes and used sheet metal screws to attach the panels to the back of the 3D printed frame. I also made an L bracket and attached the front of the face to the 3D printed frame just to the outside edge of where the eyelids attach.
Step 6: ... Is Connected to the Jawbone...
I wanted the jaw to move basically up and down, not to rotate. I thought that this would make it look more machine-like.
I made a sketch (first image) of the mechanism. I have a fair bit of brass from the hobby store. It is easy to bend and drill, and it looks cool. You can see that the mechanism is a parallelogram. The servo is attached at one side's upper pivot point. The brass is tapped for 6-32 bolts so nuts aren't needed. I tried to photograph a variety of angles.
The aluminum flashing lip and chin were pretty much straight off of the Thingiverse file. I used a fine pair of needlenosed pliers to bend the chin. It has several folds going different ways.
The mechanism was bolted onto a piece of angle aluminum. Then the foam core semi-circle that holds the electronics was bolted to the angle aluminum as well. The whole thing was attached to the pvc support rod with two self-drilling 3/4" Tech screws.
Step 7: Now the Voice...
I decided to start with Asimov's three laws of robotics. So I opened up WavePad, a sound editing program. In it you can type words and get text to speech. Once I had the voice I liked, I created the sound files for them. I've attached one of the sound files. I have found that the VS1053 module doesn't like long file names. It doesn't seem to be able to recognize them if they get too long.
I have attached a servo tester program. It allows you to connect a potentiometer to analog pin 0. By turning the pot and watching the servo and the serial monitor, you can set the distances that you want the servo to travel. That way you don't have it move too much and strip the gears, or too little and have a wimpy effect.
I have also attached my current iteration of the whole program. It's pretty well commented. If you have been looking at the Adafruit and Sparkfun tutorials that go along with the components, it should make sense. I really think I can clean up the code and optimize the performance. But it's where I am now.
It uses a FLASH array to give commands that move the eyes and change the eye color. A timer opens the array every 2 seconds of the sound file and moves the servos and changes colors accordingly:
/* 1=EYES LEFT/RIGHT(4000-900) 2=EYES UP/DOWN (3400-500) 3=EYELIDS OPEN/CLOSE (3400-800) 4=EYELIDS TILT (4900-3800) 5=RED 6=GREEN 7=BLUE*/ FLASH_ARRAY(int, table, 2500,2000,800,3800,0,255,0,
The first number is the servo value that centers the eyes left/right. The second centers them up/down. The third opens up the eyelids, and the fourth centers the eyelid tilt. The last three values are for the NeoPixels. So it sets them to very green to start.
I am thinking of disconnecting the eyelid tilt servo and putting two servos in the forehead to move eyebrows. Looking at a lot of animatronic puppets, the eyebrows change the expression a lot. If you added in eye color, it could be really effective.
I hope that I have given you enough information and details that you
could construct your own animated face. It would be really fun to make a latex mask face of a creature for Halloween.