1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Would this work with RC servos?

Discussion in 'Robotics & Mechatronics' started by atferrari, Aug 16, 2005.

  1. atferrari

    atferrari Well-Known Member

    Joined:
    Oct 8, 2003
    Messages:
    2,810
    Likes:
    121
    Location:
    Buenos Aires - Argentina
    ONLINE
    I intend to control an RC servo using a signal repeating every 4 ms instead of the usually advised 20 msec.

    The variation of width will be as required between 1 and 2 ms. No changes here, of course.

    Should I expect any problem or is it OK?

    Any reply appreciated.
     
  2. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,203
    Likes:
    640
    Location:
    Derbyshire, UK
    ONLINE
    It's only the MARK that sets the servo position, the SPACE doesn't seem to matter?. But usually you're making the SPACE longer, not shorter, but I see no reason why it won't work - but I should test it first!.

    Why are you wanting to use a shorter SPACE anyway?.
     
  3. atferrari

    atferrari Well-Known Member

    Joined:
    Oct 8, 2003
    Messages:
    2,810
    Likes:
    121
    Location:
    Buenos Aires - Argentina
    ONLINE
    The reason for that

    Using a 16F628 with 4 MHz clock I couldn't find a way to get the usual 1 to 2 ms every 20 ms but only every 4 ms :!:

    The values I've got yesterday were, for 10 bits to be writen to CC1PRL and CCP1CON b5:b4 :

    250 for 1 ms
    375 for 1,5 ms
    500 for 2 ms.

    For the period, I get:

    prescaler : 16
    PR2 : 255

    giving 244 Hz, that is: 4 ms (app) period.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. JFDuval

    JFDuval New Member

    Joined:
    Apr 9, 2004
    Messages:
    115
    Likes:
    0
    Location:
    Québec

    Doing some research on Google would be a good thing.

    http://www.google.ca/search?hl=en&q=servo+control+code+16F628&btnG=Search&meta=

    By using two timers, one for the 'high' and one for the 'low', you can achieve pretty good timing.
     
  6. NleahciM

    NleahciM New Member

    Joined:
    Jun 15, 2005
    Messages:
    23
    Likes:
    0
    running a servo at 250 hz is pushing it a bit - some servos will work at that high of a speed, others won't. Try it - and if it works monitor the temperature of the servo - if it's getting really hot then, obviously, you have a problem. Most servos will work up to around 200hz. Some will stop working well before that, unfortunately. I've heard some of the digital ones can go to 400hz - though I don't have any digitals so I am unable to verify this.
     
  7. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,203
    Likes:
    640
    Location:
    Derbyshire, UK
    ONLINE
    Re: The reason for that

    That's because you're trying to use the PWM module, it's not intended for servo's, and it's not really suitable - there's plenty of PIC servo examples on the net, google will find them for you.
     
  8. demestav

    demestav Member

    Joined:
    Aug 15, 2003
    Messages:
    139
    Likes:
    0
    Hello all.

    This is not 100% relevant but I believe it may help a bit.
    I was working with parallax cont. rotation servo working perfectly with the pulse that it required.

    However there was another guy in the lab that was using the same motor with totally different timings but the servo worked just fine! The reason why his timings were wrong is because he messed up with the prescaler. However the "duty cyle" (percentage) of the pulse was correct even if the duration was wrong. Now the key to the whole situation is that those servos had a screw which you can use to adjust its stability. I believe this is why his servo also worked.

    Thanks.
     

Share This Page