Multiple R/C servo control
- From: "Padu" <padu@xxxxxxxxxxxx>
- Date: Tue, 20 Sep 2005 14:02:59 -0700
Hi folks,
I've been doing lots of tests with controlling R/C servos lately, some good
experiences and some bad experiences. I even wrote an introduction paper on
how to interface the PC with R/C servos using the serial port and a PIC
microcontroller.
The strategy I present in that paper is very basic, and although it works
fine, it is kind of jittery and does not support too many servos. Now I'm
working on a improved version of my servo controller that will theoretically
get rid of the flicker and support unlimited servos (in theory).
I am a firm believer that the best way to learn something is to teach it.
Therefore I will try to make another paper exposing this new method (of
course, if it works). Before doing that, I need to know if someone else
already did such tutorial paper, and if yes, if it is similar to my
strategy.
Here's an outline of my strategy, please express yourself if you find a flaw
in it as I'm going to test it tonight.
1-Assume there is an array of servos controlled by the uP
and this array has the following fields:
servo_idx, pulse_width_uS, servo_no
Whenever the array is updated (through serial commands), it is
sorted in by pulse_width_uS
2-Drive all servo lines high, set TMR0 with the time interval
of the first servo of the array
3-When TMR0 triggers, set the respective servo low.
Also set low all the subsequent servos from that list that
have the same pulse_width_uS. Set new TMR0 interval
as the difference between next servo pulse width and current
one.
4-Repeat this operation for all servos until there are no
more servos to drive low. At that point, set TMR0 with
20ms - current pulse_width_uS
And that goes forever. There are a couple more quirks to it, but that's the
overall outline. If you are controlling 4 servos, TMR0 should trigger 5
times in the worst case, 1 time for driving all servo lines up and 4 times
(less if some of them share the same time interval) to drive them low.
That gives me lots of time in between pulses to do whatever I want (receive
USART bytes for example) without interfering too much with the PWM timing
mechanism.
Do you think it is a good approach to try? If yes, do you think it would be
worthy to write a short paper on that?
Cheers
Padu
.
- Follow-Ups:
- Re: Multiple R/C servo control
- From: Padu
- Re: Multiple R/C servo control
- From: Andras Tantos
- Re: Multiple R/C servo control
- From: Sergio Masci
- Re: Multiple R/C servo control
- From: Wayne C. Gramlich
- Re: Multiple R/C servo control
- From: Wayne Lundberg
- Re: Multiple R/C servo control
- Prev by Date: Re: Robot's control board - how to?
- Next by Date: Re: Multiple R/C servo control
- Previous by thread: Robot's control board - how to?
- Next by thread: Re: Multiple R/C servo control
- Index(es):
Relevant Pages
|