Motion Tracking Face

8,570

86

10

About: Technology, arts, and media student at CU boulder

Meet Chartreuse! Chartreuse's face follows you when you walk by. When she sees you, her eyes turn yellow and she gets a happy expression in her eyes. As you walk away, her eyes change to blue and she sadly turns away.

Chartreuse is powered by an Arduino Uno, two servos, and a stepper motor and a couple of addressable LEDs and constructed from a few pieces of 1/8" hardboard.

Supplies:

What you'll need

Electronics:

Materials:

Tools:

  • 3D printer
  • Laser cutter
  • Clamps to hold things together while drying
  • Soldering iron
  • Hot glue gun

Step 1: Making the Model

We started the process with a mask modeled by kongorilla on Thingverse. This can be found here. This mask is intended to be cut from paper or another flat, flexible material. This meant that we had to do some modification but at least had a starting point.

Editing

In Meshmixer, we got rid of the mouth, eyes, and the back edges of the mask using the drag and draw brushes. Then, in Fusion360, we added eye holes by converting the mesh to a BRep. Then extruding circles through it. We then scaled the whole model to change it to our desired dimensions.

Slicer

In Slicer (an extension for Fusion360) we choose a slice angle starting at the nose and going back.

If you'd like, we've done all these steps for you and all the files are ready to go in the next step! However, if you have familiarity with Fusion360, Meshmixer, or another CAD software feel free to make your own face (or not?) for this project. The .stl file for the mask and the sliced .3dmk file are included.

Step 2: Building the Face

Laser cutting

First, you'll need to laser cut the parts. The attached PDF has the plans for the 52 layers that make up the face. The red lines need to be raster (etched into the MDF) and the blue lines need to be vector (cut). We used a Epilog Legend 36 EXT (9000 Series) laser cutter for this project. This meant we cut our hardboard down to the bed size of 36" by 24". Cut your material down to whatever the bed size of the laser cutter you are using is. We found it cut best with the glossy side facing up.

You will also need to cut two 2.25" diameter circles for the eyes. We used scrap 1/8" opaque acrylic but anything that can diffuse the LEDs will work fine!

Glueing

Once cut, we split the pieces into 5 sections (layers 1-10, 11-20, 21-30, 31-40, 40-52). If you etched them, these number are marked on the top of the hardboard. There is also engraved guide lines to help you line up the piece with the layer below it. Starting with the lowest layer, add glue to the top of it and carefully place the next layer on top. Repeat until you have assembled the 5 sections. Then, place them on top of each other with glue between, clamp, and dry overnight. The included video shows a step-by-step animation of how the mask is assembled as well as our time lapse of assembly.

Finishing

Next, we coated the inside with a thin layer of wood glue using a craft brush. This will prevent the hardboard from bowing out and serve the dual purpose of smoothing the inside. After the glue has dried, we glued the eye pieces in using hot glue. From the inside, we added a small amount of glue around the eye holes and place them in. Be careful to not get any glue on parts of the eyes visible from the front, as this will be visible once you add the LEDs. Finally, sand off the etched numbers from the top layer. (Or, if you thought ahead, remove the etching numbers prior to cutting!)

Step 3: 3D Printing

All of the files included in this step are parts you will need going forward. Feel free to modifiy them to fit any parts you end up using!

Servo to Linear Actuator Adaptor

CustomGear, CustomMount, and CustomSlider are parts to allow you to use the servo as a linear actuator to control the eyelid movement. Once printed, attach the gear to the servo with a small amount of hot glue. Make sure the gear is centered! Slide the slider into the mount and then attach the servo. Move the slider in and out a bit, making sure the motion is fluid without too much give.

Knob Adaptor

This piece will attach the stepper motor to the small gear. You will use this in assembling the base.

Ring Spacer

Print two of these. They will help to make a tight fit between the PVC and PLA spool. Glue one of these to the end of the pipe and another one an inch or so up from there.

Ball Bearing Circle

Place one half face up on a flat surface. Put the ball bearings in each of the holes. Place the top half over it and tape them together. Gently melt the edges around the circle with the soldering iron to seal it together. The balls will be a bit grippier than we want, so put the bearing between two pieces of wood and slide them across each-other in a circular motion. Doing this enough lets the steel balls have enough room to move but doesn't free them from their casing.

Step 4: Building the Base

The Box

The base will house the Arduino and many of the other electronics. You will need to laser cut the attached file (again out of hardboard) and use the pieces you 3D printed.

After cutting the pieces, wood glue to backs of the gear pieces to each other and clamp to dry (second picture).

Using the fiberglass mesh, cut a piece a little bit bigger than the size of the hole in the front of the box and wood glue that on over the hole.

Then, wood glue the base and four sides of the box together, but leave the top unglued so we can take it on and off.

Hot glue the stepper motor into the hole of the top of the box by placing a dab of glue on the top surface of the motor and pushing the rod through the back side of the hole. Then, glue the knob that you 3D printed to the rod pocking through the top of the box, and the small gear on top of that.

Top of the Box

Place the top onto the box (still not gluing on). Glue to MDF ring included in the box file around the hole and then the ball bearing circle around that. Split the PLA spool in half and push one half into the hole.

Step 5: Electronics & Code

After assembling based on the wiring diagram, the code is relatively straightforward. Outside of using a lot of libraries, the functions are simple and can be tweaked for different behaviors.

The code (mostly works) can be found here. Once you have everything connected, save and upload the code to your Arduino.

First, we used a potentiometer and serial printing to find the real ranges for our servos so we could hard code a few presets in. Once that’s done it's important to make sure the servo arms are oriented correctly.

The primary mechanism is tracking using a single ultrasonic sensor. The ultrasonic sensor is mounted on the head of a servo that has simple instructions:

If it sees something: rotate counter-clockwise

If it doesn’t: rotate clockwise.

There are stops on either end to make sure it doesn’t over-rotate. Though this accomplishes basic motion tracking, it has its limits and can really only motion-track people or objects entering from the right. In the end it doesn’t offer the same level of fidelity that Albert (the exploratorium exhibit we based the idea on) had.

This servo motion is mapped to the stepper motor, accounting for gear ratios and steps on the stepper. Ultimately, ours came out to around 11 steps per degree on the motor and 81 steps for a single degree on the larger gear.

We tie the rest of the behavior into the binary: "object in range or not?" then "when?"

Every loop we’re checking how long ago an object was last seen. If something is in range, we record the timestamp where it appeared and use a few rules to inform the eyes.

If the object was seen in the last 2 seconds, we set the eyes to happy. If it’s been greater than 2 seconds but less than 5, eyes to sad and any longer than that eyes back to neutral.

Step 6: Assembly

Adding the PVC pole

We will need to make a cut with the dremel into the PVC. Lay the PVC into the back of the face and line it up about an inch from the top. You will want to cut out a section so there is no PVC covering the eyes. With a sharpie, make an outline for this cut. Using a plastic blade for the dremel, make this cut and test to see if it has cleared the eye area. This step is a bit of a guess and check and does not have to be very precise since it will be on the back of the head.

To attach the PVC, add a small shim with wood glue to the top and bottom of the face and secure it with one screw in each place. For the bottom of the face. We counter-sunk a hole through the top of the PVC to allow us to put a shorter screw from the back of the PVC into the shim. Make sure your screws do not go through the front of the face!

Adding the eyelids

Glue the side of the servo to the top of the PVC as shown in the picture. Bend two wires into the shape shown and hot glue them at 3.25" and 5.35" from the top of the bar attached to the servo. Cut the pieces from the eyelid file and attach them to these wires with hot glue. We cut them out of cardboard with an exacto knife but you can also cut them from scrap hardboard. The rectangular ones are for the bottom lid and the beveled ones are for the top. Make sure they are positioned in a way that they can move about an inch and a half without scrapping the inside of the mask. The flexible wires allow them to be adjusted as needed.

Attaching the LEDs

Attach a 8" x .5" piece of scrap hardboard across the back of the head about 4" from the top. Tape one LED directly behind each of the eyes and run the excess cable down the PVC so it can be attached into the base. Drape the wires from the servo over this piece of hardboard and then run it though the PVC as well.

Wiring

Pull the wires for the servo and LEDs through the pipe and through the top of the base. Wire them both the ground, power, and signal pin with the given diagram (Servo signal pin=6 and LED pin=9). Then place the top piece on the box and the pipe in the hole. The assembly is now complete!

Arduino Contest 2019

Participated in the
Arduino Contest 2019

Share

    Recommendations

    • Pets Challenge

      Pets Challenge
    • Backyard Contest

      Backyard Contest
    • Fandom Contest

      Fandom Contest

    10 Discussions

    0
    None
    kongorilla

    22 days ago

    Correction to your text: the mask was modeled by kongorilla (me), as your link shows (not Yzorg as your text states ATM, though Yzorg did make a derivative).

    1 reply
    1
    None
    snowf7

    24 days ago

    It looks like it could be the baby sitter of Groot junior.

    0
    None
    randofo

    4 weeks ago

    Cool project. I think it would creep me out a little to have this watching me. :)

    1 reply
    0
    None
    JeremyD136randofo

    Reply 24 days ago

    I love it when it watches me ha ha :D