Language: EN

controlar-un-servo-de-rotacion-continua-con-arduino

Controlling a Continuous Rotation Servo with Arduino

What is a continuous rotation servo?

A continuous rotation servo is a variant of normal servos, in which the signal we send to the servo controls the speed of rotation, instead of the angular position as with conventional servos.

Another difference from conventional servos, which have a limited range of movement from 0 to 180º, is that a continuous rotation servo can rotate 360 degrees in both directions continuously.

The characteristics and control of a continuous rotation servo are similar to those of a conventional servo. In fact, it is possible to modify a servo to convert it into continuous rotation simply by removing the internal stops and replacing the internal potentiometer with two equal resistors. However, the performance will be inferior to a commercial continuous rotation servo.

Many models of continuous rotation servos include a calibration potentiometer that allows precise adjustment of the neutral point, that is, the point at which the servo does not rotate in either direction (another advantage of using a commercial motor instead of a modified conventional servo).

Continuous rotation servos, like conventional servos, support supply voltages between 4.8V and 7.2V. Also, like their siblings, they incorporate an internal reducer, so they generally provide high torque and low maximum speed, around 1-2 rpm.

The control of a continuous rotation servo is identical to that of a conventional servo, only the meaning of the control signal varies, which instead of being transformed into an angle of position is interpreted as angular speed, in both directions of rotation.

arduino-servo-rotacion-continua-funcionamiento

Continuous rotation servos are an easy way to get a motor with speed control, without having to add additional devices such as controllers or encoders as is the case with DC or stepper motors, since the control is integrated in the servo itself.

The main disadvantage of continuous rotation servos is that we sacrifice position control. If we want precise angle rotation, we will have to add an encoder.

Unfortunately, despite what we might think, we also do not have precise control of the rotation speed since the system’s response is strongly nonlinear with respect to the servo input. If we want precise speed control, we must calibrate the motor and correct the signal sent to the servo, or again resort to adding encoders.

arduino-servo-rotacion-continua-control

Continuous rotation servos are a simple option for building small or medium-sized robots, especially when they involve the movement of several wheels, as in robots with omniwheels or mecanum wheels. They are also useful in other systems where we need to easily control the rotation speed, such as a platform for a 3D scanner.

Price

In general, continuous rotation servos are somewhat more expensive than their conventional counterparts. For that reason, we may decide to

As examples of continuous rotation servos, we have the DM-S0090D, a 9g continuous rotation servo, similar to the SG90 servo. It has a cost of 3.1€ (almost double that of the SG90). The characteristics of the DM-S0090D are,

  • Voltage: 3.7V ~ 6.0V
  • Torque: 1.5kg.cm (4.8V) to 1.6kg.cm (6V)
  • Speed: 0.10 sec/60º (4.8V) to 0.08 sec/60º (6.0 v)
  • Dimensions: 22.9 x 12 x 22.5mm
  • Weight: 9g
  • Price 7€

arduino-servo-rotacion-dm-s0090d

In a larger size, we have the SM-S4306R servo and other models in the same family, which are similar in characteristics and dimensions to the MG-996R. In the case of the SM-S4306R, the characteristics are,

  • Voltage: 4.8V ~ 6.0V
  • Torque: 5kg•cm (4.8V) to 6.2kg•cm (6V)
  • Speed: 0.17 sec/60º (4.8V) to 0.13 sec/60º (6V)
  • Dimensions: 40 x 19 x 43mm
  • Weight: 44g
  • Price: 3.70€

arduino-servo-rotacion-sm-s4306r

The other models in the SM-S4306R family have similar characteristics but different torque. Thus, the SM-S4309R has a torque of 7.9kg•cm (4.8V) to 8.7kg•cm (6V) and the SM-S4315R a torque of 14.5kg•cm (4.8V) to 15.4kg•cm (6V).

Finally, you will see that modified servos are also sold, such as the SG90 or the MG996R. As we have said, we can even modify these servos ourselves. However, the performance is usually inferior to continuous rotation servos, and they lack the potentiometer to calibrate the neutral point, so we will have some kind of drift.

Assembly diagram

The connection is identical to that of a conventional servo. We power the servo by applying a voltage of 4.8 to 7.2V. Except in the case of very small servos, it is normal for Arduino not to have enough power to operate the servo, and we should use an external voltage source.

arduino-servo-rotacion-continua-montaje

On the other hand, we connect the signal pin to a digital output of Arduino.

arduino-servo-rotacion-continua-conexion

When using multiple voltage sources, remember to always put all the GND in common. Otherwise, you could damage some component.

Code examples

As we have said, the control of a continuous rotation servo is identical to the control of a conventional servo, the only difference is the behavior of the servo, which in the case of a continuous rotation servo will vary the speed instead of the position.

Therefore, we use the “servo.h” library, built into the Standard IDE, which allows us to control up to 12 servos in Arduino Uno/Nano, and up to 48 in Arduino Mega.

The following example varies the speed of the continuous rotation servo between stopped servo, servo at 100% speed in one direction, and servo at 100% in the opposite direction, maintaining each speed for 1.5 seconds.

#include <Servo.h>

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); 
}

Download the code

All the code from this post is available for download on Github. github-full