View Full Version : PWM to Phidget Servo position function

08-13-2007, 01:30 PM
Many customers ask about translating a PWM position to a Phidget position.
Well, here ya go (written in C# Express):

private double ConvertPWMToPhidgetPosition(double PWM)
double phidgetMotorPosition = Math.Round((Convert.ToDouble(((PWM * 1000) - 244) / 10.6)), 1);
return phidgetMotorPosition;


08-13-2007, 03:59 PM
Hi All,

Here is the same code in C:

double round_double(double x, int precision)
int i = (int)(x / precision + 0.5) * precision;
return (double) i;

double pwm_to_phidget_position(double pwm)
return round_double((((pwm * 1000) - 244) / 10.6), 1);

Also, it's useful to know that 1.5 pwm is the neutral position. When using a Banebots Motor Controller you must set the servo position to pwm 1.5 to make the blinking green RDY led change to solid. After the RDY led is steady you can send additional commands to adjust the speed. In my testing I've noticed that 1.525 pwm causes the motor generate noise but not spin. At about 1.55 pwm the motor spins and after about 2.0 pwm the motor is at it's top speed and doesn't get any faster. Anything below 1.5 pwm causes the motor to go in reverse.

08-13-2007, 05:02 PM
Thanks for the extra info:)

Also to note, in addition to 1.5 being neutral as agent911 mentioned, the Banebots motor controllers (and I believe all other PWM driven speed controllers) accept a PWM signal between 1.0 and 2.0. PWM speed controllers do not respond to above or below that range.