Controlling the HD 1501MG Servo with Arduino

Hi all,

I think I’ve been through all the material before bringing this up; it’s my first post so I guess we’ll see.

Project

I’m creating a automated mount that rotates a smartphone around it’s optical center to capture images that can be stitched into a spherical panorama or “virtual tour”. To do this I’m tilting and panning using RC Servos that are controlled with an Arduino Micro. I’m using a 360 servo for panning and because of the torque needed to rotate the smartphone to horizontal, I am using the HD 1501MG. It actually has enough torque to raise a 7in tablet as well.

After dealing with lots of little problems, everything is working fine except for the Tilt Servo.

Problem

To capture the zenith (straight up) and nadir (straight down) I need the 1501G to rotate through 180deg. Out of the box it seems that it only does about 160deg. In rotating the spindle, there clearly is enough rotation between the mechanical stops so it looks like I should be able to change the pulse width to get the extra 30 deg. \

No luck here.

The Arduino’s servo.h file by default has a 544 microsecond minimum and a 2400 microsecond maximum pulse width.

I created at test sketch to see what would work and whenever I increase the maximum pulse width the result is that the servo’s angular range actually decreases by about 30 deg and beyond that angle any effort to increase it is “ignored”.

Code

In the code I’ve put the default variables in red:

#include <Servo.h> 
 
int shutter = 2;
int shutter_delay = 100;

Servo tilt_servo; 
Servo pan_servo;

int tilt_pos = 240;   
int tilt_min = 0;
int tilt_max = 300;
int tilt_step = 10;
int tilt_delay = 700;
int tilt_move_step = 1;
int tilt_move_delay = 1;

void setup() 
{ 
 pinMode(shutter, OUTPUT);
 digitalWrite(shutter, LOW); 
 tilt_servo.attach(10<font color="#FF0000">, 544, 2400</font>); 
 tilt_servo.write(tilt_pos);
}

void loop () {}

To summarize

I’m trying to understand whether:

The 1501MG is actually capable of 180 degrees
If it is, whether the Arduino’s servo.h is capable of controlling it
If both are true, suggestions how I’m screwing it up and can fix it :-/

Thanks in advance.

After continuing to try to solve this, short of wiring into the servo and replacing its code with one on the Arduino, it doesn’t look like the 1501MG is in fact capable of doing 180 deg of rotation.

Pity…

Hello.

Most hobby servos will rotate 90 degrees over standard 1 ms to 2 ms input pulse range; the range can typically be extended to something close to 180 degrees by expanding the pulse range, but the achievable extended range is usually not specified by the manufacturer. If you want a guaranteed 180 degrees, you will generally have to purchase a specialty servo like our 1/2T Sail Winch Servo.

You can read more about why the range of rotation is not specified in the second FAQ under the FAQs tab on the our servos’ product pages.

For more information about servos and how to control them, I recommend the following series of blog posts on servos starting with: Introduction to servos.

  • Grant

Thanks Grant,

I continue to research this but am not having much luck. I’m using a 360 servo on the panning plain and it works fine. I haven’t used it on the tilt plain because it doesn’t have enough torque.

In regards to specs, I did find a data sheet: http://www.chd.hk/UploadFiles/Att/2012111512021982.pdf which might be useful to Pololu customers to have access to. Key specs are:

165 deg range
pulse width range 800-2200 microseconds

There are also useful current specs.

Since I’m only getting about 150 deg off both of my 1501mg’s, I’ll continue to play with it. I am getting acceptable application results from the 150 deg when I stich manually but it remains to be seen whether it will work when I switch over to automatic.

Thanks for sharing that datasheet. Please note that Power HD has had a couple revisions of that servo, so I am not sure if that datasheet is applicable to the version that we sell now. It may very well be that the servo you have has a max range of rotation of 150 degrees.

  • Grant