Shop OBEX P1 Docs P2 Docs Learn Events
Servo Question — Parallax Forums

Servo Question

FnordcorpsFnordcorps Posts: 8
edited 2008-12-06 20:20 in BASIC Stamp
I am using a HS-311 servo on a basic stamp 2 BOE board. And can't seem to get my servo to move more than a degree
or so. Most of the time the servo just sits there buzzing.

I have the white control lead connected to a 220ohm resistor then into pin14

The red and black are going to an external power supply of 5.5V

When I run the following program the servo just sits there buzzing, I have tried changing the values on the pulsout between
500/1000 with no effect. I have also tried some of the servo tutorial programs to see if I could get something to affect
the servo but the most I could get was a barely visible flip-flop back and forth on the servo.

' {$STAMP BS2}
' {$PBASIC 2.5}

DO
PULSOUT 14, 500
PAUSE 20
LOOP

I cant see anything wrong with any of my wiring (there are only 3 connections!) any ideas anyone?

thanks in advance

Tim


Also can someone tell me if it is possible to control a digital servo with the Basic Stamp 2. Would I use the same Pulsout
program (If I can get this one to work that is!)

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-06 18:44
    Remember that a servo can draw over 1A of current sometimes. The behavior you describe often is due to an inadequate power supply.

    1) Make sure the servo power supply ground (black lead) is connected to or is the same as the Stamp's power supply.

    2) It's usually better to have a little more "headroom" for the Stamp's and the BOE's regulator. 0.5V is just a bit too close. You should be using something more like 6V for Vin, but no more than 7.2V if you're driving servos off it.

    Most digital servos work exactly the same as analog servos except their internal controller is digital instead of analog. Some newer servos also have the ability to provide position feedback and/or work via a high speed serial protocol which is usually proprietary.
  • FnordcorpsFnordcorps Posts: 8
    edited 2008-12-06 19:30
    Thanks for the reply, just wondered why the ground has to be on the same as the stamps ground? Is it not possible then to have a
    seperate power supply for the servos, eg the board powered by the 9v battery and the servos powered by 4 x 1.5v batteries?

    The way I have it set up is I split the white wire off the servo and plugged it into pin 14 (am I right using a 220 resistor in the line?) and have
    the black and red connected to 4x1.5v batteries. I did this because I read that if you are powering the board off a 9v battery this could fry
    the servos.

    Thanks again for your help
  • SRLMSRLM Posts: 5,045
    edited 2008-12-06 19:51
    The ground has to be constant so that all signals sent from the uC to the servo are the same relative values. When you connect just ground, you are not powering the servos off of the board. Also, if you choose to, you can power it from the board. The BOE has four headers on the upper right. As long as your header is set correctly and the power switch is at position 2, you can hook a servo directly to the board. The reason for this is because your regulator provides the 5 volts output to the servo, regardless of what the battery voltage is (assuming that the voltage is >~6 volts).
  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-06 19:53
    All voltages are relative to some other point, usually called "ground". The servos use the same ground internally for the motor supply and for the control pulse. If you don't connect the "ground" point of the power sources together, in your case, the servo control pulse has no reference point and the logic input signal doesn't mean anything.

    You're correct that you can't power the servos with a 9V supply without damaging them. Connecting the grounds together doesn't supply 9V power to them as long as the +9V wire doesn't go to the servos.

    Using a 220 Ohm (or even as high as 1K) resistor in series with the servo control signal helps attenuate noise from the servo motor that may come back from the servo (induced in the control line). It's also a good general rule that putting a 220 Ohm resistor in any I/O line from the Stamp can protect the I/O pin from an accidental wrong connection of that pin to some unexpected voltage source, usually connecting a Stamp output by accident to some other device's output pin with the two pins in opposite states (one high and one low).
  • FnordcorpsFnordcorps Posts: 8
    edited 2008-12-06 20:20
    Thankyou both, that was extremely helpful
Sign In or Register to comment.