+ All Categories
Home > Documents > The Servo Motor - Introduction

The Servo Motor - Introduction

Date post: 20-Feb-2018
Category:
Upload: bobbyccw
View: 219 times
Download: 2 times
Share this document with a friend

of 13

Transcript
  • 7/24/2019 The Servo Motor - Introduction

    1/13

    The Servo motor is a amazing device that can turn to any specified position within 180

    degrees of motion.

    The big difference between this and other motors is the fact that it has a built in gearbox and the controller inside so its comes as a ready package which is far more

    accurate. Another big difference is the fact that most servo motors can only turn within

    180 degrees of motion instead of the 360 that most dc motors turn.

    Servos are commonly found in rc toys, like cars (to control steering) or rc planes (to

    control rudder movements)

  • 7/24/2019 The Servo Motor - Introduction

    2/13

    Step 1: The Different Types Of Servos

    Servos come in many shapes and sizes, so which one is best for you and your project,

    well that depends on what it's needed for. Most projects will probably do just fine with

    the Tower Pro micro servo (the blue one) the great thing about this servo is that it is

    very accurate, very light and very inexpensive however they can not move a lot of

    weight making them good for small moving parts like sensors. The next servo is much

    stronger it's called the tower pro mg995 and it's great for moving heavier objects like

    robot body parts (arms or legs). The last one I will talk about is the 360 degrees servo

    which if you haven't guess yet can turn a whole 360 degrees these normally have quite

    high torque mainly because they are used as driver wheels on robots.

    These are the most common 3 I have used but don't be fooled there are many more

    out there

  • 7/24/2019 The Servo Motor - Introduction

    3/13

    Step 2: How To Get It Running With Your Micro Controller (arduino)

    Servos can only work when they are told what to do by a micro controller so to getyour servo running nicely you will need:

    - an arduino

    - a computer with arduino IDE

    - the appropriate connection cable for your arduino

    - a servo

    - jumper wires

    - The servo library's (which can be found here

    http://playground.arduino.cc/ComponentLib/Servo)

    And a bread board

  • 7/24/2019 The Servo Motor - Introduction

    4/13

    Plug your servos signal cable into pin 9

    And the Vcc cable into the 5v pin and ground into ground

    Then upload this code:

    #include

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

    // a maximum of eight servo objects can be created

    int pos = 0; // variable to store the servo position

    void setup()

    {

    myservo.attach(9); // attaches the servo on pin 9 to the servo object

    }

    void loop()

    {

    for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees

    { // in steps of 1 degree

    myservo.write(pos); // tell servo to go to position in variable 'pos'

    delay(15); // waits 15ms for the servo to reach the position}

    for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees

    {

    myservo.write(pos); // tell servo to go to position in variable 'pos'

    delay(15); // waits 15ms for the servo to reach the position

    }

    }

    Step 3: How A Servo Works

  • 7/24/2019 The Servo Motor - Introduction

    5/13

    Here is the best description of servos I've ever read by an author at servo city if you

    find it helpful please give them a visit

    "Servos are controlled by sending them a pulse of variable width. The source wire is

    used to send the pulse. The parameters for this pulse are that it has a minimum pulse,

    a maximum pulse, and a repetition rate. Given the rotation constraints of the servo,

    neutral is defined to be the position where the servo has exactly the same amount of

    potential rotation in the clockwise direction as it does in the counter clockwise direction.

    It is important to note that different servos will have different constraints on their

    rotation but they all have a neutral position, and that position is always around 1.5

    milliseconds (ms).

    The angle is determined by the duration of a pulse that is applied to the control wire.

    This is called Pulse width Modulation. The servo expects to see a pulse every 20 ms.The length of the pulse will determine how far the motor turns. For example, a 1.5 ms

    pulse will make the motor turn to the 90 degree position (neutral position).

    When these servos are commanded to move they will move to the position and hold

    that position. If an external force pushes against the servo while the servo is holding

    a position, the servo will resist from moving out of that position. The maximum amount

    of force the servo can exert is the torque rating of the servo. Servos will not hold their

    position forever though; the position pulse must be repeated to instruct the servo tostay in position.

    When a pulse is sent to a servo that is less than 1.5 ms the servo rotates to a position

    and holds its output shaft some number of degrees counterclockwise from the neutral

    point. When the pulse is wider than 1.5 ms the opposite occurs. The minimal width

    and the maximum width of pulse that will command the servo to turn to a valid position

    are functions of each servo. Different brands, and even different servos of the same

    brand, will have different maximum and minimums. Generally the minimum pulse will

    be about 1 ms wide and the maximum pulse will be 2 ms wide.

    Another parameter that varies from servo to servo is the turn rate. This is the time it

    takes from the servo to change from one position to another. The worst case turning

  • 7/24/2019 The Servo Motor - Introduction

    6/13

    time is when the servo is holding at the minimum rotation and it is commanded to go

    to maximum rotation. This can take several seconds on very high torque servos."

    Information provided by servo city

    Step 4: Thanks For Reading

    Thanks to everyone who read this I do hope you learnt something and as always if

    you have any question please leave them in the comments and I'll try my best to get

    back to you.

  • 7/24/2019 The Servo Motor - Introduction

    7/13

    Converting Micro-Servos for Continuous Rotation

    Micro-servos are great devices perfect for adding motion to your projects. Unlike

    steppers, they can be controlled directly from your Arduino or other favorite

    microcontroller. Most servos are limited to 180 degrees of motion. This allows

    microcontrollers to know the exact position of the servo's shaft. You can find

    continuous rotation servos, but if you have access to lots of cheap micro-servos of the

    180 degree variety, it might be helpful to learn this quick hack to make them

    continuous.

    What You'll Need

    A 9g micro-servo;

    Needle nose pliers;

  • 7/24/2019 The Servo Motor - Introduction

    8/13

    Screw drivers matching screws on your servo;

    A 1.4mm flat head screw driver;

    Box cutter or hobby knife;

    Superglue;

    Arduino or other microcontroller to test your servo (including USB cable to attach

    to your computer) and; Jumper wires to hook your servo up to your Arduino for testing.

    Step 1: Open Your Servo's Case

    This is simple. Just unscrew the screws usually found on the bottom of the servo case.

    Next, very carefully open the case and try not to knock out any of the gears.Sometimes they are just barely hanging in there and the pressure of the case is all

    that is keeping them in place.

    Next, take a picture of how everything looks before going any further. You will thank

    me later when it is time to put it all together. I know what you're thinking, "I can

    remember how it goes back together." Trust me, take a picture! I've included one of

    the 9g Tower Pro we have here at Maker Zoo. Yours might be identical, or maybe a

    little different.

  • 7/24/2019 The Servo Motor - Introduction

    9/13

    Step 2: Modify Topmost Gear

    The topmost gear needs to be removed. Take a look underneath and notice what

    should be a tab. This tab is part of what limits the servo's motion to 180 degrees.

    You're going to need to shave it off with your box cutters or hobby knife.

    Be very careful with your hands and fingers because the gear is small and difficult to

    hold on to while cutting. Take your time, and don't rush through this step. Take a little

    material off at a time to reduce the amount of force needed.

    Next, look closely at the hole that this topmost gear fits onto the shaft with. It is a

    semicircle. To make sure it spins freely on the shaft 360 degrees, we need to auger

    out material to make it a full circle. Using an approximately 1.4mm jeweler's

    screwdriver, slowly twist it until the hole becomes circular.

  • 7/24/2019 The Servo Motor - Introduction

    10/13

    Step 3: Remove all the Gears and Glue the Potentiometer

  • 7/24/2019 The Servo Motor - Introduction

    11/13

    Remove the rest of the gears. Keep the servo sitting up and support it with something

    if necessary for this next step. Get your pliers (though you could use your fingers if

    you are very dexterous), and twist the shaft of the potentiometer. You will notice its

    180 degrees of rotation to the left and right. Twist it back and forth a few times to get

    an idea of where center is, then leave it as close to center as you can.

    Next, you need to carefully apply some superglue around the base (not on the shaft)of the potentiometer. Give it some time to dry. Gently blow on it and if you see the glue

    moving, it isnt dry yet. If you were careless when gluing and assembling the servo

    while it is still wet, you might glue everything together! Disaster!

    Step 4: Reassemble the Servo

    Once the superglue is fully dried, using the picture we took at the beginning after

    removing the case, we can reassemble the gears carefully. Place the top cover of the

    casing back on, making sure it is securely and properly fitted in place. Then screw the

    case closed with the four screws removed in Step 1.

  • 7/24/2019 The Servo Motor - Introduction

    12/13

    Step 5: Testing Your New Continuous Servo

    Now that you have everything put back together, its time to test the servo and make

    sure the conversion was successful. An Arduino is perfect for this and all you need to

    test it is your Arduino (were using an UNO board), 3 jumper wires, and a USB cable

    to connect the UNO to our computer. On our servos, the brown cable is ground, red is

    positive, and orange is for the signal. Connect ground to GND on your Arduino, postive

    to 5V on your Arduino, and the signal wire to pin 9 on your Arduino. (Note: A servo

    under any kind of load should not be hooked up to your Arduino like this, it could

    overdraw amps and cause your Arduino to reset or burn it out. But here we are just

    testing rotation, and just for a short time.)

    We typed in and uploaded the following code:

    //Test continuous servo conversion

    #include Servo myservo;

    void setup() {

    myservo.attach(9);

    }void loop() {

    myservo.write(180); //clockwise rotation

  • 7/24/2019 The Servo Motor - Introduction

    13/13

    delay(2000); //rotation duration in ms

    myservo.detach(); //detach servo to prevent creeping effect

    delay(500); //short pause

    myservo.attach(9); //reattach servo to pin 9

    myservo.write(0); //counterclockwise rotation

    delay(2000); //rotation duration in ms

    myservo.detach(); //detach servo to prevent creeping effect

    delay(500); //short pause myservo.attach(9); //reattach servo to pin 9 before looping

    }

    180 causes your servo to spin clockwise at full speed. 0 causes it to spin

    counterclockwise at full speed. Values of 45 and 135, for example, have the servo spin

    slower in their respective directions while 90 theoretically should keep the servo at rest.

    However, we say theoretically because the servo is never really perfectly centered.

    This causes the servo to creep ever so slowly in one direction or another. Besides

    being annoying it also ruins the accuracy of your project. So to prevent this creeping,

    we attach and detach the servo when necessary in the above Arduino code. Detaching

    it leaves it unpowered and therefore completely at rest.

    Closing Thoughts

    Now you have a continuously rotating servo that you can use alone for various projects,

    or pair up to power a robot or anything else you can imagine. There are definitely many

    other ways to do this particular hack. And there are obviously many better options you

    can use if you have the time and money to source them than a hacked continuously

    rotating servo. But in case you have a bunch lying around and want a quick solution,

    here it is.

    At Maker Zoo we've used this hack while developing our open-source Arduino robot,

    and are currently using it for an upcoming IoT project. An automatic fish feeder we are

    redesigning also used this very hack and operated for a year and a half without any

    problems. Just be careful with the final position of the potentiometer before gluing. If

    you didn't center it, the whole hack will fail. Good luck!


Recommended