Newbie: HS-785HB Winch Servo

Hello all,

I am currently working on a project using the HS0785HB Servo and simply trying to move it 0 to 90 degrees and then 90 degrees and back. I have been using the default code for servos from arduino:

#include <Servo.h>

Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0; // variable to store the servo position

void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}

void loop() {
for (pos = 0; pos <= 90; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}
for (90; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}
}

When I run this code it does not work properly. Do I need to be using an external power supply? Any advice would be appreciated.

-B

When I run this code it does not work properly.

What does that mean? That statemant contains no real information that we can use to help you. Describe what actually happens and how that differs from what you want to happen.

Servo.write(90) will move a servo to it's half way point. Since an HS-785HB has around 6 turns full travel that will be 3 full turns from the write(0) and write(180) points.

Despite the write parameter having values from 0 to 180 the specific values have almost nothing to do with angles with the same number.

If you want accurate positioning of a sail winch servo it's better to use writeMicroseconds. That takes values from about 600 to 2400 so you have much more control.

Oh and yes that's a quite powerful servo so you will need to use an external power supply.

Steve

Hey guys,

Sorry I accidentally stated the wrong servo. Its actually the HS-5055MG Servo. And when I said it "does not work properly" I meant that it moves and then it stops and I can just hear a buzzing. I tested the code on a Hitec HS-311 and it works perfectly, rotating 0 to 90 and then 90 to 0. Im so confused on why it works on one but not the other.

bnomick:
it moves and then it stops and I can just hear a buzzing

Some times this means that you are attempting to move the servo beyond its physical limitations.
Instead of moving to and from zero degrees, try 40.

  for (pos = 40; pos <= 90; pos += 1) { // goes from 40 degrees to 90 degrees

and

  for (90; pos >= 40; pos -= 1) { // goes from 90 degrees to 40 degrees

Still plan on using a separate power supply for the servos.
If this moves without binding like you are getting now, you can experiment with the range to see what works. You might try altering the default range in the attach function.

Assuming we have the right servo this time that's a programmable digital servo. Do you also have the programmer so you can set the end points, dead band etc?

Steve

slipstick:
Assuming we have the right servo this time that's a programmable digital servo. Do you also have the programmer so you can set the end points, dead band etc?

Steve

Hey Steve,

Im not sure what you mean by the programmer if you could just elaborate a bit more. I was unaware that this was required to program servos? Does this programmer do the same thing that an Arduino would do by programming one?

Thanks