Electronic – arduino – MG996R that can rotate all the way around, but behaves like a normal servo

arduinomotorpotentiometerroboticsservo

So I bought an MG996r online to replace a dead one in my robot dog, and I always test my new servos by hand and then by using sweep.

When testing this one by hand, I found that I could turn it all the way around – like the end stops were gone. It just kept turning and turning. The seller had said nothing about this, and I thought maybe they sent me a broken motor, or maybe this is how they make theirs, or maybe its a continuous motor.

However, when I loaded up sweep, it went back and forth like a regular servo. I even tested it with my robot dog’s code; no difference from a regular 180’ servo. It could even support my robot’s weight when powered on, so there’s definitely some form of position feedback.

I don’t think there is a gear train allowing it multiple turns, given that the motor works at the same speed as any other one.

How does this work? I thought the internal potentiometer limits the rotation.

Does this use a potentiometer that allows the wiper to cross from one end of the track to the other? Or maybe it uses hall effect sensors, rotary encoder, etc?

EDIT: This servo was $12, while most of my servos were $8 or below. Although, I do buy them in bulk, so that does drop their price. But still, it seems like a big difference.

Best Answer

According to the TowerPro MG996R datasheet, this is a Continuous Rotation Servo, "MG996R Robot servo 360° Rotation". TowerPro is the manufacturer, so I consider this datasheet the authoritative source.

  • Weight: 55g
  • Dimension: 40.7×19.7×42.9mm
  • Stall torque: 9.4kg/cm (4.8v); 11kg/cm (6.0v)
  • Operating speed: 0.19sec/60degree (4.8v); 0.15sec/60degree (6.0v)
  • Operating voltage: 4.8~ 6.6v
  • Gear Type: Metal gear
  • Temperature range: 0- 55?
  • Servo Plug: JR (Fits JR and Futaba)
  • Dead band width: 1us

A normal closed-loop positioning Servo responds to a pulse width command by moving to a programmed position: 1.0ms pulse is position 0°, 1.5ms pulse is position 90°, and 2.0ms pulse is position 180°. But a Continuous Rotation Servo responds to a pulse width command by spinning continuously at a programmed speed: 1ms pulse is "forward" at full speed, 2ms pulse is "backwards" at full speed, and 1.5ms pulse is "stop". Adafruit notes that a continuous rotation servo may require some kind of calibration to make the stop truly stop. If the servo itself does not have an offset adjustment, you may have to make adjustment in your software, i.e. full stop might be "89°" or "91°" instead of "90°". There is no position detection, it is just running open-loop at the commanded speed.

when I loaded up sweep, it went back and forth like a regular servo

The "sweep" test program is intended to drive a normal closed-loop positioning servo (not a continuous rotation servo). With a normal servo, commands are sent to go to 1.0ms=0° to 1.5ms=90° to 2.0ms=180°, then back to 1.5ms=90° and back to 1.0ms=0°, sweeping the servo position back and forth.

But when the "sweep" test program drives a Continuous Rotation Servo, the pulse commands are interpreted as speed rather than position. So the rotation speed is commanded from 1.0ms=full-speed-clockwise, to 1.5ms=slow/stop, to 2.0ms=full-speed-counter-clockwise, to 1.5ms=slow/stop, to 1.0ms=full-speed-clockwise. The servo was actually performing 1.0ms=spin-CW--1.5ms=stop--2.0ms=spin-CCW--1.5ms=stop--1.0ms=spin-CW... which would move similar to how a closed-loop servo behaves.

It could even support my robot’s weight when powered on, so there’s definitely some form of position feedback.

Testing it under mechanical load, might have just made the motor stall. I don't know your robot's weight or the wheel diameter, so I can't address whether you reached the stall torque, but it is a pretty small motor. But I don't think your test was a valid test of position feedback.

If you use the servo sketch to send a constant position command (like say 45°), then a normal closed-loop servo should position itself at 45° and stay there. But an open-loop Continuous Rotation Servo will instead just spin. Try it. There is no position control, it just runs open-loop at the commanded speed.

Related Topic