I want to control a "Servo motor analoog Micro Servo 9g SG90 360°/continous rotation" with a python script. I do understand the control of a 180° servo but somehow the 360° is not reacting the same.

I want to use the servo to turn like a dial of a clockwork, in this case the dial will show the current moonphase.

So I need the Servo to turn to a specific angle or turn a specific angle. I save the angle in a file after it has turned so I can calculate the difference in current and desired angle is and use that difference to calculate the duty.

But i really dont understand how I can calculate the duty to turn 1°. I got my PWM set on 50Hz.

Can anyone explain me how I can achieve my goal?

*edit: Servo information:

No-load speed: 0.12 seconds / 60 degrees (4,8V)

Stall torque: 1,2 - 1,4 kg / cm (4,8V)

Dead-set: 7 microseconds

PWM-value 185 causes motor to stop.

PWM-value 175 causes motor to turn CW

PWM-value 195 causes motor to turn CCW

PWM-value 62 causes motor to stop because of to low input.

  • add feedback to the servo, so that you can determine its position
    – jsotola
    Jul 8, 2022 at 15:55
  • downvoting because it is a question about a servo, not a question about Raspberry Pi
    – jsotola
    Jul 8, 2022 at 15:57

2 Answers 2


You can not do this with a continuous rotation servo.

With a standard servo you specify an angle - the servo stops when it reaches that angle. With a continuous rotation servo you specify a speed of rotation - the servo keeps spinning at that speed until you tell it to stop or specify another speed.

You need to buy a standard servo and use gearing to extend the range of movement or use a stepper motor instead.


Yes you can control the degrees with a continuous servo.

You need to calculate the milliseconds per degree value for your servo and then pause/delay/sleep to keep the servo running so it can move the desired amount of degrees.

As an example based on the information provided in the question above:

The speed of the servo is

0.12 seconds / 60 degrees

So the milliseconds per degree value is


Therefore the following formula should give you the correct delay for the servo to move to the desired degree value.

2 * degrees

Keep in mind this method will only work if the servo is moving at full speed in either direction. Also you may need to play around with the milliseconds per degree value if the servo angle is off.

  • When under load, electrical motors, including hobby servos usually slow down. Also, to make a hobby servo rotate continuous, don't you remove the encoder from the motor?
    – NomadMaker
    Sep 7, 2023 at 15:15
  • your solution is not realistic ... it is not possible to position the servo to a desired angle without feedback
    – jsotola
    Sep 12, 2023 at 0:52
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Sep 12, 2023 at 0:53

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.