Animatronics Basics - the Servo Motor

by Paul-NussbaumE in Circuits > Arduino

5571 Views, 16 Favorites, 0 Comments

Animatronics Basics - the Servo Motor

IMG 5055

Whether it's a jolly holiday display in the window of a department store, or a scary Halloween prank, nothing attracts attention like an animated puppet.

These electronically controlled animations are sometimes called "animatronics" and this instructable will teach you how to make the most basic kind, one controlled by a single servo motor.

We will use the Arduino microcontroller as the brains, and we'll see how a potentiometer and a servo work inside, also teach you how to build three different control methods:

1 - Continuously repeating motion

2 - Remote controlled motion

3 - Triggered motion (using a light sensor)

Parts List

Arduino Budget Pack 30 dollars.jpg
Tower Servo kit 12 dollars.jpg
IMG_5067.JPG

You'll need a microcontroller (shown in the first picture is the Arduino from http://adafru.it along with their budget parts kit for a total of $30) and a servo motor (a small Tower version is shown in the second picture along with some connector parts, from the same store at $12).You'll also need a small capacitor or an more powerful voltage source if you are operating multiple servo motors (a 9V wall charger for Arduino will work)

A microcontroller is an entire PC computer on a single chip. Obviously not as powerful as your home computer, it has very litle RAM, no disk drive, no keyboard or mouse, but it is really great at controlling things (hence the name). You'll find one of these chips inside many everyday items such as washing machines and auto fuel injector computers.

The "Arduino" brand of microcontrollers also adds some other circuitry that connects it to the outside world, and puts it on a convenient board.

Notice that in the "budget parts kit" there are a few wires, resistors, LED ligths, and a blue pair of knobs, called potentiometers. More about potentiometers in the next step.

Finally, you'll need a servo motor, and it comes with some screw-on connectors to attach it to your moving puppet. We will be using the X shaped connector in this lesson.

Potentiometer Review

Potentiometer Review.jpg
03 - 10K Ohm Potentiometer.JPG
04 - Potentiometer Internals.JPG
02 - 10K Ohm Potentiometer.JPG

A potentiometer is essentially a dimmer knob - or in electronics terminology - a pair of variable resistors. By turning the knob, you make one resistor bigger, and the other resistor smaller.

Most of the time we use a potentiometer (sometimes called a "pot") to control a voltage using the circuit diagram shown above.

The leftmost picture shows the actual pot, with the top and bottom wires connected to the voltage +5 and Ground, and the middle wire outputting the desired voltage. The middle diagram shows the symbol for a pot, and the last diagram shows the equivalent circuit.

Images are courtesy Wikimedia.org

Servo Motor Review

09 - Inside the Servo (DC Motor and Potentiometer).JPG
08 - Inside the Servo (Gears).JPG
07 - Inside the Servo (Comparators).JPG

A servo motor has four main parts.

1. A motor that can turn forwards and backwards, usually at high speed and torque.

2. A position detecting system, that can tell what angle the servo motor is at currently

3. A gearing system that can take many spins of a motor and make that into a small angular motion.

4. A control circuit that can correct the error between the actual angle and the desired set point angle.

Parts 1 and 2 are shown in the first image. Notice that part 2 is a potentiometer.

Part 3 is shown in the second image.

Part 4 is shown in the third image.

Repetitive Motion

IMG_5048.JPG
Arduino IDE.jpg
Servo Sweep software.png
IMG_5042.JPG
IMG_5043.JPG
IMG_5044.JPG
IMG_5045.JPG
IMG_5046.JPG
IMG_5063.JPG

Here we're going to make the head of our puppet "Bender" turn left and right, back and forth, as long as the power is connected from the USB cable. This is great for a fun holiday display that you want to keep moving all day long.

The Arduino comes with an Integrated Development Environment (IDE) which is a fancy way of saying it comes with an app for your PC that lets you give it instructions (the Arduino IDE icon is a sideways figure 8). Those instructions stay stored on the board even if you disconnect the PC, and they start running again when you reconnect power to your Arduino. In this case, we will be using the software called "Sweep" which you can find in the IDE examples under the category of "Servo."

Next you'll connect the servo to a capacitor stabilized 5 volts (red Servo wire to the Arduino +5, brown Servo wire to Arduino GND) and to the control signal (yellow Servo wire to Arduino ouput pin 9). The puppet head is optional ;-)

DETAILS:

If the above was a bit confusing, the detailed instructions are as follows:

Step A – Programming
the Arduino

  • Open the Arduino IDE (should be a figure 8 icon on your desktop)
  • Under “Tools” make sure the “Board” is set to “Arduino/Genuino Uno.”
  • Connect the Arduino hardware to the computer using the USB cable
  • Make sure the “Port” setting under “Tools” is also configured for the Arduino.
  • Under “Files” select the “Example” called “Sweep” (you can find it under “Servos”)
  • Before you use or edit this file, please “Save As” a different filename (can be your name, or whatever you choose). This will keep the file unchanged for the next student using this computer.
  • Use the Arrow button (or under “Sketch” select “Upload”) to upload the Sweep sketch to the Arduino

Step B – Connecting the Servo Motor to Sweep

In this part, we will be building variations of the circuits described in https://learn.adafruit.com/adafruit-arduino-lesso... We will connect the Red and Brown wires of the Servo to +5 and GND of the Ardiuno, respectively. We will also put a voltage flattening capacitor across that voltage, and finally we will connect the Yellow wire of the servo to the output pin 9 of the Arduino.

  • Unplug the Arduino from the USB port when you are building the circuit.
  • We will be using the 5V and Ground from the Arduino board so bring those over to your breadboard using the red and green wires, respectively.
  • Since the power can be a bit shaky from the USB port (not much current, and the servo motor may cause the Arduino board to reset due to low current) we will put a capacitor across this voltage, making sure the wire labeled “minus –“ is on the Ground side.
  • Now connect the Red (+5) and Brown (Ground) wired of the Servo to the breadboard.
  • The final electrical connection is that of the control signal. The SWEEP program will use pin #9 of the Arduino to send the control signal, so connect this to the yellow (control) wire of the Servo Motor.
  • OPTIONAL – You may place an Animatronic Head of your choice and its base on top of the servo motor prior to testing it out. Please be gentle as the fit is not perfect and the plastic parts break.
  • You should be able to apply USB power to the Arduino and the SWEEP program should run, causing the servo motor to sweep back and forth.

Step C - Modifying the SWEEP program

  • Before you use or edit this file, please “Save As” a different filename (can be your name, or whatever you choose). You probably did this already in step A. For each of the parts below, record your observations as well as any changes you made to the code.
  • Using a stopwatch, measure how long it takes to sweep all the way and back ________________
  • You will be making changes to the software (sometimes called “code” or “sketch”)
  • Change both the “Delay” values from 15 to another Larger number (pick a round multiple of 15 for ease of calculations). What value did you use? _______. What do you think the new SWEEP time will be? ___________. Measure the new SWEEP time and make note of any discrepancies ____________________________________.
  • Change the Delays back to 15, and now change the position angles from 180 to simply 90 (both of those values). What is the new range of motion of the servo motor (90 degrees, or more or less?) __________________.
  • Leaving the range of motion to 90 degrees, lower the “Delay” to a number less than 15. How small of a number can you go to before the servo starts to behave erratically or no longer completes the entire range of motion? ____________

After completing these steps, you'll have all the measurements and practice you need tol be ready to use your servo motor to control a variety of repetitive back and forth animatronic motions, anywhere from a small angle all the way to 180 degrees, and also at a wide variety of speeds you control.

Remote Controlled Motion

IMG_5049.JPG
IMG_5050.JPG
IMG_5051.JPG
IMG_5052.JPG
12 - KNOB circuit.JPG
IMG_5064.JPG

Instead of repeating the same motion over and over all day long, in this step we will remote control the position of our animatronic puppet "C3PO" to look left and right and any position in between. Since a human is doing the controlling, we call this "open loop" control.

With open loop control, you control the exact position of the servo motor. We will need a knob for you to turn, and we will use the blue potentiometer for this.

  • We will need another place on the breadboard that has +5 and 0 (Ground) volts. Run these jumper wires to separate rows on the breadboard, and make them one row apart from each other, to line up with the outside pins of the potentiometer we will add in a moment.
  • Now add the Potentiometer. Before pushing the potentiometer pins into the breadboard, make sure all three of them are lined up with the correct holes, and then push the pins straight down so they don’t bend. The center pin of the potentiometer will be connected to Analog Input zero (A0) on the Arduino. An additional wire is added to do that.
  • In order to read the voltage from the potentiometer, and use that to control the servo motor, we will use the “KNOB” software, also found under File -> Examples -> Servo. Run the program, turn the knob, and record what you observe.

Naturally, you could run some very long wires so that the control knob is in a different room from the animatronic puppet, or you could be only a short distance away (out of camera shot f you're making a movie, for example).

Triggered Motion (using a Sensor)

IMG_5053.JPG
IMG_5054.JPG
1.png
2.PNG
IMG_5062.JPG

Sometimes you want you puppet to move all of a sudden - especially for scary Halloween pranks or to attract even more attention. In this step, we will reconfigure our puppet "Easter Island Head" to quickly turn and face whoever walks by and casts a shadow on a light sensor.

In the case of Sensor Control of the Servo Motor, we will be using a light sensor that will control the exact position of the servo motor. The darker the shadow cast on the sensor (and presumably the closer the person walks to the puppet) the quicker and farther the puppet turns its head.

  • We will remove the potentiometer and replace it with the equivalent circuit of two resistors. In this case, one of the two resistors (R2) will be a light sensor.
  • To give us some room, we spread out the +5V (left) and 0V Ground (right) lumpers so we can add the 10K Ohm resistor and Light Sensor, connected in the center in the same row as the jumper cable leading to Analog Input zero (A0) on the Arduino board.
  • Use the shadow of your hand to obscure the light sensor, and use other ways to make the light sensor get the most and the least possible amounts of light. Are you able to get the full 180 degrees range of motion?

Just as in the remote control version, you can place the photo resistor a good distance away from your animatronic puppet, and you can change the values of the resistor, or the software programming to change the puppet reactions.

Now You Try It!

IMG_5060.JPG
IMG_5068.JPG

Now you've mastered the three basic kinds of animatronic motion you can create with a single servo motor.

- Repetitive motion

- Remote controlled motion

- Triggered motion using sensors

You can take this to the next level by using different kinds of puppets, motion, controls, and naturally, the artistry that only you can create!