Shop OBEX P1 Docs P2 Docs Learn Events
Basic stamp servo control problem — Parallax Forums

Basic stamp servo control problem

buggybuggy Posts: 6
edited 2008-03-24 00:11 in BASIC Stamp
Hi,
I am working on a replica industrial robot arm. It uses normal servo's as the joint motors, and I was hoping to program it with·my basic stamp2.
I have fully build the actual arm itself but I have run into a problem controlling the servos. Just for a test i hooked up one servo to the stamp using the code below:

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

x VAR word
FOR x = 1 TO 150
PULSOUT 0, 750

PAUSE 20
NEXT
END


Nothing is happening. I know that the servo is getting power, as it moves a little when i plug it into my 6 volt battery supply, but it does not center itself. I happened to have a continuous rotation servo on hand, and tried attaching it for a comparison; it worked perfectly.I am fairly sure that my wiring is not the problem as the other servo worked but past that I am lost. I plugged this same servo into an rc reciver, and was able to control it with my transmitter just fine. This makes me think that it is not a problem with the servo itself. The continuous rotation servo was from parallax, as was the non-working servo. I am also using some Fubata servos on the arm itself, and none of them work either.
If anyone could help me i would be very grateful as my deadline is only a few days away!
Thanks a bunch!

Comments

  • rage404rage404 Posts: 17
    edited 2008-03-19 02:42
    try this

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    x VAR Word
    DO
    FOR x = 500 TO 1050 STEP 10
    PULSOUT 0, x
    PAUSE 20
    NEXT
    PAUSE 1000
    LOOP

    you may want t be careful with this program as in my case it runs my standard hobby servo 90 degrees. Good luck.

    Post Edited (rage404) : 3/19/2008 2:51:19 AM GMT
  • buggybuggy Posts: 6
    edited 2008-03-19 03:51
    Thanks for the quick reply,
    my servo is now moving, but I am having trouble choosing the position. I modified your code a little bit by removing the x after the pulsout and replacing it with multible different numbers trying to change the position, but it is still fighting against its limits. If you could show me how to get it to move and hold at a different position that would be great. I thought that any between 500-1000 detirmined the angle of the horn, but it will not adust.
    Thanks again!

    PS: I think that the 3 pin connectors that i was using to connect the servo to the breadboard may have been a little short creating a bad connection
  • FranklinFranklin Posts: 4,747
    edited 2008-03-19 04:01
    Do you have a servo on the bench not mechanacally connected to anything? If so use that one for testing and start with 650 to 850 as a range of motion.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • terry_bearterry_bear Posts: 84
    edited 2008-03-19 14:20
    buggy,

    Did you mechanically center the servo first? Also, my experience indicates that the numbers in Parallax's example are good starting points, but your servos could vary quite a bit. I have one servo whose counter-clockwise limit seems to be 1070 and clockwise is 210

    Your original code was close, but needs DO... LOOP, as rage404 mentioned. I wouldn't suggest deviating from the number of pulses (150) because doing so could cause "duration" numbers to be misleading...

    It's also a good idea to "sneak up" on the limits by changing the duration in steps of 10, as rage404 did.

    For what it's worth,

    Terry
  • buggybuggy Posts: 6
    edited 2008-03-20 14:21
    Thanks for all of the great imput,
    I think its working now, but i will know for sure in a few days.
    Thanks again!
  • buggybuggy Posts: 6
    edited 2008-03-23 21:55
    Hello again,

    Turns out im still having trouble. I have now managed to get some servo's working but have a new problem. I cannot seem to control the directon of the servo. I have put in a variety of numbers but it still will only turn in one direction.

    Thanks!
  • FranklinFranklin Posts: 4,747
    edited 2008-03-23 23:24
    What do you get if you use 750? 650? 850? let us know.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • buggybuggy Posts: 6
    edited 2008-03-23 23:41
    Franklin-
    All of the numbers that you listed have the same effect. It always moves in the same direction.
  • FranklinFranklin Posts: 4,747
    edited 2008-03-23 23:45
    So, what happens if you do it in the opposite order? You are using REGULAR servos and not continous rotation servos I hope.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • buggybuggy Posts: 6
    edited 2008-03-23 23:50
    Yes, I am using normal 180 degree servo's.
    What do you mean by doing them in the opposite order?
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-03-24 00:11
    You are running both a Signal and a Ground wire from the BS2 to the servo, right?

    Because the BS2's servo control pulse is referenced to the BS2's ground. That ground should be connected to the Servo power supply ground (if you have a separate Servo power supply) to insure the control signal has a good reference ground.
Sign In or Register to comment.