Servo not reaching full travel


Closed Thread
Results 1 to 40 of 40

Hybrid View

  1. #1

    Default Servo not reaching full travel

    Hi guys,

    I've made a circuit that i use to work with a futaba servo.

    The problem is that i cannot get it to reach it's extremes.
    The max i can get is a total of 90º from left to right ( and i know these servos move more that this ).

    I'm running the code like this...

    ( sample )

    Moving left:
    if pos > 25 then
    pos = pos - 50
    servo =1
    pauseus 1000+pos
    servo =0

    Moving right:
    if pos <1300 then
    pos = pos + 50
    servo =1
    pauseus 1000+pos
    servo =0

    I tryed to change the limits but the servo does not move pass it ( upper limit is 1300 and center is 700 )

    Thanks in advance

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


    Did you find this post helpful? Yes | No

    Question What's that ???

    Hi ruijc

    I'd be VERY surprised those lines give something you 'd waited for ...

    <<
    if pos > 25 then
    pos = pos - 50
    servo =1
    pauseus 1000+pos
    servo =0
    >>

    Now,

    Which processor ?
    Initialisation lines ???
    variables ? ( plus which type: bit, byte, Words, longs ???? )

    try a little effort ... for others to undunstand what you've done ( or tried to do ...)

    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 Alan,

    I tryed diferent pics like 16F84, 16F628, 16F88 and speeds of 3Mhz, 4Mhz and 8Mhz.

    Here is the all code ( setting lines learned from you ):

    '************************************************* ****************************
    '19/12/2007
    '
    'PWM experience to control servo
    '
    'PIC 16F628 @ 4Mhz

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

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


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

    'OSC

    DEFINE osc 4


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

    va1 var word
    va2 var word
    ser var word
    pos var word
    na var word
    nb var word

    CLEAR

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

    PORTA = %00000000
    PORTB = %00000000

    TRISA = %00000011
    TRISB = %00000011

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

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

    b4 var PORTB.4
    b5 var PORTB.5
    b6 var PORTB.6
    b7 var PORTB.7

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


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

    Start:


    Low servo1
    Gosub center

    mainloop:

    If bu1 = 1 Then
    Gosub left
    Endif
    If bu2 = 1 Then
    Gosub center
    Endif
    If bu3 = 1 Then
    Gosub right
    Endif

    servo1 = 1
    Pauseus 1000 + pos
    servo1 = 0
    Pause 16

    Goto mainloop

    left:
    high led
    If pos < 1800 Then
    pos = pos + 75
    Endif
    servo1 = 1
    Pauseus 1000 + pos
    servo1 = 0
    Pause 16
    low led
    Return

    right:
    high led
    If pos > 25 Then
    pos = pos - 75
    Endif
    servo1 = 1
    Pauseus 1000 + pos
    servo1 = 0
    Pause 16
    low led
    Return

    center:
    high led
    High 5
    Pause 500
    pos = 700
    Pause 500
    servo1 = 1
    Pauseus 1000 + pos
    servo1 = 0
    Pause 16
    low led
    Return

    end

  4. #4
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default Hmmm

    Let's just go over the basic idea:

    Center position of futaba servo is 1.52ms puls length sent approx every 20 ms. To move it to min position 1 ms and to max position 2 ms.

    But when I recently did a thingy for a RC receiver I found out that the pulses are acctually more in the 0.8 ms - 2.2 ms range to allow for trim settings.

    If you plan to have more than one servo I would recommend you to have a look at DT software PWM.

    If you want to have bigger movement try to change your limit values.

    /me

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Hi Jumper,

    when you say change the limit values you mean the :

    If pos < 1800 Then

    and

    If pos > 25 Then

    right ?

    I added a lcd and did some studies. I did increased the upper value but the servo just stops when it reaches +- 1500.

    The center is 700

    I cant work with numbers bellow 0 i'm affraid.

    The plan is to have only one servo, but i need to use it with more travel ( not continuous ) as 90º is too short

    .

  6. #6
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default Try this

    Hi,

    Hook up a 10k potentiometer (or whatever you have in your drawer) to i.e AN0. Vdd on one side of the pot. GND on the other and the wiper goes to AN0. Put a 0.1 uF cap between wiper and GND to reduce noice .Connect the servo on i.e PORTB.1 ... if you use a voltage meter on the wiper and adjust the voltage to ~3 V you should get a 1.5 ms pulse every 20ms. Now you can turn the pot and then you can try the end positions... your LCD will be great here.


    DEFINE ADC_BITS 8

    ' DEFINE YOUR LCD SETTINGS HERE

    SERVO1 Var PORTB.1
    AD0 var word
    SERVO1_Pulse var byte
    Total_Delay var word
    n var byte

    TRISA 255 ' PORTA to input
    ?????????? 'set up as analog CHECK DATASHEET for you PIC
    ?????????? ' turn off comparators CHECK DATASHEET

    n=0
    Goto main


    update_LCD:
    n=0 'reset LCD loop counter
    'Here you write your LCD code to send the Servo1_pulse value to your LCD
    RETURN

    main:

    ADCIN 0, AD0 'READ POT
    SERVO1_Pulse=AD0*10 'Scale value max = 2550 us
    SERVO1=1 'Start the servo pulse
    Pauseus(SERVO1_Pulse) 'wait a while
    CH1=0 'Stop the pulse
    Total_Delay=(20000-Servo1_Pulse) 'calculate loop delay so we
    Pauseus(Total_Delay) 'get approx 20 ms loop time
    N=n+1
    if n>=50 then gosub update_LCD 'update LCD every 50 loops i.e once per second
    goto main

    end


    try it and if it doesnt work let me know so I can help. This code is untested but should work if you set up the analog port correctly. After this you will atleast know how far your servo will travel.

    /me
    Last edited by Jumper; - 22nd December 2007 at 12:58.

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