I tried to control the servo using softPwm using the wiringPi library, but it made the servo stutter. So I want to use the PWM pin of the equipment on the Raspberry Pi (GPIO18) with the wiringPi library. But I donβt understand how to set the frequency to 50 Hz and change the duty cycle so that the pulse width is from 0.8 ms to 2.5 ms.
I found the following relationships on the Internet (I don't know if this is correct):
pwmFrequency in Hz = 19.2e6 Hz / pwmClock / pwmRange.
I know that the maximum number of clock dividers is about 4000, and the PWM PWM watch for raspberries has a base frequency of 19.2 MHz. so this gives me ~ 4.8 kHz.
I already got these settings, which should give me ~ 50 Hz using the following ratio:
I do not have an oscilloscope to check the output signal to check which settings are changing. this makes it difficult to find.
In short: Can anyone tell me how I can achieve a duty cycle with a pulse width of 0.8 ms to 2.1 ms for controlling a servo using a hardware PWM on a raspberry pie.
c raspberry-pi pwm
user2543697
source share