Template:ServoCalibration

From Phidgets Support
Revision as of 21:22, 16 August 2012 by Mparadis (talk | contribs) (Created page with "Each servo behaves slightly differently. The Phidgets API provides calibration parameters for a number of different models of servo motors; however these values are generic wi...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Each servo behaves slightly differently. The Phidgets API provides calibration parameters for a number of different models of servo motors; however these values are generic with respect to the model and not specific to each individual unit. It is possible to generate your own values through some manual calibration in the event that your application requires very accurate control or if you are using a servo for which default values are not provided. This is done as follows:

Open the Phidget control panel and open the GUI for the servo controller.

Servocalibrate1.png
Plug your servo in and set the servo type to RAW_us_MODE.
Servocalibrate2.png

Choose the correct servo motor (based on what pins the motor is connected to) and then starting with the target position slider in the approximate middle, engage the motor. The motor should move into position.

Move the target position slider to the left until the motor stops turning. The servo should stop before the slider hits its limit. Take note of the value at which the motor stops, the more precise you can be the better but the nearest multiple of 10 is usually sufficient. This is the low μs value and will be used later.

Move the slider to the right and again take note of where the servo stops turning. This will be the high μs value.

Using a protractor, measure the actual range of movement of the servo motor. This should be close to the rated value but it will likely not match exactly. Accuracy to the nearest degree is good enough.

To do this start with the motor at one extreme. Mark a spot on the motors output shaft in line with 0 degrees and then rotate the motor to its other extreme. Take the value of where the mark you made now rests and that is the motor’s full range of motion. For linear actuators, retract the arm all the way, mark the position of the end of the arm, extend it to its maximum length, and then measure the distance in millimeters from the end of the arm to the old position.

Finally, check the motor’s data sheet to see the maximum rated velocity. Now that all the measurements have been taken, you can use


setServoParamters(min_us, max_us, degrees, velocity_max)


setSevoParameters has 4 arguments, min_us is the minimum μs value you recorded, max_us is the max μs value, degrees is



where d is the degrees you measured (or the millimeters if you’re using a linear actuator), and velocity_max is the velocity from the servo’s data sheet multiplied by the degrees argument.

Servocalibrate3.png

For example:

The HITEC HS-322HD used in testing has the following parameters:


HITEC HS-322HD Parameters
Argument Value
min_us 630
max_us 2310
degrees
velocity_max


So for example, in C# to initialize the specific HS-322HD tested the following change would be made to the AdvancedServo example code in the advServo_Attach function:


        void advServo_Attach(object sender, AttachEventArgs e)
        {
            ...
            //Set the default servo type to the one Phidgets sells
            foreach (AdvancedServoServo motor in attached.servos)
                //motor.Type = ServoServo.ServoType.HITEC_HS322HD;
                  motor.setServoParameters(630, 2310, 9, 2949);
            ...
        }


Your program has now been calibrated to your servo motor. You can get calibration parameters for multiple motors and use all of them in one program should you require it.