Servo frequency

we're using DS3239mg servo motor and arduino due. there's a sound in it but does not move. We thought that problem is in servo.h file where refresh interval is 20000 (50hz). initially it DOES move but after we changed the value of refresh interval (cause we wanted to get 300hz) it stopped. Do y'all have any solution please??

Are you saying if you change it back to 50 it works, or did it stop working altogether?

But why do you (think you) need such a fast refresh rate?

And what's the power requirement and how is the servo actually powered?

Please post the sketch that you are using

That is the correct refresh for a servo. The servo signal is a pulse of 0.5 to 2 mS repeated 50 times a second.

Why do you want to damage your servo? The refresh rate being faster doesn't mean anything with regards to the servo's movement or responsiveness. I think you misunderstand how they work.

You can't power a servo from the Arduino if that is what you are doing.

newer digital servos can work with 11 milliseconds which is a frequency of 1/0.011 = 90.909 Hz.
But 300 Hz is way above what any RC-servo can deal with.
What is the reason that you want 300 Hz.

I guess you mean DS329MG not 3239

What is the reason why you want to use 300 Hz. What do you think will change if you change the frequency from 50 Hz to 300 Hz?

best regards Stefan

1 Like

Seeing a pattern here, @dulamsuren ?

when i change it to 50 back it did not work (all do not work no longer). Because of assignment requirement i want a fast refresh. Also we're using power supply 5v from arduino due.

Maybe you damaged it by changing it to too high a value.

That's a cr@p reason- even if it's a requirement of the assignment you should know why the assignment wants it- what's the benefit of making the change? It won't make the servo do its job any better....

You should provide separate power to the servo, not use that of the Aduino.

#include <Servo.h>
Servo myservo;

void setup() {
  myservo.attach(9);
  Serial.begin(9600);
}

void loop() {
      myservo.write(180);
      delay(2000);
      myservo.write(0);
      delay(2000);
}

No, that's not the way to do it. Servo's need lots of current, a separate power supply is the way to go so it doesn't pollute the logic supplies and cause problems or damage (which may have already happened)

1 Like

image
it's the servo that we're using. it's datasheet says 300hz is possible.

Stall Torque (5V): 27 kg / cm
Stall Torque (6.8 V): 32 kg / cm
Speed: 0.16 sec / 60 ° (5V) / 0.12 sec / 60 ° (6.8 V)
Operating voltage: 4.8 ~ 7.2 DC
Weight: 65 g
Working frequency: 50-330Hz
Size: 40 x 20 x 40.5mm

Whoops, more misprints in servo data (very common alas)!

I think they mean "27 kgf-cm" stall torque - ie 2.7Nm, with a speed of about 8 rad/s, ie a mechanical power of 2.7 x 8 = 22W or so, so it probably pulls about 30W electrical power at stall, ie 6A at 5V.

Its a common thing to drastically underestimate the current requirements of servos and motors when new to them - even the smallest servos need 1A or so, this is a monster one.

This is a heavy-duty servo. If you supply such a big servo from the 5V-pin of any arduino-board I would not be astonished if the board is resetting permanently.

The microcontroller-world is not superstandardised like USB-devices
You have to take care of more things than just

"does the plug fit into the socket"

There are a lot's of pictures and tutorials and videos online that show supplying a servo from the 5V-pin. This works only for super-tiny 9g servos with no load.

Your servo is a 65g servo

best regards Stefan

Still not hearing from @dulamsuren why they really need to change the refresh to such a high frequency, other than "Because of assignment requirement"....

I told you in post #4 so why are you still doing it?

This explains why it is not working and why you might have damaged it.

Why are asking questions if you are only going to ignore the answer?

We had a French student last week asking how to do something stupid and unnecessary with some RFID readers. Maybe @dulamsuren is also French and has a stupid supervisor as well.

Any road up (as we say where I live) it is unlikely he will listen to this advice.

I'm thinking you mean dulamsuren, the OP, not me.

Compared to you though @Grumpy_Mike being from oop North, I'm almost French, being a Sussex lad :wink:

Yes sorry I got mixed up but I corrected it just before your reply.

hm 330 Hz means a timeperiod of 1/ 330 = 0.00303 seconds
This means each 3 milliseconds a 2 milliseconds pulse is created
hm well this fits into a a 3 milliseconds interval.

The turning speed at 6.8V is 0.12sec / 60 = 0.002 seconds per degree
this means correction of 1 or 2 degrees could be achieved physically withing the 3 millisecond-period of a 330 Hz signal.

a turn of 90 degrees needs 0.12 / 60 * 90 = 0.24 seconds

With a 50 Hz signal wich is a timeperiod of 1/50 = 0.02 seconds
a 0.02 / 0.003 = 6.67 degree is done.
This means only in case of angles smaller than 6.67 degree there is an advantage of a signal-frequency bigger than the standard 50 Hz.

I have doubts if this is nescessary for your robot. Depending on your mechanic high-speed moving can (but must not) cause unwanted oscillations of the robots mechanical components.

Still it would help a lot if you would post a picture of your robot that shows the mechanic.

The advice the users here can give is based on the informations you provide.

to avoid a situation like describe below you should provide as much information as you can

details versus overview:
We are talking about details. Please give an overview over your whole project.
in mimimum 70% of all cases knowing the whole thing offers completely different and much better working solutions.

This is like

here is an analogon that shall show what can happen if just ask for details:

Newbee: "I want to do better cutting please help me sharpening. "
Expert: Sure I can help you. What kind of cutting-tool are you using?
(expert asks back for details the newcomer left out slowing down getting a solution)

Newbee: a scissor.
Expert: OK take this sharpening tool
Newbee: Yea works great Next question How can I make it cut faster I need to finish faster.
expert: Motorised scissors.
newbee Yea works great though still not fast enough.

expert: Ok can you give an overview about what you are cutting.
newbee: the green of a football-arena.
expert: Oha! take a big mowing tractor with a seven boom spindel-mower and GPS-steering

In the beginning the newbee always just told details.
The expert was assuming the newbee knows that his basic approach is well suited.
which turns out to be very bad suited
that's the reason why it is always a good idea to give an overview and to explain what shall happen in the end.

best regards Stefan

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