PositionController
How to use the PositionController example
The DCC1002 gives you complete control of one brushed DC motor with a current rating of up to 4 amps. It offers a compact enclosed form making it easy to fit into smaller projects. This Phidget connects to your computer through a VINT Hub.
The board is designed with a number of safety features- polarity protection in case power is plugged in backwards, overcurrent protection in case of back-EMF spikes, and a settable Failsafe mode, which can turn off the controller if it loses communication with your program.
This Phidget is a smart device that must be controlled by a VINT Hub. For more information about VINT, have a look at the VINT Overview page. You can use a Phidget Cable to simply and easily connect the two devices. Here's a list of all of the different VINT Hubs currently available:
Product | Board Properties | |||
---|---|---|---|---|
Part Number | Price | Number of VINT Ports | VINT Communication Speed Max | Controlled By |
VINT Hub Phidget
|
$40.00 | 6 | 1 Mbit/s | USB (Mini-USB) |
1-Port VINT Hub Phidget
|
$24.00 | 1 | 1 Mbit/s | USB (USB-A) |
VINT Hub Phidget
|
$35.00 | 6 | 1 Mbit/s | USB (Mini-USB) |
VINT Hub Phidget
|
$30.00 | 6 | 100 kbit/s | USB (Mini-USB) |
Wireless VINT Hub
|
$60.00 | 6 | 100 kbit/s | Local Network (Ethernet or Wi-Fi) |
PhidgetSBC4
|
$120.00 | 6 | 100 kbit/s | — |
Use a Phidget cable to connect this device to the hub. You can solder multiple cables together in order to make even longer Phidget cables, but you should be aware of the effects of having long wires in your system.
Product | Physical Properties | |
---|---|---|
Part Number | Price | Cable Length |
Phidget Cable 10cm
|
$1.50 | 100 mm |
Phidget Cable 30cm
|
$1.75 | 300 mm |
Phidget Cable 60cm
|
$2.00 | 600 mm |
Phidget Cable 60cm
|
$2.00 | 600 mm |
Phidget Cable 90cm
|
$2.00 | 900 mm |
Phidget Cable 120cm
|
$2.25 | 1.2 m |
Phidget Cable 150cm
|
$2.50 | 1.5 m |
Phidget Cable 180cm
|
$2.75 | 1.8 m |
Phidget Cable 350cm
|
$3.00 | 3.5 m |
Phidget Cable Kit
|
$10.00 | 80 mm |
Using motor controllers with large motors can pose a risk for your power supply. If your supply does not have protective features built-in, you can use a Power Guard Phidget to prevent damage from power spikes from back EMF that is generated when motors brake or change direction. We recommend that you use the SAF2000 for any motor with a current rating between 1 and 5 amperes, and the SAF1000 for motors above 5A.
Product | Power Supply Protector | ||
---|---|---|---|
Part Number | Price | Trip Voltage | Continuous Current |
Power Guard Phidget 30V 5A
|
$10.00 | 37 | 5 A |
Programmable Power Guard Phidget 30V 50A
|
$40.00 | Selectable via software 8 - 33 VDC | 50 A |
We offer a wide variety of DC motors that can be used with this Phidget. Motors with higher gearbox ratios will have higher torque at the cost of lower speed. If you want a motor that has an encoder attached to it, skip ahead to the next table.
Product | Motor Properties | Physical Properties | Gearbox Specifications | ||||
---|---|---|---|---|---|---|---|
Part Number | Price | Rated Speed | Rated Torque | Shaft Diameter | Weight | Gear Ratio | Gearbox Type |
12V/0.2Kg-cm/1080RPM 3.7:1 DC Gear Motor
|
$18.00 | 1080 RPM | 240 g·cm | 6 mm | 144 g | 3 12⁄17 : 1 | Planetary |
12V/0.2Kg-cm/230RPM 10:1 DC Gear Motor
|
$10.00 | 230 RPM | 200 g·cm | 6 mm | 128 g | 10 : 1 | Spur |
12V/0.9Kg-cm/285RPM 14:1 DC Gear Motor
|
$18.00 | 285 RPM | 900 g·cm | 6 mm | 170 g | 13 212⁄289 : 1 | Planetary |
12V/0.3Kg-cm/127RPM 18:1 DC Gear Motor
|
$10.00 | 127 RPM | 310 g·cm | 6 mm | 133 g | 18 : 1 | Spur |
12V/0.8Kg-cm/46RPM 50:1 DC Gear Motor
|
$11.00 | 46 RPM | 820 g·cm | 6 mm | 137 g | 50 : 1 | Spur |
12V/3.0Kg-cm/78RPM 51:1 DC Gear Motor
|
$20.50 | 78 RPM | 3.1 kg·cm | 6 mm | 193 g | 50 801⁄895 : 1 | Planetary |
12V/1.6Kg-cm/23RPM 100:1 DC Gear Motor
|
$11.00 | 23 RPM | 1.6 kg·cm | 6 mm | 136 g | 100 : 1 | Spur |
12V/0.5Kg-cm/670RPM 3.7:1 DC Gear Motor
|
$38.00 | 670 RPM | 540 g·cm | 8 mm | 416 g | 3 12⁄17 : 1 | Planetary |
12V/1.9Kg-cm/175RPM 14:1 DC Gear Motor
|
$42.00 | 175 RPM | 1.9 kg·cm | 8 mm | 464 g | 13 212⁄289 : 1 | Planetary |
12V/6.6Kg-cm/49RPM 51:1 DC Gear Motor
|
$43.00 | 49 RPM | 6.6 kg·cm | 8 mm | 526 g | 50 801⁄895 : 1 | Planetary |
12V/6.6Kg-cm/49RPM 51:1 DC Gear Motor
|
$33.00 | 49 RPM | 6.6 kg·cm | 8 mm | 526 g | 50 801⁄895 : 1 | Planetary |
12V/17.3Kg-cm/18RPM 139:1 DC Gear Motor
|
$43.00 | 18 RPM | 17.3 kg·cm | 8 mm | 526 g | * 139 184⁄1221 : 1 | Planetary |
24V/2.5Kg-cm/3280RPM DC Motor
|
$40.00 | 3280 RPM | 4 kg·cm | 8 mm | 1.4 kg | — | — |
24V/4.3Kg-cm/3000RPM DC Motor
|
$50.00 | 2800 RPM | 8.7 kg·cm | 10 mm | 2.7 kg | — | — |
24V/6Kg-cm/3200RPM DC Motor
|
$60.00 | 2900 RPM | 11.4 kg·cm | 10 mm | 3.3 kg | — | — |
24V/5.1Kg-cm/588RPM 4.25:1 DC Gear Motor
|
$69.00 | 588 RPM | 4.4 kg·cm | 12 mm | 1.3 kg | 4 1⁄4 : 1 | Planetary |
24V/10Kg-cm/772RPM/4.25:1 DC Gear Motor
|
$80.00 | 772 RPM | 12.2 kg·cm | 12 mm | 1.9 kg | 4 1⁄4 : 1 | Planetary |
24V/14.2Kg-cm/192RPM 13:1 DC Gear Motor
|
$66.00 | 192 RPM | 13.3 kg·cm | 12 mm | 1.5 kg | 12 24⁄25 : 1 | Planetary |
24V/45Kg-cm/182RPM/18:1 DC Gear Motor
|
$82.00 | 182 RPM | 47 kg·cm | 12 mm | 2.1 kg | 18 : 1 | Planetary |
24V/50.9Kg-cm/53RPM 47:1 DC Gear Motor
|
$72.00 | 53 RPM | 43.8 kg·cm | 12 mm | 1.7 kg | 46 82⁄125 : 1 | Planetary |
24V/162Kg-cm/50RPM/65:1 DC Gear Motor
|
$84.00 | 50 RPM | 153 kg·cm | 12 mm | 2.2 kg | 65 : 1 | Planetary |
24V/82.6Kg-cm/33RPM 76:1 DC Gear Motor
|
$72.00 | 33 RPM | 71.4 kg·cm | 12 mm | 1.7 kg | 76 49⁄64 : 1 | Planetary |
24V/173.3Kg-cm/15RPM 168:1 DC Gear Motor
|
$76.00 | 15 RPM | 136.6 kg·cm | 12 mm | 2 kg | 167 601⁄625 : 1 | Planetary |
These DC motors all have encoders attached to the rear shaft, allowing for closed-loop position control of your motor. These encoders will connect to the encoder input on the DCC1002 via the cable included with each motor.
Product | Motor Properties | Physical Properties | Gearbox Specifications | ||||
---|---|---|---|---|---|---|---|
Part Number | Price | Rated Speed | Rated Torque | Shaft Diameter | Weight | Gear Ratio | Gearbox Type |
12V/0.2Kg-cm/1080RPM 3.7:1 DC Gear Motor w/ Encoder
|
$48.00 | 1080 RPM | 240 g·cm | 6 mm | 147 g | 3 12⁄17 : 1 | Planetary |
Linear actuators are simply DC motors that are hooked up to a linear screw which causes the shaft to move laterally instead of rotating. Unlike a rotary DC motor, linear actuators have a minimum and maximum position at which the shaft cannot contract or extend any further. On its own, the motor would not be smart enough to stop before attempting to push beyond these limits, possibly damaging the motor. That's why each linear actuator also has a built-in feedback potentiometer so you can monitor the position of the shaft and prevent the actuator from stalling out at its limits. The potentiometer can be read using one of the ports on your VINT Hub in VoltageRatioInput mode.
Product | Motor Properties | Electrical Properties | Physical Properties | |||||
---|---|---|---|---|---|---|---|---|
Part Number | Price | Stroke Length | Maximum Speed | Peak Power Point | Peak Efficiency Point | Gear Ratio | Rated Voltage | Weight |
DC Linear Actuator - 30mm - 18N
|
$40.00 | 30 mm | 50 mm/s | 18 N | — | — | 12 V DC | 63.6 g |
DC Linear Actuator - 30mm - 60N
|
$40.00 | 30 mm | 15 mm/s | 60 N | — | — | 12 V DC | 69.9 g |
DC Linear Actuator - 50mm - 50N
|
$80.00 | 50 mm | 32 mm/s | (@ 16 mm/s) 50 N | (@ 24 mm/s) 24 N | 35 : 1 | 12 V DC | 56 g |
DC Linear Actuator - 50mm - 75N
|
$80.00 | 50 mm | 20 mm/s | (@ 10 mm/s) 75 N | (@ 15 mm/s) 38 N | 63 : 1 | 12 V DC | 56 g |
DC Linear Actuator - 50mm - 175N
|
$80.00 | 50 mm | 8 mm/s | (@ 4 mm/s) 175 N | (@ 7 mm/s) 75 N | 150 : 1 | 12 V DC | 56 g |
DC Linear Actuator - 100mm - 18N
|
$40.00 | 100 mm | 50 mm/s | 18 N | — | — | 12 V DC | 94.3 g |
DC Linear Actuator - 100mm - 50N
|
$80.00 | 100 mm | 32 mm/s | (@ 16 mm/s) 50 N | (@ 24 mm/s) 24 N | 35 : 1 | 12 V DC | 74 g |
DC Linear Actuator - 100mm - 60N
|
$40.00 | 100 mm | 15 mm/s | 60 N | — | — | 12 V DC | 93.9 g |
DC Linear Actuator - 100mm - 75N
|
$80.00 | 100 mm | 20 mm/s | (@ 10 mm/s) 75 N | (@ 15 mm/s) 38 N | 63 : 1 | 12 V DC | 74 g |
DC Linear Actuator - 100mm - 175N
|
$80.00 | 100 mm | 8 mm/s | (@ 4 mm/s) 175 N | (@ 7 mm/s) 75 N | 150 : 1 | 12 V DC | 74 g |
DC Linear Actuator - 140mm - 50N
|
$80.00 | 140 mm | 32 mm/s | (@ 16 mm/s) 50 N | (@ 24 mm/s) 24 N | 35 : 1 | 12 V DC | 84 g |
DC Linear Actuator - 140mm - 75N
|
$80.00 | 140 mm | 20 mm/s | (@ 10 mm/s) 75 N | (@ 15 mm/s) 38 N | 63 : 1 | 12 V DC | 84 g |
DC Linear Actuator - 140mm - 175N
|
$80.00 | 140 mm | 8 mm/s | (@ 4 mm/s) 175 N | (@ 7 mm/s) 75 N | 150 : 1 | 12 V DC | 84 g |
This Phidget requires a power supply between 8 and 30V DC. We recommend that you use a 12V DC power supply for smaller motors and a 24V supply for larger motors. Check your motor's specifications if you're not sure. For best performance, you should get a 5 amp supply. Select the power supply from the list below that matches your region's wall socket type.
Product | Electrical Properties | Physical Properties | ||
---|---|---|---|---|
Part Number | Price | Power Supply Current | Output Voltage | Wall Plug Style |
Power Supply 24VDC 14.6A
|
$40.00 | 14.6 A | 24 V | — |
Power Supply 24VDC 25A Current Limiting
|
$120.00 | 25 A | 24 V | — |
Power Supply DIN Mount 24VDC 1A
|
$20.00 | 1 A | 24 V | — |
Power Supply 12VDC 0.5A - EU
|
$1.50 | 500 mA | 12 V | European |
Power Supply 12VDC 0.5A - US
|
$1.50 | 500 mA | 12 V | North American |
Power Supply 12VDC 2.0A - AU
|
$10.00 | 2 A | 12 V | Australian |
Power Supply 12VDC 2.0A - EU
|
$10.00 | 2 A | 12 V | European |
Power Supply 12VDC 2.0A - UK
|
$10.00 | 2 A | 12 V | British |
Power Supply 12VDC 5A
|
$20.00 | 5 A | 12 V | — |
Power Supply 24VDC 1.0A - US
|
$10.00 | 1 A | 24 V | North American |
Power Supply 24VDC 2.5A
|
$20.00 | 2.5 A | 24 V | — |
Power Supply 24VDC 5A
|
$40.00 | 5 A | 24 V | — |
Power Supply-12VDC 2.0A - US
|
$10.00 | 2 A | 12 V | North American |
You can use a pigtail wire if you want to avoid removing the barrel jack connector from your supply's cord:
Product | Physical Properties | ||||
---|---|---|---|---|---|
Part Number | Price | Connector A | Connector B | Cable Length | Cable Gauge |
Female Pigtail 5.5x2.1mm
|
$2.75 | Power Jack 5.5 x 2.1mm (Female) | 2 Loose Wires | 250 mm | 20 AWG |
Control a brushed DC motor with a current rating of up to 4A with the DCC1002. With this Phidget, you can:
You can use your Control Panel to explore your Phidget's channels.
1. Open your Control Panel, and you will find the following channels:
2. Double click on a channel to open an example program. Each channel belongs to a different channel class:
In your Control Panel, double click on "DC Motor Controller":
In your Control Panel, double click on "Encoder Input":
In your Control Panel, double click on "Position Controller":
Before you open a Phidget channel in your program, you can set these properties to specify which channel to open. You can find this information through the Control Panel.
1. Open the Control Panel and double-click on the red map pin icon:
2. The Addressing Information window will open. Here you will find all the information you need to address your Phidget in your program.
See the Phidget22 API for your language to determine exact syntax for each property.
The Change Trigger is the minimum change in the sensor data needed to trigger a new data event.
The Data Interval is the time (in ms) between data events sent out from your Phidget.
The Data Rate is the reciprocal of Data Interval (measured in Hz), and setting it will set the reciprocal value for Data Interval and vice-versa.
You can modify one or both of these values to achieve different data outputs. You can learn more about these properties here.
Firmware Upgrade
MacOS users can upgrade device firmware by double-clicking the device row in the Phidget Control Panel.
Linux users can upgrade via the phidget22admin tool (see included readme for instructions).
Windows users can upgrade the firmware for this device using the Phidget Control Panel as shown below.
Firmware Downgrade
Firmware upgrades include important bug fixes and performance improvements, but there are some situations where you may want to revert to an old version of the firmware (for instance, when an application you're using is compiled using an older version of phidget22 that doesn't recognize the new firmware).
MacOS and Linux users can downgrade using the phidget22admin tool in the terminal (see included readme for instructions).
Windows users can downgrade directly from the Phidget Control Panel if they have driver version 1.9.20220112 or newer:
Firmware Version Numbering Schema
Phidgets device firmware is represented by a 3-digit number. For firmware patch notes, see the device history section on the Specifications tab on your device's product page.
There are a number of settings that can be adjusted to customize the position controller. You can save these variables into the program so you don't have to re-enter them manually (NOTE: This does not store the settings on the DCC1002, it simply saves them inside the control panel program, so you'll have to re-enter them if it's used on another computer).
You can set the control parameters Kp, Ki, and Kd in order to change the behavior of the control loop. For more information on how each of these three tuning parameters affect the control loop, see “Control Loop Parameters ”.
Velocity is how fast the motor will move to the target position, and acceleration controls how quickly the motor will reach its velocity and how quickly it will slow down. These values are measured in position per second and position per second squared, and position by default is measured in encoder pulses.
If you want position to be measured in another unit (degrees, for example), you can set the rescale factor. For more information on choosing the correct rescale factor, see “Setting the Rescale Factor”.
Sometimes the motor will oscillate back and forth across the target position when holding position. Adding a deadband will widen the target position so the motor will stop when it gets within the target position plus or minus the deadband.
Setting the current limit gives you control over how much power is being supplied to the motor. Generally, we advise that you set the current limit to your motor’s specified coil current.
This turns the cooling fan on and off. Setting it to auto will result in the fan turning on only when the temperature sensor detects rising board temperatures.
Changes between different encoder modes based on your encoder’s circuitry. For more information see the Encoder Primer.
Depending on power supply voltage and motor coil inductance, the current through the motor can change relatively slowly or extremely rapidly. A physically larger DC Motor will typically have a lower inductance, requiring a higher current regulator gain. A higher power supply voltage will result in motor current changing more rapidly, requiring a higher current regulator gain. If the current regulator gain is too small, spikes in current will occur, causing large variations in torque, and possibly damaging the motor controller. If the current regulator gain is too high, the current will jitter, causing the motor to sound 'rough', especially when changing directions.
In order to get the desired behavior from your controller, you will have to tune your control parameters. This video explains the tuning procedure and gives information on how the controller works.
The DCC1002 can connect to any of the encoders we sell without any modification just by setting the EncoderIOMode property to Push-Pull . If you're trying to use your own encoder, you may need to change the IO mode to Open Collector or Line Driver mode. Have a look at the Encoder Primer for more details on what to use.
There are three pieces of information to consider when setting a rescale factor to change your units into degrees or rotations:
First, check your encoder's datasheet for the CPR. It's usually 360 or 300. This is the number of quadrature cycles the encoder will send out for one full rotation.
Next, you need your encoder interface's resolution. The encoder port on the DCC1002 has a x4 resolution, meaning it reads in 4 pulses per quadrature cycle (see the Encoder Primer for a more in-depth explanation).
Next, you need to find out the gear ratio in your motor's datasheet. Note: If you plan on having your motor run for many rotations in a row, try to find the exact gear ratio, expressed as a fraction. Using the rounded value will result in accumulating errors the more you rotate.
Once you have these numbers, you can calculate the rescale factor:
For example, if you wanted to have your motor's position measured in degrees and your encoder had 300 CPR and your motor had a 50 801⁄895 : 1 gearbox, you would set your rescale factor to 360 / 300*4*(50+(801/895)), or 0.005894.
Reverse your motor’s wires. The control loop has to make an assumption about what direction your motor moves with a positive voltage, and in this case, the assumption was incorrect. Don’t worry, DC motors are fine being wired up backward since they’re essentially just a long loop of wire on the inside.
Board Properties | |
---|---|
Controlled By | VINT |
VINT Communication Speed Max | 10 kbit/s |
Controller Properties | |
Motor Type | DC Motor |
Number of Motor Ports | 1 |
Acceleration Min | 0.1 Duty Cycle/s |
Acceleration Max | 100 Duty Cycle/s |
PWM Frequency | 25 kHz |
Sampling Interval Min | 100 ms/sample |
Sampling Interval Max | 60 s/sample |
Acceleration Resolution | 0.1 Duty Cycle/s |
Velocity Resolution | 0.001 Duty Cycle |
Current Limit Resolution | 5.6 mA |
Acceleration Time Min | 20 ms |
Acceleration Time Max | 20 s |
Electrical Properties | |
Continuous Motor Current Max | 4 A |
Supply Voltage Min | 8 V DC |
Supply Voltage Max | 30 V DC |
Current Consumption (Unconfigured) | (VINT Port) 500 μA |
Current Consumption Max | (VINT Port) 2 mA |
Power Consumption (Unconfigured) | 288 mW |
Power Consumption | motor power plus 700 mW |
Replacement Fuse | 5A Slow Blow Blade Type, Standard or Micro |
Isolation Voltage (DC) | 5 kV DC |
Encoder Interface | |
Number of Encoder Inputs | 1 |
Encoder Interface Resolution | x4 |
Count Rate Max | 400000 pulses/s |
Sampling Interval Min | 50 ms/sample |
Sampling Interval Max | 60 s/sample |
Encoder Input Low Voltage Max | 2.4 V DC |
Encoder Input High Voltage Min | 2.6 V DC |
Time Resolution | 1 μs |
Physical Properties | |
Recommended Wire Size | 16 - 26 AWG |
Operating Temperature Min | -40 °C |
Operating Temperature Max | 85 °C |
Customs Information | |
Canadian HS Export Code | 8471.80.00 |
American HTS Import Code | 8471.80.40.00 |
Country of Origin | CN (China) |
Date | Board Revision | Device Version | Comment |
---|---|---|---|
May 2019 | 0 | 102 | Product Release |
May 2019 | 0 | 110 | Added failsafe timer functionality |
May 2019 | 0 | 111 | Fixed max current limit for position controller to be 4A |
December 2021 | 0 | 112 | Fixed bug where MotorPositionController wasn't properly resetting |
December 2021 | 0 | 113 | Position Control math now uses double instead of float |
December 2021 | 0 | 120 | Improved failsafe timer to reset with any successful packet |
Channel Name | API | Channel |
---|---|---|
DC Motor Controller | DCMotor | 0 |
Encoder Input | Encoder | 0 |
Position Controller | MotorPositionController | 0 |
API | Detail | Language | OS | |
---|---|---|---|---|
DCMotor | Visual Studio GUI | C# | Windows | Download |
DCMotor | JavaScript | Browser | Download | |
DCMotor | Objective-C | macOS | Download | |
DCMotor | Swift | macOS | Download | |
DCMotor | Swift | iOS | Download | |
DCMotor | Visual Basic .NET | Windows | Download | |
DCMotor | Max/MSP | Multiple | Download | |
Encoder | Visual Studio GUI | C# | Windows | Download |
Encoder | JavaScript | Browser | Download | |
Encoder | Objective-C | macOS | Download | |
Encoder | Swift | macOS | Download | |
Encoder | Swift | iOS | Download | |
Encoder | Visual Basic .NET | Windows | Download | |
Encoder | Max/MSP | Multiple | Download | |
MotorPositionController | PID Tuner | C# | Windows | Download |
MotorPositionController | JavaScript | Browser | Download | |
MotorPositionController | Objective-C | macOS | Download | |
MotorPositionController | Swift | macOS | Download | |
MotorPositionController | Swift | iOS | Download | |
MotorPositionController | Visual Basic .NET | Windows | Download | |
MotorPositionController | Max/MSP | Multiple | Download |
Product | Controller Properties | Electrical Properties | Board Properties | |||
---|---|---|---|---|---|---|
Part Number | Price | Number of Motor Ports | Velocity Resolution | Acceleration Resolution | Continuous Motor Current Max | Controlled By |
2x DC Motor Phidget
|
$60.00 | 2 | 0.001 Duty Cycle | 0.1 Duty Cycle/s | (per motor) 4 A | VINT |
4A DC Motor Phidget
|
$40.00 | 1 | 0.001 Duty Cycle | 0.1 Duty Cycle/s | 4 A | VINT |
DC Motor Phidget
|
$75.00 | 1 | 0.001 Duty Cycle | 1 Duty Cycle/s | 25 A | VINT |
PhidgetMotorControl 1-Motor
|
$75.00 | 1 | 0.39 Duty Cycle | 24.5 Duty Cycle/s | 5 A | USB (Mini-USB) |
PhidgetMotorControl HC
|
$115.00 | 2 | 0.79 Duty Cycle | 1.9 Duty Cycle/s | (per motor) 14 A | USB (Mini-USB) |