Moving a CC 360 degree servo motor TD-8130MG

Hello,
Yes, I know they're not position aware, that's not what I'm concerned with.

What I'm trying to do is to figure out how to get it to move at all. The default 180 degree sweep moves it well enough in both directions, but the motor moves more in the clockwise direction than back again. What I wanted to do was to try and move the motor in one direction for a set amount of time.

When I change the code to:

void loop() {
  for (pos = 180; pos >= 170; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);
    delay(100);
  }
}

It moves the motor at "full" speed in the CCW direction.

When I change it to:

void loop() {
    myservo.write(170);
    delay(100);
}

The motor doesn't move at all -- which considering 90 degrees should be the point at which it is still and all other values move it one way or another is odd to me.

It seems to me that the speed is determined by the value...

void loop() {
  for (pos = 180; pos >= 90; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);
    delay(100);
  }
}

As the motor slows down over time here.

So, what value do I feed the servo to get full speed in one direction and the other direction?
For all I know, 170-180 progressively speeds up and slows down the motor and I wanted full speed without the code-run-time penalty of those for loops.

Thanks!

untested

  for (byte i= 0; pos < 180; pos++) { 
    myservo.write(-1);
    delay(100);
  }
  for (byte i= 0; pos < 180; pos++) { 
    myservo.write(1);
    delay(100);
  }

Result: Motor spins forever in CW direction. I tried reducing the delay to 15 and the 180 to 1 to no avail.

Additionally, I'm running the motor over a USB tty device. Although your code brought it to full speed, I had to manually start it with my hand. I'm wondering if maybe the USB interface can't give it sufficient amperage to start at full speed and so it needs to ramp up?

you don't understand, servo rotate always with "full" speed. we can simulate the "slowing" with delays between every small position change.
and, if i understand "datasheet" right td-8130mg rotate only one direction.

Not sure what you mean by that. Are you saying it rotates faster in one direction than the other?
As far as I can tell, the servo specifications are given in microseconds, and you can use that directly as:

myservo.writeMicroseconds(1500);  // should set servo to STOP; higher and lower numbers rotate at various speeds in one direction or the other

You can then play with the numbers as per the data sheet on Aliexpress.

Not sure what you mean by that. Are you saying it rotates faster in one direction than the other?

I mean that although the time for rotation is equal in both "for" loops of the sweep example code, the motor rotates for a greater length of time in CW direction.
Once I feed it (and I'd assume this is what's going on in the "for" loop of the sweep example code), a value of 110 (for pos), it just vibrates and does not move at all; even with help.

I'll have to read and try more things tomorrow.
Thanks again!

1 Like

@cncnotes @kolaha I did search online, but I can't find the datasheet. Can you give me a link?

I'd like to add, that the servo still doesn't start up without a "push" from my hand. I think this has to do with the voltage/amperage it requires. IDK what the minimum is, but apparently it's ever so slightly higher than what my USB connector can provide through the TTL->arduino->servo. Again, the servo is totally unloaded.

If you open this link and go down to specs, it will show the millisec ad range of movement. You will need to find your servo.
It is odd that it needs a push to get going. The stall current is 2.6A or higher. So that may be the case if it was under load. Do you have a multimeter to check the current and voltage of the servo?
https://www.aliexpress.com/i/2255800045659093.html?gatewayAdapt=4itemAdapt

@cncnotes
Actually, my measurements proved more confusing to me than enlightening. Let's see if you can make greater sense of them.

I measured the amperage from the servo's wires and the voltage from the TTL adapter to the Arudino, as I wanted the total voltage vs. the Vdrop a cross the servo.

Remember that it's USB-3.0->TTL->Arduino->Servo.

When the servo is trying to move, but cannot, I read:
4.921v TTL out.
66mA TTL out.
32mA Servo in.

When the servo is running, I read:
4.775v TTL out.
215mA TTL out max.
183mA-213mA Servo in.

Now, why would it read more amperage when it's running than trying to move but stalled?
Why the drop in voltage? My MB is a good one. Maybe it's the TTL adapter? It's a CP2102. But then shouldn't it pass-through the voltage/current? Yes, it does, 0.7Ohms resistance is the highest I can measure. The only other thing on the line is the front USB 3.0 header.

I think this is the problem.
The Arduino should not be used as a power source, esp for high current devices such as servos.
You should power the servo from a separate power source. The GND of the servo and Arduino should be connected, and of course the Arduino output pin to the servo signal pin.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.