1

To control a servo, I'm using this. To summarize it: you use code like this:

while True:
   GPIO.output(pin, GPIO.HIGH)  
   time.sleep(0.0015)  
   GPIO.output(pin, GPIO.LOW)  
   time.sleep(0.0185)

Note that the 0.0015 and 0.0185 change based on the desired angle. One issue they said about was that the servo may jitter if the program is run normally. Its because a regular program will have imprecise timing.

My question is, how does one make the timing more precise so the servo does not jitter? (It said something about kernel priorities and such.)

  • 1
    What is this. There are several possible solutions mentioned in that thread. Which are you using? – joan Dec 4 '15 at 15:43
  • Ditto. Please do not ask people to go read an entire thread somewhere else in order to try and help you. Ping me when you've clarified that and I'll reopen this. – goldilocks Dec 4 '15 at 15:59
  • @joan Sorry, I just added a summary. – PyRulez Dec 4 '15 at 17:30
  • The example code in your question is using software timing to generate the pulses. That will be subject to jitter depending on what else is happening on the system. Jitter will make the servos twitch (and possibly reduce the servo's working life). There should have been examples of hardware timing in that thread. Have a look at my pigpio and servoblaster. – joan Dec 4 '15 at 18:30
  • One possible solution is to use a Servo Controller IC ... see: adafruit.com/products/815 – Kolban Dec 4 '15 at 20:10

Browse other questions tagged or ask your own question.