Shop OBEX P1 Docs P2 Docs Learn Events
Servo basics (moving a servo with a BS1) — Parallax Forums

Servo basics (moving a servo with a BS1)

Luke1Luke1 Posts: 7
edited 2006-06-30 19:37 in Robotics
Hi


I am using a BS1 Rev A to try and drive a servo to understand how this works. The servo is a GWS SO3N.



I have a seperate power supply for the stamp and servo. I can get a noise from the servo but no movement. The programme looks like,







PULSOUT 0, 150
PAUSE 18



I would be very grateful for help.



Thanks



Luke

Edit: Added a subject

Post Edited By Moderator (Ryan Clarke (Parallax)) : 6/27/2006 9:18:23 PM GMT

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-06-27 15:29
    Luke,

    ·· There must be more to your program, since servos require refreshing to move to a new position and maintain it.· Please post your whole program.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com


    Post Edited (Chris Savage (Parallax)) : 6/27/2006 5:05:01 PM GMT
  • Luke1Luke1 Posts: 7
    edited 2006-06-27 15:46
    Chris



    Thanks for your reply. I think you have hit the problem. I am so new to this that I do not understand what to enter to refresh or get this working. Do you have a sample program that I might use?



    Thanks

    Luke
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-06-27 17:06
    Luke,
    ·· You need to loop your program...Of course, this will only move the servo to the position you specified and hold it there, but it shows the concept of refreshing the servo every 20 ms.
    Main:
      PULSOUT 0, 150 
      PAUSE 20
    GOTO Main
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Luke1Luke1 Posts: 7
    edited 2006-06-27 18:50
    Chris,
    Thanks for your help. I have tried this and whilst the servo makes lots of encouraging noises, I am still unable to get it to rotate!. Do you have any easy guide to this sort of thing that I can read. I must be doing something wrong.
    Thanks
    Luke
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-06-27 19:03
    Luke,

    ·· If the servo is not a contiuous rotation servo it won't rotate.· It will move to a position and stay there until the pulse value changes.· Also, you can edit your posts when you make a mistake instead of starting a new post.· Just click the pencil icon at the top-right.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Luke1Luke1 Posts: 7
    edited 2006-06-27 19:29
    Chris

    Thanks. The servo is not even moving to a position, so I am not sure I have got it working yet. Do you have a link to a guide to servos and BS?

    Thanks

    Luke
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-06-27 19:34
    If the servo is already in that position it will not be moving, but merely trying to hold it's position.· Our tutorial that covers servos focuses on the BS2, not the BS1, but the concepts are the same.· You would need to modify your PULSOUT to adjust for the BS1 resolution, which is 10us as opposed to the BS2 which is 2us.· You can find the "What's A Microcontroller?" linked below.· I hope this helps.

    http://www.parallax.com/dl/docs/books/edu/wamv2_2.pdf

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2006-06-27 21:17
    Hi Luke,

    Here is a simple BS1 code to move a servo back and forth (standard servo)

    ' {$STAMP BS1}
    ' {$PBASIC 1.0}
    
    SYMBOL  x  = B2
    
    Main:
     FOR x = 100 TO 200 STEP 5
      PULSOUT 0, x
      PAUSE 20
     NEXT
    
     FOR x = 200 TO 100 STEP -5
      PULSOUT 0, x
      PAUSE 20
     NEXT
    
    GOTO Main
    
    



    Note that the servo signal line (the white wire) is connected to I/O pin 0.

    Hope this helps,

    Ryan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke
    Parallax Tech Support

    RClarke@Parallax.com
  • Luke1Luke1 Posts: 7
    edited 2006-06-30 18:16
    Ryan

    Thanks for your help. I have used your programme. The servo itself moves from side to side but the rotor does not change. I am beginning to suspect that this means I have a bad servo and need to try adiffert one.

    Any more ideas?

    Thanks

    Luke
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-06-30 19:37
    What does the sentence "The servo ITSELF moves from side to side, but the ROTOR does not change"?

    What's a ROTOR? And how can the "SERVO" 'move'?

    A "Servo" is basically a black can, with a shaft coming out of the top. The shaft is splined, and you can put a wheel or an 'arm' on the end of the shaft. When the servo moves the shaft, the wheel or 'arm' moves.

    If you haven't affixed the servo to anything...
Sign In or Register to comment.