Servo Swap

Hello,

Got a question someone i hope can answer. I have a project i have been working on that moves a servo from to specific position when a button is pressed then back to its start position when released. simple program and worked well. The problem is i went to swap the servo for something with a lot more torque and it doesn't work. it moves once. and stops and then the servo has a low beeping. but when i load the stanadard sweep program the new servo works fine.

Any ideas why this would happen.

the new servo is a hitec hs-5645mg
comapred to a standard futaba

How are you powering the servo?

5v through arduino its a 4.8 - 6v servo

maverickcnc:
5v through arduino its a 4.8 - 6v servo

Well you shouldn’t do that, it should have its own supply, although it does seem odd it runs ok with sweep but not your code.

This is my code. Simple

#include <Servo.h>

Servo servo_pin_9;
//int pos = 0;    // variable to store the servo position 
 
void setup()
{
  pinMode( 2, INPUT);

  servo_pin_9.attach(9);
}

void loop()
{
  if (( ( digitalRead(2) ) == ( LOW ) ))
  {
    servo_pin_9.write( -60 );
 delay (15); 
}
  if (( ( digitalRead(2) ) == ( HIGH ) ))
  {
    servo_pin_9.write( 60 );
 delay (15);  
}
}

I'm not sure what happens when you do a servo.wrtie(-60)....

I think you think that means -60 from where it is (edit ... or -60 from the centre?), but it doesn't work that way. All servo.write()s are absolute, and in fact converted to pulses in microseconds; I have no idea what pulse is sent for a -60.

I'm wondering if it's not slamming the servo against the end stop; that might not have been a problem for your previous servo but maybe causes an issue with the new more torquey one.

Servo angles are from 0 to 180, with 90 as the centre. If I were you I'd recode the sketch using 90 as your starting point. Then -60 might actually be 30?

so in my code where i say go 60 i should say 150 and where i say -60 go 30

So that worked thank you very much for your help. I wouldn’t even of thought that.

You're welcome.

While you were at it, did you give the servo its own power?

My quick calc shows that servo will draw an amp, which is not unlikely. Here's the numbers, with input from here.

Torque T is 10 kg.cm (not kg/cm grrrrr I hate that) which is 1 Nm.

Angular velocity w (omega) is 0.2 seconds / 60 degrees which is near enough 0.2 seconds / radian so 5 radians / sec

Power P = Tw = 1x5 = 5W.

P= Volts V x Current I = VI so I = P/V = 5/5 = 1A.

1A means it needs its own supply.