Go Down

Topic: Slow the speed of a continuous rotation micro servo  (Read 3814 times) previous topic - next topic

tessabergan

Hi,

I would like to slow the speed of a continuous rotation micro servo. (I'm using a TowerPro MG90D DiGital.)

I have tried different values between 0 and 90, and 90 and 180 for the write command, and between 1000 and 1500, and 1500 and 2000 for the writeMicroseconds command, but the servo continues rotating at one speed (it seems its full speed), or just slightly moves to a point (rather than rotating continuously at a slower speed).

Here is the code I've been using.

Code: [Select]


#include <Servo.h>

Servo myservo;

void setup()
{
  myservo.attach(9);
  myservo.writeMicroseconds(1500);  // set servo to mid-point
}

void loop()
{
  int position;

  myservo.writeMicroseconds(1400);    // Rotate clockwise (full speed)

  delay(2000);         // Time rotating

  myservo.writeMicroseconds(1600);   // Rotate anticlockwise (full speed)

  delay(2000);         // Time rotating
}




 
Any advice would be greatly appreciated :)

outsider

Did you try values near 90? Like 91, 92, 93? At some point near standstill (90? 1500?) servo should just start to creep and get faster as you move away from standstill value. Try this little test sketch, type a number in top of serial monitor and hit [ENTER].

Code: [Select]

#include <Servo.h>
Servo servo;


int pos = 0;

void setup() {
  // initialize serial:
  Serial.begin(9600); //set serial monitor baud rate to match
  servo.attach(9);
}

void loop() {
  // if there's any serial available, read it:
  while (Serial.available() > 0) {

    // look for the next valid integer in the incoming serial stream:
    int pos = Serial.parseInt();
    pos = constrain(pos, 0, 2000);
    servo.writeMicroseconds(pos);
    Serial.println(servo.readMicroseconds());
  }
}

Also, how are you powering the servo? Not from Arduino's 5V pin I hope.
Bulletin: From the Spec Sheet:  "Normal Servo Travel: 90° (45° each way)"
             "Deadband Width: 1us":   Hoowee, that's TIGHT!, might have to use microseconds to find the standstill position (if there IS one). I'll edit the test sketch.

Page don't say it's continuous rotation, did you modify it?

tessalouise

Thanks for your reply outsider,

Yep, I've tried values near 90 but this only moves the shaft back and forward once, or makes the servo jitter if the delay is shorter.

Thanks for your test sketch. Could you clarify what you mean by the serial monitor? When I uploaded the sketch as is, the servo doesn't move.

I'm currently powering the servo using the 5V pin and it seems to work fine in getting it to rotate backwards and forwards at high speed.

I bought the servo as a continuous rotation servo (didn't modify a regular servo) and it rotates continuously for as long as the delay value is programmed for. 

please let me know if there's any other information that would be helpful to know. Cheers!

outsider

Screenshot of IDE & Serial monitor.

tessalouise

Hey,

Thanks for the clarification but no luck with that either, unfortunately - it remained at the same speed at all values from 0-180. It stopped completely at 1500, and reversed direction at 2000. For values around 1500 it moved slightly to a point and stopped.

With the Sweep example sketch, the servo rotates at full speed for the time of the delay value, then slows down to move to the specified angle, then rotates at full speed again. So it can move at a slower speed, but at this stage it only does so to get to a certain point before its kicks back into full speed.

I guess what I need it to do is rotate in steps of 1 degree for the specified delay time. Do you know if/how the Sweep sketch could be modified so that the servo isn't directed to a certain angle but is directed to move in steps of 1 degree?

Many thanks

usenetfan

I am at the same spot as tessalouise.

Entering a value like 90 sends 540 to the Serial monitor, and entering 3000 sends 2000. Those are the min and max values at least.

1200 stops the servo.

But is there absolutely no way to smoothly affect the rotation speed and achieve acceleration from zero to max in both directions?

TomGeorge

Hi, 



Quote
(I'm using a TowerPro MG90D DiGital.) 
Have you modified this servo as it is not a continuous unit.

Tom... :)
Everything runs on smoke, let the smoke out, it stops running....

usenetfan

Hi Tom,

it is actually a genuine 360 degree continuous servo without any mods needed. Loves to run both ways and at high speed.

vinceherman

Servos that have been modified to rotate 360 degrees (either by the end user or the manufacturer) are no longer servos.
The have no positional awareness.

Instead, after modification, they are nicely packaged motor and gearbox units with a controller.  The controller is good for directing which direction the motor runs.  That controller is less useful for controlling speed.

Before modification, the purpose of the servo was to move to the specified position as quickly as possible and stay there.  There is likely a bit of PID logic in the controller, so at values very near 1500, the motor might run slowly.  But as soon as you move a bit away from 1500, the controller probably sees enough deviation in the P(position) part of PID to tell the motor to run at full throttle.

vinceherman

#9
Nov 30, 2017, 02:09 pm Last Edit: Nov 30, 2017, 02:09 pm by vinceherman
Want better speed control?  Yank out the electronics of the servo, wire the motor directly to a better speed controller and run them like any DC motor.

I would expect that either of these would work.
https://www.pololu.com/product/2135
https://www.pololu.com/product/2511

usenetfan

I am just curious as to why my unmodified analog 360 degree servos offer seamless speed control but the unmodified 360 degree servos only have one full speed either direction.

I tried to contact the manufacturer and linked my Youtube videos as proof but of course they could not see them.

Thanks for the link to pololu too!

vinceherman

#11
Nov 30, 2017, 03:15 pm Last Edit: Nov 30, 2017, 03:15 pm by vinceherman
I am not sure what devices you are describing.
Most servos do not turn 360 degrees.  (some of the more expensive, purpose built ones like winch servos do, but I will assume that this is not what you have.)

An unmodified servo rotates 180 degrees (often a bit less).  They move to the specified angle and stay there until told to move somewhere else.

These servos are often modified, either by the end user or the manufacturer.  The position pot is removed and 2 resistors put in its place.  If you have a continuous rotation servo, it is modified and is no longer a servo.

Do various servo controllers behave differently?  Sure!  They likely have different PID logic.  Or other differences.
But it is best to assume that using a modified, continuous rotation servo will most likely result in poor speed control.


usenetfan

This is the exact servo I have three copies of:

https://www.servoshop.co.uk/index.php?pid=TPMG90D360&area=Servo

vinceherman

Yes.  It looks like you purchased a continuous rotation servo.
Good for controlling direction of rotation.
Questionable for controlling speed.

usenetfan

Is it really so that I can achieve complete control of servo speed with analog but not digital? What is the purpose of having two servo types if only one can be controlled with precision?

Please see this video of running analog, and tell me if this is beyond digital?

https://youtu.be/skZPusMcXkA

Go Up