Servo not reaching full travel


Closed Thread
Results 1 to 40 of 40

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Thanks for the warning Jumper,

    i have to be more carefull with that from now on

    skimask,

    i've checked my pbp manual and you are right. Osc 3 is really 3.58 Mhz.

    I will try with lower speeds...maybe using the internal oscilators and see what happens

    .

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by ruijc View Post
    skimask,
    i've checked my pbp manual and you are right. Osc 3 is really 3.58 Mhz.
    I will try with lower speeds...maybe using the internal oscilators and see what happens
    .
    That's the thing...you shouldn't have to do that.
    I can run servo's just as happily running 48mhz on the 18F4550 as I can at 4mhz on the same PIC, same program, same everything, just a different DEFINE OSC at the beginning.
    You've got something else going on that's preventing you from doing so.
    Port not set right, interrupt's bugging something, register not set up right or something...

    And if I remember right, I don't think I've seen your FULL code yet...just fragments.
    That doesn't work so good.
    Time and time again, somebody says, 'well, the problem can't be over there, 'cause that's got nothing to do with anything over here'.
    Well, guess what.....the problem was over there because it had everything to do with all of it over here in one way or the other...

    If you run the servo to an endpoint (at least an endpoint that you've found using the PIC and it's software), how much farther (if any) can you make it move after removing power by manually turning it?

  3. #3


    Did you find this post helpful? Yes | No

    Default

    skimask ,

    the full code with settings is in my 2nd post.

    I ran the program again and moved the servo to the far right and then i moved it with my fingers and yes...it moved a bit more !

    this means that it can move a bit more to the right but it's limited with the low 25 ( 1025 ms ).

    To the left it goes all the way !

    This also means that center is not where i though it was .

    .

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by ruijc View Post
    This also means that center is not where i though it was .
    How are you quantifying 'CENTER' on the servo right now? I mean how are you determining 'center'?
    Are you trying to let the program do it for you?
    Are you moving it manually from end to end and splitting the difference and making a mark at that 'center'?
    If you're looking at center and saying that's 'CENTER' because you want it to be center, well, that ain't gonna work.
    Take that manual method described above of moving the servo and write a program to send the servo a 1.5ms pulse and see how far off the two marks are. Let the servo tell YOU where center is.

    If you are still running that code in your second post, I think you should abandon that code until you figure out how to get full left and right out of your servo's first, before you start adding in buttons and stuff...
    Go back to that code in Post #9 and play with that.
    Using those values, the servo should move equally left and right (not just a little left and a lot right, 'cause that would mean that your idea of center and the servo's idea of center are two different things, which I think is wrong) and it should do that without binding at either end.
    Last edited by skimask; - 27th December 2007 at 22:23.

  5. #5


    Did you find this post helpful? Yes | No

    Default

    skimask,

    i ran my code and yours ( as transcribed bellow ) and this was what i got ( please see attached pic ):

    Manually found left and right limits of this servo and marked it's true center

    Fisical center matches the 1500 ms impulse

    With my code:
    max right = +- 2150ms
    max left = +- 1025 ms

    With your code :

    max right = +- 1950 ms
    max left = +- 1025 ms

    both are far from servo fisical limits ( fisical limits marked with in red )



    your code :

    '************************************************* ****************************
    '19/12/2007
    '
    'Skimask's servo code
    '
    'PIC 16F628 @ 4Mhz

    '************************************************* ****************************
    'Config

    PIE1 = 0 'off
    PIR1 = 0 'off
    CMCON = 7 'comparator off
    VRCON = 0 'Vref Off
    T1CON = 0

    ' internal osc selected in IC prog
    ' MCLR ON selected in IC prog

    '************************************************* ****************************
    'DEFINEs
    '************************************************* ****************************

    'OSC

    DEFINE OSC 4

    '************************************************* ****************************
    '
    'LCD

    ' DEFINE LCD pins
    DEFINE LCD_DREG PORTB
    DEFINE LCD_DBIT 4
    DEFINE LCD_RSREG PORTA
    DEFINE LCD_RSBIT 2
    DEFINE LCD_EREG PORTA
    DEFINE LCD_EBIT 3
    DEFINE LCD_BITS 4

    DEFINE LCD_COMMANDUS 2000

    '************************************************* ****************************
    ' variables

    va1 var word
    va2 var word
    ser var word
    pos var word
    na var word
    nb var word
    stepval var word
    center var word
    leftend var word
    rightend var word

    CLEAR

    '************************************************* ****************************
    'I/O's

    PORTA = %00000000
    PORTB = %00000000

    TRISA = %00000011
    TRISB = %00000011

    '************************************************* ****************************
    'PINS

    bu1 var PORTA.0
    bu2 var PORTA.1
    R_S var PORTA.2
    E var PORTA.3
    a4 var PORTA.4
    MCLR var PORTA.5
    a6 var PORTA.6
    a7 var PORTA.7

    DATA1 var PORTB.4
    DATA2 var PORTB.5
    DATA3 var PORTB.6
    DATA4 var PORTB.7

    bu4 var PORTB.0
    bu3 var PORTB.1
    led var PORTB.2
    servo1 var PORTB.3


    '************************************************* ****************************
    '************************************************* ****************************

    pause 200 'init LCD
    lcdout $fe,1 'clear LCD

    Start:

    leftend = 1000
    center = 1500
    rightend = 2000
    stepval = 20
    pos = center

    moveleft:
    pause 19 'pause 19ms
    if pos > leftend then
    pos = pos - stepval
    else
    goto moveright
    endif
    servo1 = 1 : pauseus pos : servo1 = 0 : goto moveleft

    Moveright:
    pause 19 'pause 19ms
    if pos < rightend then
    pos = pos + stepval
    else
    goto moveleft
    endif
    servo1 = 1 : pauseus pos : servo1 = 0 : goto moveright

    end




    EDIT:

    I just changed your settings to :
    leftend = 500
    center = 1500
    rightend = 2500

    and i got more travel to the right ( more that i got before with mine )
    This means that the servo is working bellow 1ms
    Attached Images Attached Images  
    Last edited by ruijc; - 28th December 2007 at 15:49.

  6. #6


    Did you find this post helpful? Yes | No

    Default

    Just an update of my previous post:

    I changed the values as far as :

    leftend = 200
    center = 1500
    rightend = 3000

    ( the servo moved a bit more but stopped before reaching it's fisical limits. Also, these values do not represent the true extreme limits )

    The new max travel made by the servo is marked in this new picture.

    .
    Attached Images Attached Images  

  7. #7
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    I'm thinking (supposing really) that maybe just because a servo has a physical limit, doesn't mean that the electronics inside will let it reach those physical limits. I don't know.
    Those marks you made, the black ones, look like a halfway decent 90 degree angle.

    How about trying this out for grins:
    Code:
    ....all the setup you've already got...it looks like it should work just fine....
    Start:
    leftend = 100 : center = 1500 : rightend = 2900 : stepval = 20 : pos = center
    
    moveleft:
    pauseus 20000 - pos  'pause 20ms - servo pulse width, should keep a more constant refresh rate closer to 50hz
    if pos > leftend then
    pos = pos - stepval
    else
    goto moveright
    endif
    servo1 = 1 : pauseus pos : servo1 = 0 : goto moveleft
    
    Moveright:
    pauseus 20000 - pos  'pause 20ms - servo pulse width, should keep a more constant refresh rate closer to 50hz
    if pos < rightend then
    pos = pos + stepval
    else
    goto moveleft
    endif
    servo1 = 1 : pauseus pos : servo1 = 0 : goto moveright
    
    end
    I changed it a bit, added a bit of code to keep the refresh rate a bit closer to 50Hz. Maybe the newer servo's are a bit more sensitive to that sort of thing.
    Also, I changed leftend and rightend to EXTREME values. They're almost GUARANTEED to bind your servo's at the extreme's.
    See what happens.
    Are you actually using a real 16F628 or a 16F628A?

  8. #8


    Did you find this post helpful? Yes | No

    Default

    Hi skimask,

    i'm using a 16F628A.

    With your new code the servo moves all the way up to the new red marks ( as showned in pic # 2 ).

    It is still not at it's fisical limit but i think that probably these are the electronic limits of the servo.

    .

Similar Threads

  1. More Servo Woes
    By chrisshortys in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 13th May 2009, 08:40
  2. Problem with 12F629, servo and EEPROM
    By Atom058 in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 1st March 2008, 09:53
  3. Servo does not move
    By ruijc in forum General
    Replies: 12
    Last Post: - 12th November 2007, 19:14
  4. Beginner + Servo
    By james in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 31st July 2007, 21:31
  5. Help with Servo Control Please!
    By wireman22 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 7th June 2007, 18:15

Members who have read this thread : 1

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

Posting Permissions

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