Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3956

Troubleshooting • Re: Cannot control a servo motor precisely

$
0
0
It is not possible to read back the current position from that servo.

The MG995 servo does not provide the feedback signal which would be necessary for that to be possible.
Oh I see, but then how can I obtain a more accurate movement like the one in this video? I cannot use RPi.GPIO on RPI5 from what I understand


in short, as an overview. The position of a servo is determined by sending it a control signal with a specific pulsewidth. If the nominal pulsewidth is outside the limits determined by the specific servo then 'jitter' will result.

RasPiOS running on RPi hardware is a general purpose multi-user time sharing OS. It does not provide Real Time predictability of code execution. The interpreted nature of Python adds to the near impossibility of generating reliable pulsewidth signals. The Interpreter or the OS can choose at any time to go off and do something more 'important' than running your script.

Possible solutions -
1. RPI board + RasPiOS + use 'hardware PWM', or - on boards prior to RPi5 - investigate pigpio and its abilities.

2. Use a microcontroller such as an RPi Pico, which executes only a single task at a time and will be less susceptible to 'jitter'.




And as a final thought. If you want to move the motor in discrete steps, perhaps using a Stepper Motor from the outset would be more reliable?
I guess I could give it a try on my RPI0W wiht pigpio, I cannot change the pin factory on the RPI5 as the blue note says in the docs since I'm unable to connect to pigpio daemon for some reason.
Perhaps the stepper motor is better but wouldn't it have the same problems?

Statistics: Posted by _FranK_ — Tue Jan 30, 2024 5:48 pm



Viewing all articles
Browse latest Browse all 3956

Trending Articles