TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: THE NATURAL PHILOSOPHER
from: A. DUMAS
date: 2018-12-22 15:08:00
subject: Re: Servo basics

The Natural Philosopher  wrote:
> On 22/12/2018 14:12, Martin Gregorie wrote:
>> On Sat, 22 Dec 2018 13:26:05 +0000, The Natural Philosopher wrote:
>>> Well the average nodel servo gets a pulse every 50ms so its hardly gonna
>>> kill a Pi.
>>>
>> True, but since Linux isn't an RTOS you can't rule out jitter. A loop
>> like:
>>
>> while(running)
>> sleep 49 mS
>> set output pin high
>> wait pulselength  /* 1-2 mS */
>> set output pin low
>>
>> can be pre-empted during the sleep, so the 50mS cycle time isn't
>> guaranteed and it can also be pre-empted during the wait while the signal
>> is high. While cycle length jitter probably isn't an issue, pre-emption
>> while the pulse is being output certainly is because it is guaranteed to
>> make the servo jitter.
>>
>
> Indeed, but isnt there some interrupt driven PWM thing? I seem to
> remember reading that there was...

The problem isn't the total signal period, a lot of modern servos don't
mind anything between, what, 5 and a couple of 100 ms. The only critical
value is "T high" with a value around 1500 us. If you can time that pulse
with guaranteed microsecond accuracy, then you're definitely good for
degree accuracy (from an electronic perspective; also depends on your
servo's mechanical accuracy).

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.