loading

Someone had seen Peter Penguin or my Instructables on Animatronic Penguin Torso or Animatronic Eyes, and was working on a sculpture. He wanted to animate the sculpture when someone walked into the room and asked if I could do it. I thought about it for a while. There were several differences from my penguin, (no laptop controlling the action, could use an SSC-32 as I had before, but may be overkill, and I had never used a PIR Motion Detector before.) But after researching Arduinos and the motion detector from Roboshop ( http://www.robotshop.com/en/parallax-pir-motion-sensor.html ), decided to have a go.

SO this is Mark II of my Animatronic Eyes. The eyes do not rotate, but that wasn't requested. It would not be too difficult to add that feature back in, now that I have this model functional.

Step 1: Tools

·

  • Small screwdrivers
  • Drill (drill press preferred, also pin vise and portable drill)
  • Cutoff Saw, razor saw, jigsaw or razor knife
  • Hobby knife
  • Pliers, cutoff pliers
  • sandpaper
  • Circle Template
  • Dial Caliper (Digital if you’re so lucky)
  • Soldering iron
  • Masking tape

Step 2: Materials

  • 12”x12” 3mm Birch plywood
  • 12” ½”x ½” bass stripwood
  • Easter eggs (small)
  • Ping Pong balls (standard)
  • Lg. paper clips
  • Arduino Uno kit (including Wall Wart and USB connector)
  • Micro Servo, 9g Heavy Duty
  • Servo 24” extension cable
  • Misc. 3x male headers (from misc. Servo extension cables)
  • Misc. 2 pin female header to 2 pin female header, preferable with black and red wires. Recovered from junk PC.
  • Electrical Shrink tubing.
  • Wood glue
  • Epoxy

Step 3: Planning

Success in a project like this is planning, planning, planning. I foresaw four separate stages. Design of the base, the eye mechanism, the linkage and the code.

    • Base to hold Arduino, servo and eyes. I had designed eyes before, but this one had new challenges, It was to be buried in a rock sculpture and its skin was several inches thick. It also only had to blink. That allowed me to use a long support bar for the eyes and pivot on the eyeballs themselves. SketchUp 8 allowed me to visualize the base designs in 3D.
    • Mechanism for eyes. The ideas presented above then dictated the design of the eye mechanism
    • Linkage specifically for eyes. This tool helped me immensely - linkage mechanism designer and simulator. It allowed me to simulate the linkage between the servo and eyelid mechanism, and determine the lengths of material required. Basically, the servo arm, moves a long linkage, which in turn, rotates the T linkage thus opening and closing the eyelids.
    • Control code. I saw this as the easiest portion of the effort, as I am a coder from way back. I have supplied the code for your benefit in the Instructable..

    Step 4: Assembling the Eyes

    The support bar is two lengths of 4” x ½” x ½” bass stripwood from Michael's.

    Holes are needed on the Ping Pong balls for the support bar and the pivot rod. Marking holes for support bar and pivot holes, I use the joint line as a circumference, and draw an 11/16” circle centered on the circumference. Place the hole on a piece of sandpaper and rotate to smooth out the edges.

    Then, at 90 degrees to that hole, drill a hole on the circumference with the diameter of the selected sprue bar used for the T when making the eyelids (a good reason to read ahead, when trying to follow directions). I use a circle template for determining size, circumference, angles and position on the ping pong balls.

    Place the ping pong balls on support bars through the large hole. The end of the support bar should be coated in epoxy. Ensure that the pivot holes are in line. What to do when pivot holes are not in line?

    Well, if you did as I did, when I placed the ping pong balls on the support bars, I eyeballed the 90 degrees for the pivot holes. I was wrong. Or, I did a sloppy job drilling the hole at 90 degrees in the first place. In that case, I should have used an L at 90 degrees to mark the position of the two holes. In the latter case, I should have used a scrap piece of sprue rod to align everything up. I usually mock up most of what I build anyway (see last picture). Never eyeball a measurement if you can possibly avoid it. Use that High School math and get it right.

    But it was bollixed now. So, I marked where one of the pivot holes SHOULD have gone and with increasing drill bits, drilled it out. It still was too close to the bad, bad hole – so I filled up the hole with more epoxy and redrilled it once again. Now as I write this, I realize that the OTHER side was available for a second attempt and I could have used it.

    You may need to spray the eyes white, depending on the ping pong ball used. In mine, the epoxy color bled through

    Step 5: Making the Eyelids

    Find a piece of plastic model sprue, in a T shape. The head of the T should be 1-¼” long, and the handle of the T should be ¾”. Mark the head of the T, 3/8” from the center in both directions. This is where the eyelids will stop. Heat a thick paper clip with a lighter and GENTLY melt a hole through the leg of the T, at the 6/10" mark.

    Select two matched ROUND plastic Easter egg tops. Note that when separated each half has a distinct shape. Choose the most perfectly round halves you can get.

    Mark the egg vertically, approximately 3/10” from center. I did this by eye, holding the egg and ping pong ball together to see where the cut should be made. Use the above as a starting point. Cut off at this line (I used a cutoff saw, CAREFULLY - those eggs are slippery. Once the excess has been trimmed off, place the cut edge on a piece of sandpaper and sand the edge smooth. The edge that connects to the other egg half also has to be trimmed off. This can be done with the cutoff pliers and sanded as in the other edge.

    The eye assemblies were placed in a wood clamp, 1.735” apart at the sides, ¾ ” apart between the eyeballs, and the pivot holes were carefully aligned. (This is where I discovered that I had a problem, and had to punt and go back to the previous step).

    The eyelid (cut Easter egg) will have to be drilled to press fit the sprue selected for the T. In two opposing corners of the eyelid, drill the holes there. First, place the eyelid on an eyeball and mark where the pivot will go.Then with the two eyelids together, mark the second eyelid. If you have trouble visualizing this, place the trimmed eyelids on the workbench, side by side, so the opening faces you. The two adjacent corners will be where the pivot holes will be drilled. Mark the second also with a permanent marker (which on the eggs is not so permanent) It is best drilled on a drill press.These eggs are made of some plastic from the outer universe, more slippery than Teflon.

    Next, we'll glue the assembly together. I have a picture of the various adhesives I tried to glue to the eggs. Only epoxy worked, and even then not all epoxies worked. I used LocTite 1 minute epoxy, but be warned – I had bad luck with the instant mix kind and ended up manually mixing the epoxy like I would have. More on this step later.

    Step 6: Making the Eyelids – Part II

    Hand assemble the eyes (in the wood clamp) and the eyelids. The support bars should be parallel and 1.73" apart. The distance between the eyeballs should be 3/4".

    You may have to loosen one of the eyes to bend it out to get the pivot bar to fit. Ensure the edges of the eyelids are at the 3/8” mark you made earlier; the handle of the T should be centered. Now, get a couple scraps of masking tape, and from the top, hand position the eyelids into the closed position and keep them there with the tape.

    The leg of the T should be approximately 27 - 30 degrees from the plane of the eyelid back. The Linkage design shows this much larger, 55 degrees, but it practice as I assembled the eyelids, I found this position to work.

    Bend a paper clip into a pointer. Mix up some epoxy. With the bent paper clip as an applicator, run a bead around the T and the eyelid, both sides. Let it set (they advertise 1 minute; I give it 5). Once it has set, disassemble the sub-assembly and run a bead around the bottom of the joint with another batch of epoxy. Let it harden thoroughly.

    Once the eyelid joints have hardened overnight, spray paint the eyelid, either gray or black.

    Step 7: Assembling the Base - Servo

    Every component and their mounting surfaces, should be marked out on the plywood base. Piece fitting was done before anything was glued or attached.

    The first pieces should be ½” x ½” x ½” cubes used to mount the micro servo and they should be glued and clamped to the base. The micro servo is screwed into these pieces, after they have had the glue cure and pilot holes drilled into them.

    I had to cut off one corner of the mounting blocks, as the servo cable exited at a back corner. You can see this in one of the pictures.

    Step 8: Assembling the Base – Eye Assemblies

    Glue one of the eye sub-assemblies to the base. Its position should already been marked out.

    The eyelid sub-assembly was temporarily put in place. The second eye sub-assembly is put in place and clamped, the distance confirmed (it should already be marked out on the base), and then a pilot hole is drilled for a screw to hold the second assembly is place. Screw this in.

    Then, position the arm straight, parallel to the other eye, and 90 degrees to the front of the base. Drill a second pilot hole – but do not attach the screw. Set it aside (and don’t lose it like I did once or twice. Good thing I believe in spares).

    Step 9: Assembling the Base - Eyelid Assembly

    Slide the eyelid assembly into the static (glued) eye assembly,

    Then, slide over the other eye assembly until you can get the pivot in place.

    At this time, add the second screw.

    Step 10: Assembling the Base - Mount the Arduino

    I then placed the Arduino in position and marked the mounting holes. Pilot holes were drilled, large enough and small enough to accept aluminum standoffs, without a back nut. Plastic standoffs may work better. Followed this with mounting the Arduino with small screws. The standoffs were something I just had on hand. I think small #6 nuts and bolts without standoffs will work fine.

    Step 11: Final Linkage.

    Straighten a large paper clip with needle nose pliers, the straighter the better. At one end, bend a sharp L shape and FROM THE BOTTOM insert it through the hole in the T leg. Then, bend it back parallel to itself. Sorry for the caps. It’s just that I didn't originally anticipate this need, and had to disassemble the unit to move the other end of the linkage to the bottom where it was needed.

    Manually place the servo horn all the way forward and tape the eyelids in a closed position once again. Mark the paper clip linkage at the hole on the servo horn furthest from the axle. Make a sharp L bend as before, insert it into the servo horn, and bend back again. You may have to trim a little excess from the paper clip wire, to be able to fit this into the horn. The entire clip is too long.

    Note that the SketchUp drawing has a bar for the linkage. Ignore that. I panicked.

    Step 12: Power Cable/ Signal Pins

    The Arduino had only one pin for 5VDC. I had two devices. So I made this splitter from some male headers and a scrap cable with female headers on both ends. I cut the cable into two, and stripped the cut ends.

    I then twisted the red ends together and did the same for the black ends, to solder them to a two pin male header. First, I slid on some heat shrink tubing, The, I wrapped the twisted wires around a single pin, trimmed the end and slid it off the pin. This created a little socket to slide onto the two pin male header before soldering. I slid down the heat shrink tubing and insulated the individual connections. Then, I places one more piece of tubing over the entire connection.

    I also had removed the sockets from the servo extension cable and the servo, leaving me with bare pins. I inserted an one pin male header into each socket and covered that with heat shrink as well. This was necessay because the Arduino has female sockets for all its pins.

    Step 13: Wire Up the Eyes

    The colors are critical when describing the connections, with one exception. There is no color coding standard for RC servos, so be careful when connecting the servo to the Arduino.

    The power connections from the servo and the motion detector (servo extension cable), are plugged into the power splitter. For the servo power wires, Brown to black and red to red. For the motion detector, Red to red and black to black.

    Plug in the power splitter to the Arduino power section, where red goes to 5V and black goes to Gnd. Colors are critical throughout

    With the 24” 3 wire cable, female end, plug in the motion detector. On the back of the motion detector, the pins are labelled. Gnd goes to black and Out goes to yellow.

    The orange signal line to the servo is plugged into pin 3 on the Arduino.

    The yellow signal line from the motion detector is plugged into pin 9 on the Arduino.

    The pin values can be changed in the Arduino code.

    Step 14: Arduino Sketch

    The sketch is very straightforward. The step in the block when the motion detector is high, determine the sequence of events that the eye will do in response to detecting motion. It could use some TLC, as its the first C program I've written.

    // Sketch to blink prop eyes when someone approaches.
    // Behavior can be modified depending on how long they stay
    // Test version blinks LED

    #include

    void Open_Eyes();
    void Close_Eyes();
    void Blink_Eyes();

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

    int motionPin = 3; // analog pin used to connect the motion detector
    int motionVal; // variable to read the value from the analog pin

    // Servo is attached on pin 9
    int ServoPin = 9;

    // Pin 13 has an LED connected on most Arduino boards.
    // give it a name:
    int led = 13;

    // Flag for previous state
    boolean wasHIGH = false;


    void setup() {
    Serial.begin(9600);

    // initialize the servo on 'ServoPin'
    myservo.attach(ServoPin); // attaches the servo on defined pin to the servo object

    // initialize the digital pin as an output.
    pinMode(led, OUTPUT);
    digitalWrite(led, LOW); // turn the LED off by making the voltage LOW

    // Allow the motion detector to warm up.
    delay(20000);

    // Start with eyes closed
    Close_Eyes();

    }

    void loop() {

    motionVal=digitalRead(motionPin);
    boolean motion = (motionVal == 1);

    if (motion) {
    Open_Eyes();
    delay(2000);
    Blink_Eyes();
    Blink_Eyes();
    delay(3000);
    Blink_Eyes();
    delay(15000);
    Blink_Eyes();
    delay(15000);
    wasHIGH=true;
    digitalWrite(led,HIGH);
    }

    motionVal=digitalRead(motionPin);
    if (! motion) {
    if (wasHIGH) {
    Close_Eyes();
    wasHIGH = false;
    }
    digitalWrite(led,LOW);
    }

    delay(200);
    }

    void Close_Eyes() {
    for(int pos = 179; pos>=1; pos-=2){ // goes from 180 degrees to 0 degrees
    myservo.write(pos); // tell servo to go to position in variable 'pos'
    delay(3);
    }
    }

    void Open_Eyes() {
    for(int pos = 0; pos<180; pos+=2) { // goes from 0 degrees to 179 degrees
    myservo.write(pos); // tell servo to go to position in variable 'pos'
    delay(3); // waits 1ms for the servo to reach the position
    }
    }

    void Blink_Eyes() {
    Close_Eyes();
    Open_Eyes();
    delay(10);
    }

    Step 15: Sketch Initialization

    The opening of the sketch is typical Arduino code, defining variables and parameters for the rest of the program. I include the servo library here, in order to control the servo which moves the eyelids.

    I define an object, myServo, to be of type “servo”.

    The pins for the motion detector (3), servo (9) and onboard LED (13) are all defined here. The last was used in debugging and is not critical for the operation of the sketch.

    I also define a global variable for the value returned by the motion detector. It too is probably not necessary, but I added it when I was having difficulties with the syntax of the comparison operators in C (see, this is my first C program).

    There is one more variable defined, wasHigh is a boolean. It is used to track the previous state of the system.

    There are three functions referenced here as well. Hopefully their use is obvious: Open_Eyes, Close_Eyes, and Blink_Eyes.

    Step 16: Setup

    The setup function is run when the Arduino is reset or powered up. As such, it is useful to ensure the sketch is running for a known stable state.

    First, it is used to define the serial output speed (useful when debugging and using the serial monitor function).

    Secondly, the servo is attached to pin 9, with the servo attach property. As a pleasant side effect, this operation moves the servo to its home position, which equates to the eyelids being half closed. It is a visual indication that something is going on.

    Next, the led is defined as an output. To start, the onboard LED is turned off.

    The motion detector used requires a 20 second “warm-up” time before it can be used.

    Once this delay expires, we close the servo eyelids. This provides another visual indiction that the sketch is operational.

    Step 17: Main Loop

    First, we read the motion detector and set a Boolean value to “true”, if it has detected motion.

    If there is motion, then the requested sequence is executed. Refer to the picture for an example of the sequeence coded. Note that the "delay()" function takes an argument in ms. At the end of the sequence, the Boolean variable “wasHigh” is set to true.

    If there was not motion, and the previous state was motion detected (wasHigh == true), then the eyes are closed. The statements are constructed in this way, so that the sequence of movements are always completed.

    The loop continues to check after a delay of 0.2 seconds.

    Step 18: Close / Open Eyes

    If the servo is at 180 degrees, the eyelids are fully open.

    To close the eyes, we step down from 179 to 1 and write the position to the servo each time. There is a 3ms delay between writes, to allow the servo time to move. Also not that we decrement by two’s. This combination of decrement/delay was experimentally shown to provide a smooth motion.

    Similarly, open eyes is coded, except we are increment up from 1 to 179.

    Step 19: Blink

    Blink is a combination of closing the eyelids and opening them in rapid succession.

    At the conclusion, we have a gratuitous pause for 10ms.

    Step 20: Take a Look

    The artist is going to do the final painting and mounting, so these are a little bare. But take a look anyway. Just remember that their action is triggered by someone walking by.

    The next step is a video from the artist, displaying his final product.

    Step 21: UPDATE: Finished Sculpture

    Update! Today, the artist sent me a link to the finished sculpture. I like the way he mounted the eyes at a slight angle, because it gives the whimsical rock a little character.

    <p>I voted. Great instructions.</p>
    <p>WHAT IS THE USE OF IT</p>
    <p>IN DAILY LIFE</p>
    It is part of an art project. In the gallery, a large sculpted rock sits to one side. When someone walks by, the eyes open and blink. <br><br>I don't know what part it plays in &quot;daily&quot; life, but...<br><br>Art should be part of everyone's life.
    <p>THIS IS SOOOOOO COOL! I want to do this Instructional desperately. </p>
    <p>it is a great project, thumbs up... ..if we modify the code to work without DELAY function ? this will make it more suitable to be incorporated in a bigger code/project without losing the multi-tasking advantage...can you please throw such code here ?</p>
    <p>i wonder if they did an awesome robert</p>
    It is interactive art. A sculpture of a large rock, which reacts when people come near.
    <p>Never realized that the step with the complete sketch code wasn't displaying properly. Fixed it...</p>
    nice job friend,,take my vote
    <p>Oh, please update us with pictures of the painted eyes!</p>
    <p>I won't be painting the eyes. Up to the artist who hired me. You can check out my other animatronic eyes at https://www.instructables.com/id/Eyes</p>
    <p>I got that, I just hoped you could get an image after the artist painted them.</p>
    Eric promised to send some pictures and a video. Will update when I get them.
    <p>Excellent!</p>
    <p>The link for the motion detector doesn't work ?</p>
    Was edited to manually include link. The &quot;insert hyperlink&quot; button wasn't working for me.
    <p>I manually added the link. I edited the 'ible several times to insert the link, but couldn't get it to work. So this is my workaround.</p>
    <p>i always want to make these eyes lol , to replace the eyes of a painting of skull , make a thick frame to put electronic things behind the painting and , make the eyes follow the motion , it will look really horror when s.o realizes that they are followed by a skull' eyes , maybe the mouth of that skull will say &quot; what's up , man ?!!!! &quot;</p>
    <p>That could be done. First, the actuation mechanics could be mounted vertically instead of horizontally. Second, I would use a pair of ultrasonic detectors instead of the motion detector. That would allow us to triangulate the position of the person. Blinking in this scenario would be an option, but the eyes would have to move left/right. The microprocessor could store several phrases, too. Not just one. Wow, what a great idea... Maybe a new 'ible!</p>
    Thanks! I hope many people also vote for this.

    About This Instructable

    72,694views

    349favorites

    License:

    Bio: I am an IT professional. When I am not working, I love to putter around - whether it be a household project or animatronics. The interest ... More »
    More by djsfantasi:Wireless Lockout Game Show Circuit Introduction: Pinewood Derby Race Finish Line Animatron 8.3: An Animatronic Controller 
    Add instructable to: