Shop OBEX P1 Docs P2 Docs Learn Events
How to control a modified (to continously rotate) servo?? — Parallax Forums

How to control a modified (to continously rotate) servo??

pratikenpratiken Posts: 5
edited 2012-07-02 08:24 in Robotics
Hi!
I bought a servo off of servocity.com and had it modified by them to run continuously. Now though, I cannot seem to control it in pbasic. Once it starts rotation, it keeps going. After a little research, I guess this is what it's supposed to do!

What do I need now to get this thing controllable by my pbasic programs? The Parallax continuously rotating servos are able to be controlled, why can't this one as well?

From what I understand, by modiifying it like this, they basically turned it into a gear motor and no longer a servo. Do I need to buy some sort of motor controller now? Does Parallax have any for sale?

Thanks guys, all help is much appreciated!


Here's the servo I bought
http://servocity.com/html/hs-5585mh_servo.html

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-06-29 20:59
    You might want to take a look at Robotics with the BOE-Bot. A CR servo uses the pulse length to control the speed instead of the position. A pulse of 1500us should stop the servo from rotating. Longer pulse length will cause the servo to rotate one direction and shorter pulse length should cause the servo to rotate in the opposite direction.

    Edit: Does your CR servo still have a potentiometer? You can use the pot to calibrate the servo so it says still when it receives a 1500us pulse.
  • pratikenpratiken Posts: 5
    edited 2012-06-29 21:13
    Thanks for the speedy response Duane!

    I looked over that section of the manual and can't quite figure out what you mean by 1500us?

    As a basic test, I tried
    counter VAR Word

    FOR counter = 1 TO 120
    PULSOUT 14, 850
    PAUSE 20
    NEXT

    FOR counter = 1 TO 124
    PULSOUT 14, 650
    PAUSE 20
    NEXT


    The servo begins to rotate very fast clockwise and then continues to do so without stopping and changing directions.

    I can barely zero in the dang thing. I set it to 750 and can BARELY get it to stop using the small potentiometer attached to it.

    This thing is very frustrating!
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-06-29 21:52
    pratiken wrote: »
    I looked over that section of the manual and can't quite figure out what you mean by 1500us?

    The "PULSOUT" statement uses 2us increments so "PULSOUT 14 750" sends a pulse of 1500us.

    It can be easier to zero the servo if you use a multi-turn trim pot instead of a normal pot.

    Digi-Key no longer sells the ones I use, but this one should work.

    According to erco a 10K trim pot also works and 10K units might be less expensive than the 5K trim pots.
  • pratikenpratiken Posts: 5
    edited 2012-06-29 21:59
    It's very strange. I set it to 750 and then use the pot to get it zeroed. When I let it sit for maybe 10 seconds it starts to very slowly move. Either way, if it's that close shouldn't it react somewhat to 650 and 850?
  • FranklinFranklin Posts: 4,747
    edited 2012-06-30 11:50
    Either way, if it's that close shouldn't it react somewhat to 650 and 850?
    Yes it should but you might try 500 and 1000. It also depends on the stamp you are using, which one is it?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-06-30 14:07
    pratiken wrote: »
    It's very strange. I set it to 750 and then use the pot to get it zeroed. When I let it sit for maybe 10 seconds it starts to very slowly move. Either way, if it's that close shouldn't it react somewhat to 650 and 850?

    Yes, I'd think it would react with either 650 or 850.

    Do you have a link to the method you used to convert the servo to CR? (Though I doubt this should be the problem.)

    It might help if you post your entire code. Use code blocks to post code instead of quotes so the indentation is preserved.

    Here's a link to a tutorial of using code blocks.

    attachment.php?attachmentid=78421&d=1297987572



    BTW, it's my observation that most servo problems I've seen on the forum arise from power supply problems. A servo pulls a lot of current when it first starts to move which can cause the voltage to dip and the Stamp to reset. What are you using for a power supply?
  • ercoerco Posts: 20,256
    edited 2012-06-30 15:17
    Run this code and report back. It should start full speed in one direction, slow down, stop, and reverse direction gradually.

    FOR W1= 500 to 1000
    PULSOUT 14, W1
    PAUSE 20
    NEXT
  • pratikenpratiken Posts: 5
    edited 2012-06-30 18:05
    THANK YOU for the replies! This thing is pretty frustrating to figure out!

    erco, your code did exactly that. Reversed directions just fine. However, it doesn't stop. Once W1 gets to 1000, it keeps rotating.


    I tried:
    ' {$STAMP BS2}       
      
    counter VAR Byte     
    
      FOR counter = 1 TO 120
        PULSOUT 14, 850
        PAUSE 20
      NEXT
    PAUSE 5000
      FOR counter = 1 TO 120
        PULSOUT 14, 650
        PAUSE 20
      NEXT
    

    It does some very strange stuff. First, it starts going CW at 850 for a few seconds. Then it slows down for a few seconds, then it starts going CCW slowly, then a little faster CCW, then gradually goes to very fast CCW. Then it starts gradually going back down. That's not written in the code ANYWHERE!

    I should take a video of it with my iphone, it's the weirdest thing.

    It's hooked up to the BoeBot board and it's plugged into the wall.
  • pratikenpratiken Posts: 5
    edited 2012-06-30 18:35
    I should add that it did NOT pause for 5s at any point. This thing won't recognize when to stop! I only need it to make a 360* CW rotation once every like, 20 seconds!! UGH!!
  • ercoerco Posts: 20,256
    edited 2012-07-02 02:33
    It should stop at a pulsout value of 750. I think you have a power issue, you need a seperate power supply for your servos. Your single AC adapter isn't up to the task.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-07-02 08:24
    You shouldn't be using a "PAUSE 5000" anywhere in your code when you're using a servo.

    As erco said, the servo needs a pulsout of 750 to stop and it should keep getting this pulse 50 times a second.

    One of the big challenges of writing code for the BS2 (and many other uCs) is the need to keep pulsing the servos every 20ms (some can go a bit longer without a pulse).

    So even though you only need to rotate the servo every 20 seconds, you'll still need to send it pulses to tell it to stay still the rest of the time. You could use a relay on the servo's power line to turn the servo on and off if you don't what to keep sending it pulses.

    There's also the Servo Pal that will keep sending a signal to the servo for you.

    As erco mentioned (and I believe an earlier post mentioned the same thing), servo projects often have power supply issues. Many AC adaptors don't provide enough current to keep your BS2 happy when the servo starts to move.

    Edit: A Propeller board such as the QuickStart could be used as a Super Servo Pal. If anyone wants to use a Propeller this way, let me know and I'll write some code that will read in a pulse on one pin and keep sending the same pulse on a different pin. It would be easy to write the code for a six-servo, Servo Pal using a Prop. An additional eight servos could be added to these six with a bit of extra work. I don't know of an object to read from 14 different pins at once so I'd need to modify one of the current objects before making a 14-servo version of a Servo Pal.
Sign In or Register to comment.