Servo does not move


Closed Thread
Results 1 to 13 of 13
  1. #1

    Unhappy Servo does not move

    Greetings,

    i've found a program to move a servo ( left and right ).

    Did some minor modifications ( lcd pinouts ) and programmed my pic 16f84A.

    However the servo does not move !

    The LCD displays the position OK and the buttons work OK but there is no movement from the servo.
    With an ohmeter i cannot sense any voltage also.

    Is there something wrong with the program ?
    Any ideas ?

    This is the program:

    pos var word ' Servo position
    servo1 var PORTB.4 ' Alias servo pin

    Low servo1 ' Servo output low
    PORTB = 0 ' PORTB lines low to read buttons
    TRISB = $fe ' Enable first button row
    Pause 100 ' Wait for LCD to startup
    Gosub center ' Center servo

    mainloop:
    If PORTB.5 = 1 Then
    Gosub left
    Endif
    If PORTB.2 = 1 Then
    Gosub center
    Endif
    If PORTB.6 = 1 Then
    Gosub right
    Endif

    servo1 = 1 ' Start servo pulse
    Pauseus 1000 + pos ' Delay for servo pulse high time
    servo1 = 0 ' End servo pulse
    Pause 16 ' Servo update rate about 60Hz
    Goto mainloop ' Do it all forever

    left:
    If pos < 2000 Then
    pos = pos + 1
    GoSub display ' Display new position on LCD
    Endif
    Return

    right:
    If pos > 1000 Then
    pos = pos - 1
    GoSub display ' Display new position on LCD
    Endif
    Return

    center:
    pos = 1500
    GoSub display ' Display new position on LCD
    Return

    display:
    Lcdout $fe, 1, "Position = ", #pos
    Return

    end

    thanks

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,557


    Did you find this post helpful? Yes | No

    Default

    Hi,
    You have the servo on portB.4 but then you do
    Code:
    TRISB = $fe ' Enable first button row
    Which sets that pin to input. So when you do:
    Code:
    servo1 = 1 ' Start servo pulse
    Pauseus 1000 + pos ' Delay for servo pulse high time
    servo1 = 0 ' End servo pulse
    Pause 16 ' Servo update rate about 60Hz
    Goto mainloop ' Do it all forever
    PortB.4 won't go high since it's set to be an input.

    Either change your servo1 = 1 to HIGH servo1 and servo1 = 0 to LOW servo1 or make sure that PortB.4 is setup as an output.

    /Henrik Olsson.

  3. #3


    Did you find this post helpful? Yes | No

    Default

    that's it !

    i missed that !

    thanks . it's working fine now.

    .

  4. #4


    Did you find this post helpful? Yes | No

    Default

    I have all things working and changed the code to be more complete.

    But still having some issues.

    I've noticed that the value for the servo to be centered the pos must be 400 ( even with the original code )

    for far left the value must be 1300

    but for far right 0 is not enough.

    i've tryed this but doesnt work...

    right:
    If pos > -100 Then
    pos = pos - 10
    Endif
    servo1 = 1
    Pauseus 1000 + pos
    servo1 = 0
    Pause 16 ' Servo update rate about 60Hz
    Return

    any ideas ?
    and why arent the original values working for me ? I've seen many servo programs and all have the same values for center.

    thanks

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


    Did you find this post helpful? Yes | No

    Default

    Hi, Ruijc

    I think you are "mixing" and misunderstanding some servo parameters here ...

    so, before going further ... what is your servo model and brand ??? and what is your radio set ???

    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


    Did you find this post helpful? Yes | No

    Default

    Hi Alain,

    thanks for your help.

    i'm currently using a futaba's S148 servo.

    My idea is to test any futaba and hitec servos ( digital and analog ).


    .

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


    Did you find this post helpful? Yes | No

    Wink The horrible truth ....

    Hi, Ruijc

    héhé ...

    Futaba S148 !!! the "mechanical neutral" ( half of the two geometric max positions ) ... corresponds to ~ 1300 µS ( an heritage of the old Robbe/Futaba join venture ! )

    Now ... YOU must place your servo arm to have your "application neutral" with a trustable 1500µS pulse !!! ( remember Xtals are NOT generating exactly their nominal frequency ... especially for "common" ones )

    Moreover consider Futaba "analogic" servos have a quasi-linear positionning in the 900-2100 µS range .

    Outside those limits, you can send from 200 to 2500 µS pulses ... but with no more linearity at all !!! Specially at low values ... ( I did those tests to try to get 180° travel without any mod to the servos ...)

    to fill the "bottle" ... your servos have a deadband of ~ 4/5 µS ... around their position, so, don't ask them to show you 1µS steps !!!

    I did not test any Hitec servos ... so don't ask me for them !!!

    Alain
    Last edited by Acetronics2; - 10th November 2007 at 18:28.
    ************************************************** ***********************
    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 " !!!
    *****************************************

  8. #8


    Did you find this post helpful? Yes | No

    Default

    Got it Alain,

    just changed the xtal from 4Mhz to 8Mhz and is was easy to tune !

    thanks

    .

  9. #9


    Did you find this post helpful? Yes | No

    Default

    One last question:

    i found my 7805 getting very hot when my circuit is looping through auto motion.

    The code is safe in terms of not letting the servo go to extremes and overloads the circuit.

    It's just moving arround ( left and right ) on it's own.

    Is there a way to control it's temperature ?

    I'm trying to avoid using a heatsink because it will be in a small box.

    any ideas ?

  10. #10
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,557


    Did you find this post helpful? Yes | No

    Default

    The 7805 is getting hot because your supplying current to the servo thru it. Even though the motor is "just turning" it consumes much, much more current than the PIC. When you start "loading" the servo it will draw even more current and will probably overheat the regulator. Basicly you have four options.

    1) Mount a heatsink.
    2) Reduce the powersupply voltage. That will reduce power dissipation in the regulator.
    3) Use a switching type regulator instead of a linear (78xx type)
    4) Only run the PIC on the regulated voltage. And the servo on the raw, unregulated voltage.

    Number 4 may not be an option depending on your actual supply voltage and max voltage that the servo can take.

    /Henrik Olsson.

  11. #11
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,616


    Did you find this post helpful? Yes | No

    Wink

    Hi,Ruijc

    Why not run it with 4 or 5 old NiCd cells ??? if 12v batt used, only a switching regulator will do it ( LM 2575 or 2576 i.e )

    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 " !!!
    *****************************************

  12. #12


    Did you find this post helpful? Yes | No

    Default

    thanks Alain and HenrikOlsson,

    all good tips

    at my workbench i have a 12V/3A power supply but i designed to have a normal 9v battery.

    #1 Since the 9v battery does not have that much voltage/current the regulator will not over heat ( or will it ? )

    #2 The nicad pack is a good idea running the servo directly from it and keeping the regulator for the pic only . But since it will be used at the field and there are many different packs available, i'm affraid that a lipo pack would burn up the regulator :s


    .

  13. #13
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,557


    Did you find this post helpful? Yes | No

    Default

    Yes, the regulator will run cooler with an input of 9V instead of 12V. With 12V input and pulling, say, 200mA the regulator dissipates (12-5)*0.2=1.4W and with 9V input it's (9-5)*0.2=0.8W. If the regulator will overheat or not depends on the actual current and the ambient temperature. A standard 9V battery may not be able to supply the current needed for the servo though and in any case it won't last for very long.

    /Henrik.

Similar Threads

  1. PIC16F877A pwm use for IR transmission
    By mcbeasleyjr in forum General
    Replies: 0
    Last Post: - 11th July 2009, 18:51
  2. More Servo Woes
    By chrisshortys in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 13th May 2009, 08:40
  3. How to move servo slowly?
    By azmax100 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 15th April 2009, 13:50
  4. Problem with 12F629, servo and EEPROM
    By Atom058 in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 1st March 2008, 09:53
  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 : 0

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