Pages: [1]   Go Down
Author Topic: Servo only goes 90º  (Read 1025 times)
0 Members and 1 Guest are viewing this topic.
Portugal
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello folks,

I have recently bought five servos:
A. 2x HS-311 - standard servo
B. 1x HS-5625MG - digital high torque
C. 2x HS-7955TG - digital high torque

They are all new, in good condition and, accordingly to specifications, can travel 180º.
I am using the Arduino Mega 2560 and an external power supply, that can provide enough current. I'm running each servo at a time for now.

If I use the servo program from the examples, the A (HS-311) servo runs perfectly well, no problems at all (runs the 180º range). However, if I use servos B or C they will stay "rigid" at the middle angle, although the readings from the Knob are ok.
I think the problem isn't with the wire connection: I double checked everything and all the connections are similar to the ones I found in the web (grounds connected,...), plus the fact that the A servos work.
Then I tried another approach, using the   myservo.writeMicroseconds(). Please check the program:
Code:
#include <Servo.h>
Servo myservo;
 
void setup()
{
  Serial.begin(9600);
  myservo.attach(2,1000,2000);
  delay(15);
}
 
void loop()
{
  for(int i=0;i<3000;i=i+1)
  {
  myservo.writeMicroseconds(i);
  Serial.println(i);
  delay(10);
  }
  delay(1000);  
}

With this program the servo will run from about the 1000 us to 2000us, from 45º to 134º. I can not control them in the 0-44º or the 135-179º range. I used several values in the myservo.attach(2,min, max) but nothing as changed.
I could find some people facing the same trouble, but I couldn't find any solution. I really need the 180º range to work.
Could you please help me?
Thanks in advance!

Samuel
« Last Edit: March 27, 2011, 01:03:15 pm by uitwear » Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17292
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

First:

for(int i=0;i<3000;i=i+1) is incorrect I think, I think you meant to do: for(int i=1000;i<2000;i=i+1)

Next to get 180 degree travel (assuming the servos are indeed capable of that much travel) you will have to find the minimum and maximum microsecond pulse width that the servo needs to travel that far, as 1000-2000 is obviously not enough. Sometimes the servo's datasheet will show it's extended travel pulse width values below and above the standard 1000-2000 usec values. So you might end up with using say: myservo.attach(2,800,2300);


Lefty
Logged

Portugal
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello, and thanks for the quick answer!
I used the for from 0 to 3000 exactly to try to discover what the bounds are. I tried to change the values to the ones you said... servos now run much better: about 160º.
I think the problem is about to be solved using the correct bounds
Thanks a lot!
 smiley
Logged

Pages: [1]   Go Up
Jump to: