Results 1 to 3 of 3

Thread: PWM to Phidget Servo position function

  1. #1
    Join Date
    Sep 2006
    Location
    Carol Stream, Illinois
    Posts
    1,695
    Images
    118
    Rep Power
    105

    PWM to Phidget Servo position function

    Many customers ask about translating a PWM position to a Phidget position.
    Well, here ya go (written in C# Express):

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

    Enjoy

    �In the long history of humankind (and animal kind, too) those who learned to collaborate and improvise most effectively have prevailed�
    - Charles Darwin

  2. Smile Re: PWM to Phidget Servo position function

    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.

  3. #3
    Join Date
    Sep 2006
    Location
    Carol Stream, Illinois
    Posts
    1,695
    Images
    118
    Rep Power
    105

    Re: PWM to Phidget Servo position function

    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.

    �In the long history of humankind (and animal kind, too) those who learned to collaborate and improvise most effectively have prevailed�
    - Charles Darwin

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Programming a Continious Rot Servo
    By Sirstrafe in forum Software and Programming
    Replies: 3
    Last Post: 04-27-2007, 09:11 AM
  2. Problems with my servo
    By sjoerd in forum DYNAMIXEL & Robot Actuators
    Replies: 8
    Last Post: 03-01-2007, 12:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •