Recent Changes - Search:

TEAMS Academy Wiki

Explore TEAMS!
for visiting sophomores & juniors


Robotics


EnvBioTech

Bat Design

Assistive Tech

Students

Instructors

TEAMS Forum

TEAMS Calendar

TEAMS Web Site

Wiki Info

edit Robots.SideBar

Introduction to Digital Servo Motors

Contents


DC Motors

DC (Direct Current) means that you can use a simple battery or DC power supply to power the device

  • Positive terminal ( red wire color code) = "button" or "bump" end of battery
  • Negative terminal (black or sometimes green wire color code) = "flat" end of battery
  • Contrast a DC voltage/current source with an AC (Alternating Current) power source:
    • e.g., the outlets in your home are typically 120V AC
    • the voltage (or current) is a sinusoidal wave with an average value of 0 volts

Generally speaking, inexpensive DC motors have the following attributes...

  • Rotate at high speeds (a few to several thousand rpm)
  • Typically have very low torque (turning power) -- if you were to pinch the output shaft with you fingers while the motor is on, you would be able to stop it quite easily
  • Torque typically increases with voltage (e.g., 5V motor has less torque than a 24V motor)
  • Rotational speed increases with input voltage (but don't exceed the motor's rated voltage!)
  • For robotics, the high speed and low torque combination isn't very useful.

DC motors can be found (an cannibalized from) many products around your home...

  • Motorized toys
  • CD player to spin the CD
  • Cordless drill
  • Power window and windshield wiper motors on a car
  • and many, many other applications! Look around!!

Back to top


Gearhead Motors

How can you convert a high speed, low torque output from a typical inexpensive DC motor to a low speed, high torque output? Use mechanical advantage!...

  • Use pulleys
  • Use gears

Think about a bicycle...

If you select the small crank gear attached to your bicycle's pedals, and the largest gear on the wheel sprocket, what happens??

  • You end up pedaling very fast (high input rpm)
  • You don't need to apply a lot of pressure to the pedals (low input torque)
  • The back wheel turns very slowly (low output rpm)
  • But you can go up a very steep hill -- or drag your little brother very easily (high output torque between back wheel and the road)

Gearhead motors are slow rotating, high torque DC motors

A gearhead motor has several small gears inside a housing that sits on top of the motor

  • "gearbox" or "transmission"
  • In the photo, the bulge at the top of the motor is the gear box. The small gearhead motor shown in the photo is fairly powerful and that costs about $25.
  • The cricket robots you used in October have really cheap gearhead motors (yellow plastic housing contained gear reduction)
  • Gearhead motors are very powerful (but slow)--you'd have a hard time stopping the shaft with your fingers. Grab a gearhead motor of a bin in the lab, hook it up to a battery or power supply, and try it!
  • For robotics, gearhead motors are commonly used as actuators that directly drive a wheel
    • Rotational speed by controlled by voltage
    • Direction controlled by reversing polarity (red & black wires)

Back to top



You can attach various items to the output spline...

Servo motors

Two types of servos...

Servo motors are gearhead motors that have built-in electronics that allow you to use a digital input signal to control either...

  1. The position of the output spline, or ... (standard servo)
    • Our Futaba 3003 servos can rotate 180 degrees
    • The gearbox has a component inside that stops the rotation at 0 and 180 degrees
  2. The speed and direction of rotation (continuous rotation servo)
    • We have "continuous rotation servos" as well--the package is identical
    • You can tell by rotating the output spline to see if it stops or rotates freely
    • You can either buy a continuous rotation servo or convert a standard servo to a continuous rotation servo. You can find many web resources...here's one courtesy of Kronos Robotics.

Here's a link to technical data for the Futaba 3003 servo from Servo City.

Here's an alternative overview of servo operation and use from the Society of Robots. Look around on the web for other good information.



The guts of a servo motor (thanks to servocity.com)

If you were to open up the servo motors that we will use (they cost about $12 each), you would find...

  • a small circuit board to receive the digital signal used to control the servo
  • a potentiometer used to sense the servo's output shaft (spline) position
  • a tiny DC motor (high rpm, very low torque)
  • a gearbox (see disassembled gearbox in lower photo)

Our servos are so cheap because they use plastic gears and have small motors. You can purchase much more powerful, accurate servo motors for $$$ (the sky's the limit). However, our cheap servos are probably powerful enough to lift up the Create. And, you can digitally CONTROL their POSITION or SPEED!

Note that the servo typically comes with several convenient shaft attachments as shown in the upper photo.

Back to top



Make sure the white, red and black wires
are plugged into the correct position on the Servo Controller Board!

Theory of Operation

What are the three wires?

  • red : positive terminal (to +5V)
  • black wire: Negative terminal (to Ground, or 0V)
  • white wire: digital control signal (digital output signal from your controlling device)

Never connect a servo motor directly to the Create ePorts!!

The servo motors draw too much current and you will fry the Create or Command Module! In particular, the +5V pins (pin 4) provide +5 volts, but they can only source (provide) 100 mA of current. Unfortunately, these servo motors can sink (draw, or use) 1000 to 1500 mA of current (1.0 A to 1.5 A).

To get around this problem, we have a separate battery pack (4 AA batteries) for you to use (see connections section).

Function of the Red & Black Wires:

The red and black wire provide power (4.8 to 6.0 volts + corresponding current) to the motor and to the small circuit board inside the servo's black housing.




Photo of the pulse width modulated signal
taken on an oscilloscope in our lab
  Function of White Wire: 

You will send a digital signal on the white wire to tell the servo what to do...

  • The digital signal you send is a "string" or "train" of pulses (see photo)
  • It is a "digital" signal because it only has 2 values (high and low, or +5V and 0V)
  • The digital signal sent on the white wire is called a pulse width modulated (PWM) signal

Pulse Width Modulation: Controlling the width of the "high" pulse controls the servo!

The precise width of the "high" pulse controls...

  1. For standard servos: the position of the servo output spline (0 to 180 degrees)
  2. For continuous rotation servos: the speed and direction of rotation




Pulse Width:

The width of these control pulses ranges from about 1000 to 2000 microseconds - you must carefully control the pulse width to control the servo. Here are some examples of what a few key values do...

  • A short pulse (1000 us) would ...
    • For a standard servo: turn the shaft to the 0 degree position
    • For a continuous servo: rotate the shaft counterclockwise at it's fastest speed
  • A medium pulse (1500 us) would ...
    • For a standard servo: turn the shaft to the 90 degree position
    • For a continuous servo: stop the shaft from rotating
  • A long pulse (2000 us) would ...
    • For a standard servo: turn the shaft to the 180 degree position
    • For a continuous servo: rotate the shaft clockwise at it's fastest speed

If your pulse widths are off a little, the servo will end up in the wrong position! Precision is key!! If you don't keep the pulse with constant, the servo will "jitter" from one position (or speed) to another



Thanks to multiple sources for the PWM diagrams

Period:

  • Remember, the period is the time it take for a pattern to repeat
  • The period for a servo's repeating pulse pattern is about 14 to 20 milliseconds
  • Unlike the pulse width, the period does not have to be quite as accurate

OK, so how do I make a servo work with the Create?

If this was a more advanced course, you would have to...

  1. Figure out how to power the servo without frying the Create
  2. Write a function that would carefully send out a precise pulse train.

TGFG - Thank goodness for Greg! He did this for you!! Read on...

Back to top



Click here for full size photo

Connecting to the Create - it's EASY!!!

Here's the hardware you'll need...

  1. A Cricket Display
    • Model CX-4DIGIT, $29.00 (Gleason Research)
    • Use the DB-9 adapter and plug into the Cargo ePort
  2. A Cricket Servo Controller Board
    • Model CX-SERVO, $29.00 (Gleason Research)
    • Plug this into the port on the back of the Cricket Display (see left closeup photo below)
    • The red and green LEDs are use for...
      • red LED: Indicates the power from the battery pack is ON. Be sure to turn off battery pack aftrer you are done!
      • green LED: Indicates that Cricket Servo Controller Board is connected to AND communicating with the Cricket Display
  3. A Four-AA battery pack & batteries
    • We already attached the Cricket Servo Controller Board to the back side of a battery pack for you
    • Connect the red battery pack wire (+6 volts) to the positive (+) screw down terminal
    • Connect the black battery pack wire (0 volts or ground) to the negative (-) screw down terminal
    • You should also put an on/off switch in series with one of these wires (we added one to the ground wire for you)
  4. Servo Motors - BE CAREFUL TO PLUG IN THE CORRECT POSITION!!!
    • See photos below!!
    • The Cricket Servo Controller Board can handle up to eight servos!
    • The 3-position header plug on the servo connects to one of the eight labeled positions on the header strip (the 3 rows of gold prongs sticking up on the controller board)
    • In the photos above you can see a servo plugged into the Port 0 (zero)
    • Note that the ...
      • WHITE WIRE plugs into the pin nearest the computer chip
      • BLACK WIRE plugs into the pin nearest the outside edge of the board

Click here for full size photo

Click here for full size photo


Back to top


Programming the Create to use Servo Motors - It's Really Easy!

Here's the new function Greg added to the TEAMS Template Files (be sure to download te latest versions of create.h and create.c):

Function:

cr8_cricket_servo_set(serv0_port_number, servo_position);

Parameters:

  • serv0_port_number
    • uint8_t value from 0 to 7
    • indicates which of the eight possible servos you are using
  • servo_position
    • uint8_t value from 0 to 255
    • For standard servos:
      • indicates what shaft position to turn to.
      • Although the Futaba 3003 servos have a 180 degree range of motion, the Cricket Servo Controller board only allows about 120 degrees of motion using the 0 - 255 'servo_position' parameter
    • For continuous rotation servos:
      • indicates the speed and direction of rotation, for example...
      • servo_position = 128 stops rotation
      • servo_position = 0 rotates the shaft a maximum speed clockwise
      • servo_position = 255 rotates the shaft a maximum speed clockwise

Here is a sample program that demonstrates using a servo...

Example Code for using Servo Motors with the Cricket Servo Controller

Back to top


Edit - History - Print - Recent Changes - Search
Page last modified on December 18, 2008, at 09:44 AM