Pages: [1]   Go Down
Author Topic: Servo library mostly working.. Mostly  (Read 876 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So, I'm using the servo library to turn two HITEC HS-5645MG digital servos. It basically works, with one hitch: they don't turn the full 180 range, but rather more like 140. Being a good little n00b I emailed HITEC to ask if this was normal, and what to do, I got a cryptic answer:

"Thank you for choosing Hitec products. The 5645MG can handle a wider PWM signal which will allow the servo to travel 180 degrees."

I asked for clarification to no avail. What I seem to be understanding from this is that possibly the overall pulse frequency I'm using is too small? It seems like it wouldn't work at all if that was the case.

So, I set up a loop using the options available in the Servo.attach function to manually set the minimum and maximum pulse widths, write a 0 and a 180, and see how far the servo would go.. It wasn't any further.

Any insight?
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

Use writeMircoseconds instead of write, try a range from -

writeMicroseconds(MIN_PULSE_WIDTH);

to

writeMicroseconds(MAX_PULSE_WIDTH);

This is the maximum range defined by the servo library in Servo.h

It might be larger that your servo can manage over the long term, so if it gives you more range than you need, create your own MAX and MIN to limit the servo to the range you need.

The values of MIN_PULSE_WIDTH and MAX_PULSE_WIDTH as defined in servo.h are

#define MIN_PULSE_WIDTH       544     // the shortest pulse sent to a servo 
#define MAX_PULSE_WIDTH      2400     // the longest pulse sent to a servo

You can define your own limits to be within this range in your sketch, for example

#define MY_MIN_PULSE_WIDTH       800     // the shortest pulse I will use
#define MY_MAX_PULSE_WIDTH      2200     // the longest pulse I will use

Duane B

rcarduino.blogspot.com
Logged


0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9541
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

To get more rotational range out of a digital servo, you may have to purchase a digital servo programmer for your particular servo.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

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

Duane-
Thanks. writeMicroseconds didn't work at all, actually, but I appreciate it; I had tried it earlier. I have the budget to buy the programmer, so I'm going to try that today. I appreciate the help, guys!

Brad
Logged

Pages: [1]   Go Up
Jump to: