Servo reverse


Closed Thread
Results 1 to 7 of 7

Thread: Servo reverse

  1. #1
    Join Date
    Jan 2009
    Posts
    2

    Default Servo reverse

    Hello,
    I have a question about reversing servos i am currently building a remote controlled boat that has a turret with a fishing pole with reel and everything on it (cool?) but i can only get my servos to turn one way. I have tried messing around with different values with pretty much everything but the most i could get was a fidget in the opposite direction. Here is my code.
    Code:
    symbol TRISB = 134
    symbol TRISA = $85
    symbol PORTB = 6
    symbol PORTA = 5
    poke TRISB,0
    poke TRISA,255
    main:
    peek PORTA,B0
    if bit0 = 1 then Go_Turret     'drive turret
    if bit0 = 0 then main          'check again
    Go_turret:
    peek PORTA,B0                  'check portA values
    if bit1 = 1 then turret_left
    if bit2 = 1 then turret_right
    if bit3 = 1 then pole_up
    if bit4 = 1 then pole_down
    goto main
    
    turret_left:              'moves turret left
    low 1                     'should move clockwise?
    pulsout 1, 1000
    pause 10
    goto main
    
    turret_right:             'moves turret right
    high 1                    'should move counterclockwise?
    pulsout 1, 1000
    pause 10
    goto main
    
    pole_up:                  'moves the pole up
    low 2                     'move servo clockwise?
    pulsout 2, 1000
    pause 10
    goto main
    
    pole_down:                'moves the pole down 
    high 2                    'should move servo counterclockwise?
    pulsout 2, 1000
    pause 10
    goto main
    The manual says that the initial state of the pin determines the polarity of the pulse, so i added the LOW and HIGH values before it sends the pulse but I'm thinking that its not that easy. I have tried to adapt a sweeping program but i couldn't get it to run continuously, any help in getting them to turn the other way would be greatly appreciated.
    Thanks

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Lightbulb

    Hi,

    First : Three big misunderstandings ...

    1) LOW before PULSOUT is just to ensure the servo pulse will be positive. NEVER use "high" it could damage your servos ...

    2) Servo positions ... 1000 µs is right, 1500 µs is centered, 2000 µs is left ( mainly - left and right can be inverted ) To change position, you must change pulse value ...

    3) The Pulses MUST be sent regularly @ ~ 30-50 times per second. Even if the servo has to keep on its position.


    Smooth movement will be chapter 2 ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Hi bill_23,

    Unless you are using a 4o MHz oscillator you might want to revise your PULSOUT statements. For 4 MHz your PULSOUT resolution will be 10 µs.

    Also depending on your servos (90º, 120° or 180°) and the desired range of movement you might want to change the 1000-2000 µs window to a narrower one. Keep in mind your 1500 µs pulse will be your center.

    Regards,

    Nick

  4. #4
    Join Date
    Sep 2007
    Location
    USA, CA
    Posts
    271


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    3) The Pulses MUST be sent regularly @ ~ 30-50 times per second. Even if the servo has to keep on its position.
    For clarification for the less experienced...

    Alain is ONLY talking about old fashioned "cheap" analog servos. Most of the new digital servos (which aren't all that expensive, either) will accept a single pulse; they will go to that position and hold. I've used some in an application where the maintenance of an analog servo position was not practical.

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Talking nice one !

    Hi, Tenaja

    It can be a trick ... but here, it is not "genuine planned" : the servo, receiving no new pulse, keeps position as a Failsafe ...

    Not all brands do that ... so, it must be checked before use ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  6. #6
    Join Date
    Jan 2009
    Posts
    2


    Did you find this post helpful? Yes | No

    Default

    Wow,
    That was really simple, i was really getting hung up on this but i changed one side to 100 and one to 200 and it seems to work just how i want! This also got rid of the fidget in the opposite direction, except on a couple of the cheapo servos i am using but i just changed the 200 to a 190 and it stopped it from bouncing at the end.
    Thank you all very much!
    Now as far as Acetronics said
    3) The Pulses MUST be sent regularly @ ~ 30-50 times per second. Even if the servo has to keep on its position.
    If it works now should i change it? I am using very cheap ($3) servos, and some ones from parallax and i assume they are analog.
    Thanks again

  7. #7
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Talking The Programmer safety principle ...

    Quote Originally Posted by bill_23 View Post
    Wow,
    If it works now should i change it? I am using very cheap ($3) servos, and some ones from parallax and i assume they are analog.
    Thanks again
    Generally, if a µP program works as you expected ... Do not change anything until you have a VERY good reason to change it ...

    AND Overall ... do not wipe off the first project until the new one has successfully passed ALL the "live" tests ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. More Servo Woes
    By chrisshortys in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 13th May 2009, 08:40
  2. Servo does not move
    By ruijc in forum General
    Replies: 12
    Last Post: - 12th November 2007, 19:14
  3. Beginner + Servo
    By james in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 31st July 2007, 21:31
  4. Help with Servo Control Please!
    By wireman22 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 7th June 2007, 18:15
  5. Serious Serial Situation Setbacks...
    By Dansdog in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th February 2007, 03:46

Members who have read this thread : 1

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts