Despite searching I was not able to find an answer to this question. I have a servo attached to a pin that moves an arm back and forth. The problem is that it moves too quickly. Is there a way within pigpio or some other method to slow down the movement?

(There was an answer posted ~3 years ago that basically said it can't be done here. I was hoping things have advanced since then.)

This is some sample python code that reproduces the problem. Servo is connected to pin 4.

import time
import pigpio
pi = pigpio.pi()

pi.set_servo_pulsewidth(4, 1500)
pi.set_servo_pulsewidth(4, 500)


  • 2
    move to intermediate positions
    – jsotola
    Commented Aug 19, 2019 at 23:25
  • upvote for a clearly presented question
    – jsotola
    Commented Aug 19, 2019 at 23:26
  • 1
    I will be pedantic and point out that pigpio only uses Broadcom GPIO numbers so that 4 is GPIO 4 (pin 7).
    – joan
    Commented Aug 20, 2019 at 4:20

2 Answers 2


This may work as an example, give it a start and end position, and the time(seconds) you want it to take to move there. It will break the movement up into 100 incremental moves this will slow down the movement

func moveServo(start,end,delta):  #move from start to end, using delta number of seconds
     for x in range(100):
          pi.set_servo_pulsewidth(4, int(start+x*incMove))
  • I had to modify your first line to "def moveServo(start,end,delta):"
    – Monk
    Commented Aug 20, 2019 at 20:53
  • Thanks for all your input. I did try the above code on my servo but the movement is still very jerky. I modified it a few different ways to try to smooth it out but no luck. Looks like we'll have to wait a bit longer. :)
    – Monk
    Commented Aug 20, 2019 at 20:54
  • what do you do to smooth it out? did you try breaking it into more segments?
    – Chad G
    Commented Aug 21, 2019 at 15:21
  • Yes, I tried to break it into more segments. It's still very jittery though.
    – Monk
    Commented Aug 21, 2019 at 17:44
  • What if you break it down into increments of 1, find the delta between start and end, break the time into that many segments, and see where you are. Servo quality also plays a factor here, if its sensor can not accurately determine its location, it wont matter how "smooth" the software side is.
    – Chad G
    Commented Aug 21, 2019 at 18:43

import mods for your servo

From picozero import Servo From time import sleep

set pin

Ser = Servo(0)

set some prams for Servo

Min = 5000 Mid = 15000 Max = 25000

start in right place


move really slowly can change the prams

this takes it down in single incruments #of 10000 to get to 5000 from 15000. Play #with sleep() and -= how eva many you want #to go each sleep.

For x in range(Mid-Min): Ser.set_servo(Mid -= 1) Sleep(0.1)

  • Badly formatted and just code without explanation!
    – MatsK
    Commented Nov 27, 2022 at 19:51
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Nov 27, 2022 at 19:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.