Controlling a Continuous Rotation Servo with Arduino

Learn how to control continuous rotation servos for robotic and automation projects.

What is a Continuous Rotation Servo?

A continuous rotation servo is similar to a standard servo but controls speed and direction instead of position. It can rotate continuously in both directions.

Continuous Rotation Servo

These servos are ideal for driving wheels in robots, controlling rotating platforms, and other applications requiring speed control.

Price

Assembly Diagram

The connection for a continuous rotation servo is identical to that of a standard servo:

Servo Assembly Diagram

When using an external power supply, ensure all GNDs are connected together.

Code Examples

Basic Speed Control

This example demonstrates how to stop the servo, rotate it at full speed in one direction, and then in the opposite direction:


#include 

Servo myservo;  // create the servo object

int vel = 0;    // servo speed

void setup() {
  myservo.attach(9);  // link the servo to digital pin 9
}

void loop() {
  // Stopped servo (equivalent to 90º angle)
  vel = 90;
  myservo.write(vel);              
  delay(1500);    

  // 100% CW servo (equivalent to 180º angle)
  vel = 180;
  myservo.write(vel);              
  delay(1500); 

  // 100% CCW servo (equivalent to 0º angle)
  vel = 0;
  myservo.write(vel);              
  delay(1500); 
}
            

Conclusion

Continuous rotation servos are a simple way to achieve speed and direction control in your projects. They are perfect for small robots, rotating platforms, and more. Use the provided code as a starting point for your designs.