1066 User Guide: Difference between revisions

From Phidgets Support
No edit summary
No edit summary
Line 9: Line 9:


===Connecting the Pieces===
===Connecting the Pieces===
[[Image:1066_0_Connecting_the_Hardware.jpg|300px|right|link=]]
[[Image:1066_0_Connecting_The_Hardware.jpg|400px|right|link=]]
# Connect the servo motor to the PhidgetAdvancedServo controller.
# Connect the servo motor to the PhidgetAdvancedServo controller.
# Connect the Phidget to your computer using the USB cable.
# Connect the Phidget to your computer using the USB cable.

Revision as of 20:19, 30 August 2016


Required Hardware

  • A 1066 PhidgetAdvancedServo 1-Motor
  • A servo motor
  • A USB Cable
  • A computer

Connecting the Pieces

1066 0 Connecting The Hardware.jpg
  1. Connect the servo motor to the PhidgetAdvancedServo controller.
  2. Connect the Phidget to your computer using the USB cable.


Testing Using Windows

Phidget Control Panel

In order to demonstrate the functionality of the 1066, the Phidget Control Panel running on a Windows machine will be used.


The Phidget Control Panel is available for use on both macOS and Windows machines.

Windows

To open the Phidget Control Panel on Windows, find the Ph.jpg icon in the taskbar. If it is not there, open up the start menu and search for Phidget Control Panel

Windows PhidgetTaskbar.PNG

macOS

To open the Phidget Control Panel on macOS, open Finder and navigate to the Phidget Control Panel in the Applications list. Double click on the Ph.jpg icon to bring up the Phidget Control Panel.


For more information, take a look at the getting started guide for your operating system:


Linux users can follow the getting started with Linux guide and continue reading here for more information about the 1066.

First Look

After plugging the 1066 into your computer and opening the Phidget Control Panel, you will see something like this:

1066 Panel.jpg


The Phidget Control Panel will list all connected Phidgets and associated objects, as well as the following information:

  • Serial number: allows you to differentiate between similar Phidgets.
  • Channel: allows you to differentiate between similar objects on a Phidget.
  • Version number: corresponds to the firmware version your Phidget is running. If your Phidget is listed in red, your firmware is out of date. Update the firmware by double-clicking the entry.


The Phidget Control Panel can also be used to test your device. Double-clicking on an object will open an example.

RC Servo

Double-click on the RCServo object, labelled {{{2}}}, in order to run the example: [[Image:{{{1}}}_Servo_Example.jpg|center|link=]]


General information about the selected object will be displayed at the top of the window. You can also experiment with the following functionality:

  • Motor calibration options are provided. You can change the minimum and maximum pulse widths for your RC servo motor in the appropriate boxes. You can also change which position these pulse widths map to.
  • The SpeedRampingState checkbox lets the {{{1}}} know whether or not to take the Acceleration and Velocity values into account when moving the RC servo motor.
  • Use the Position slider to change the target position and move the RC servo motor.


Current Input

Double-click on the Current Input object {{{2}}} in order to run the example: [[Image:{{{1}}}_CurrentInput_Example.jpg|center|link=]]


General information about the selected object will be displayed at the top of the window. You can also experiment with the following functionality:

  • Modify the change trigger and/or data interval value by dragging the sliders. For more information on these settings, see the data interval/change trigger page.

Testing Using Mac OS X

  1. Go to the Quick Downloads section on the Mac OS X page.
  2. Download and run the Phidget OS X Installer
  3. Click on System Preferences >> Phidgets (under Other) to activate the Preference Pane
  4. Make sure your device is properly attached
  5. Double click on your device's objects in the listing to open them. The Preference Pane and examples will function very similarly to the ones described above in the Windows section.

Testing Using Linux

For a general step-by-step guide on getting Phidgets running on Linux, see the Linux page.

Using a Remote OS

We recommend testing your Phidget on a desktop OS before moving on to remote OS. Once you've tested your Phidget, you can go to the PhidgetSBC, or iOS pages to learn how to proceed.

Technical Details

An RC Servo can be instructed to move to a desired position by the controller. Internally, it monitors the current position, and drives the motor as fast as it can until it reaches the desired position. This is a very cheap and simple way to control a motor. It has some limitations - there is no way for the controller to know the current position and speed of the motor. Applications that want smooth movement suffer from the aggressive acceleration.

The PhidgetAdvancedServo is able to address some of these limitations. Instead of sending the desired position immediately, the PhidgetAdvancedServo sends a series of progressive positions according to acceleration and velocity parameters. In most applications, this dramatically smooths the operation of the servo, and allows reasonably precise control of position, velocity and acceleration. The PhidgetAdvancedServo has a built in switching regulator - this allows it to efficiently operate from a wide voltage range (6-15VDC), and maintain proper power to the servo motors even if the power supply is varying. This built in voltage regulator will not operate if your power supply is undersized.

For more information about servo motors and controllers, check out the Servo Motor and Controller Primer.

Connecting your Servo Motor to the 1066

1066 0 Pins.jpg

The pins on the 1066 are labelled B R W on the board:

  • B for Black is the Ground
  • R for Red is 5V
  • W for White (or Yellow depending on your servo motor) is the Data Line

Current Sense

The PhidgetAdvancedServo continuously measures the current consumed by each motor. The current roughly corresponds to torque, making it possible to detect several scenarios.

  • By monitoring for no current, it’s possible to determine if the servo is not connected. It may not be possible to distinguish between a servo at rest and a servo not attached.
  • Stalled motors can be detected, by monitoring for the maximum current possible with your motor.
  • The position limits of the servo can be programmatically determined by moving the servo until it stalls against the internal or external stops.

Limitations

The PhidgetAdvancedServo does not know the current position of the motor on its own. If your motor is free to move, and is not being driven beyond the physical limitations of the motor, the position returned to your application will be very close to the position of the motor.

Degree Abstraction

The PhidgetAdvancedServo software component uses degrees to specify position, velocity, and acceleration. The degree unit is translated into a pulse sent to the servo, but it’s up to the servo to translate this signal into a particular position. This translation varies between servo models and manufacturers, and it is up to the user to set up their particular servo so that the degree abstraction matches up with reality. Phidgets Inc. has quantified a number of common servo motors (see API section), which can be used with the ServoType function for to set these parameters. For servos not in this list, or to quantify a specific servo, the setServoParameters function can be used.

Defining a Custom Servo

Servos are driven with a PCM (Pulse Code Modulation) signal. To define a custom servo, you need to find the minimum and maximum PCM values that the servo supports.

The easiest way to do this is by bringing up the example and choosing RAW_us_MODE. This will display all positions in microseconds instead of degrees. Move the servo to both of its extremes, stopping when it hits the stops, then easing up a little (leave a few degrees of leaway), and record these values. You could also choose a specific range in degrees that you require and find the PCM values that correspond. Most servos operate within 500us - 2500us.

Record the degrees of rotation that this PCM range represents (using a protractor, for example).

Calculate the maximum velocity of your servo, in degrees/second. Most servos list their max speed in seconds per 60 degrees. convert this into degrees/second:



The actual maximum velocity of your servo may be slightly higher or lower, as velocity depends on voltage.

Feed these four values into the serServoParameters function to complete the set up. This should be done before any other function are called (in the attach event ideally).

Note that many servos can operate quite a bit outside of their rated ranges.

Degree Abstraction (Historical Model)

Historically, our degree abstraction has been based on the Futaba FP-S148 servo. This is the default abstraction used for the PhidgetAdvancedServo, to maintain backwards compatibility when the new model was added.

Using the 1066 with a Servo Motor

The PhidgetAdvancedServo has been designed to be used with a variety of RC servo motors independent of the motor-specific position, velocity and torque limits. Select a motor that suits your application and falls within the PhidgetAdvancedServo device specifications.

To use a servo motor, first select (in software) which attached motor the PhidgetAdvancedServo should affect. Position, velocity and acceleration can be controlled for each individual motor. The software can also display a readout of the electrical current flowing through each motor.

Using the 1066 with Continuous Rotation Servos

A continuous rotation servo is a servo motor that has had its headgear-stop removed and potentiometer replaced by two matched-value resistors. This has the effect of allowing the motor to rotate freely through a full range of motion, but disables the motor’s ability to control it’s position.

When using the PhidgetAdvancedServo with a servo motor modified in this way, the position control in software becomes the motor’s speed control. Because the two resistors that replace the motor’s potentiometer are matched in value, the motor will always think its shaft is at center position. If the target position in software is set to center, the motor will believe it has achieved the target and will therefore not rotate. The further away from center the target position is set to, the faster the motor will rotate (trying to reach that position, but never doing so). Changing the value above or below center changes the direction of rotation.

Using the 1066 with Electronic Speed Controllers (ESCs)

Electronic Speed Controllers are commonly used in RC hobby planes, cars, helicopters. It’s a controller that accepts a PWM input signal, and controls a motor based on that signal. The ESC accepts power from an external source, normally a battery pack.

ESCs can be controlled by the 1066, but the vast majority of ESCs on the market will destroy the 1066 if they are plugged in without modification. In a hobby RC system, the ESC is responsible for regulating some of the battery current down to ~5V, and supplying it to the radio receiver. An ESC designed to the power the receiver will advertise that it has a Battery Eliminator Circuit (BEC). When you plug an ESC into the 1066, the 1066 is acting as the radio receiver. The 1066 was not designed to be powered by the devices it controls, and the voltage regulator on the 1066 will self-destruct if a device tries to power it. If the center pin from the 3-wire servo connector between the 1066 and the ESC is disconnected, the BEC on the ESC will not be able to power the 1066, and the voltage regulator will not fail.

How the ESC inteprets the PWM signal and controls the motor is a function of the ESC. Higher end ESCs can be configured based on the application.

The hobby RC market has transitioned to Brushless DC Motors (BLDC). As you select an ESC, watch that the battery voltage input matches that of your system, and the type of motor controlled is what you have. Brushed DC and Brushless DC Motors are completely different, and require different controllers.

Wiring layout is critical with ESCs. The currents to the motor and on the ground return can be enormous. If these currents end up travelling back through USB cables, the system will not be stable. Some ESCs are optically isolated (OPTO) - a big advantage that reduces interference.

Synchronization of Multiple Servo Motors

Many applications call for several servo motors operating in unison - for example, operating a CNC table, or a robot arm. Highly precise synchronization of servos using the 1066 is not possible, as the sequencing will be affected by the real-time performance of your operating system. Each servo is controlled as a independent unit, so there is no way of arranging for a particular action to happen to all motors at the same time. Typical jitter can be 10-30mS.

Using the 1066 with High-Power Servos

You can still use the 1066 to power servos that are rated for a higher power, but you will need to provide an external power supply. Cut and reattach the red and black wires as shown in the diagram below.

Servopower.png

Make sure you disconnect the red wire from the 1066 as pictured, because reverse current from the external power supply could damage the servo controller board.


Servo Calibration

Each servo behaves slightly differently. The Phidgets API provides default calibration parameters that will work with many different models of servo motors; however these values are generic 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 effective. This is done as follows:

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

Servocalibrate1.png


Plug your servo in set the Minimum Pulse Width to ___ and the Maximum Pulse Width to the maximum pulse width limit described in the API for your device.

Set Position at Min and Position at Max to match the Min Pulse Width and Max Pulse Width, respectively. This will allow you to control the actual microsecond pulse width sent to the servo.

Servocalibrate2.png


Starting with the target position slider approximately in the 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 minimum pulse width 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 maximum pulse width 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. In either case, the difference between the positions will correspond to the difference between the Position at Min Pulse Width and the Position at Max Pulse Width.

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

To test your calibration parameters:

Type your new parameters into their respective boxes in the Motor Calibration box, and type Apply.

Next, set the Velocity slider to the rated velocity of the motor.

The program is now calibrated to the servo motor.

For example:

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

HITEC HS-322HD Parameters
Argument Value
Min Pulse Width 540
max_us 2370
degrees 180
velocity_max 316


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


        void servo_attach(object sender, AttachEventArgs e)
        {
            ...
            //Set the individual servo parameters
            servo.MinPulseWidth = 540;
            servo.MaxPulseWidth = 2370;
            servo.MinPosition = 0;
            servo.MaxPosition = 180;
            servo.VelocityLimit = 316;
            ...
        }


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.

What to do Next

  • Programming Languages - Find your preferred programming language here and learn how to write your own code with Phidgets!
  • Phidget Programming Basics - Once you have set up Phidgets to work with your programming environment, we recommend you read our page on to learn the fundamentals of programming with Phidgets.


Product History

Template:UGhist Template:UGrow2 Template:UGrow2 Template:UGrow2