Source: http://manualzilla.com/doc/5634043/pololu-jrk-usb-motor-controller-user-s-guide
Timestamp: 2019-04-23 11:13:44+00:00

Document:
1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.a. Module Pinout and Components . . . . . . . . . . . . .
1.b. Supported Operating Systems . . . . . . . . . . . . . . .
1.c. PID Calculation Overview . . . . . . . . . . . . . . . .
2. Contacting Pololu . . . . . . . . . . . . . . . . . . . . . . . . .
3. Configuring the Motor Controller . . . . . . . . . . . . . . . .
3.b. Input Options . . . . . . . . . . . . . . . . . . . . . . .
3.c. Feedback Options . . . . . . . . . . . . . . . . . . . . .
3.d. PID Options . . . . . . . . . . . . . . . . . . . . . . . .
3.e. Motor Options . . . . . . . . . . . . . . . . . . . . . . .
3.f. Error Response Options . . . . . . . . . . . . . . . . . .
3.g. The Plots Window . . . . . . . . . . . . . . . . . . . . .
3.h. Upgrading Firmware . . . . . . . . . . . . . . . . . . .
4. Using the Serial Interface . . . . . . . . . . . . . . . . . . . . .
4.a. Serial Modes . . . . . . . . . . . . . . . . . . . . . . . .
4.b. TTL Serial . . . . . . . . . . . . . . . . . . . . . . . . .
4.c. Command Protocols . . . . . . . . . . . . . . . . . . . .
4.d. Cyclic Redundancy Check (CRC) Error Detection . . . .
4.e. Motor Control Commands . . . . . . . . . . . . . . . .
4.f. Error Reporting Commands . . . . . . . . . . . . . . . .
4.g. Variable Reading Commands . . . . . . . . . . . . . . .
4.h. Daisy-Chaining . . . . . . . . . . . . . . . . . . . . . .
4.i. Serial Example Code . . . . . . . . . . . . . . . . . . .
4.i.1. Cross-platform C . . . . . . . . . . . . . . . . .
4.i.2. Windows C . . . . . . . . . . . . . . . . . . . .
5. Setting Up Your System . . . . . . . . . . . . . . . . . . . . .
6. Writing PC Software to Control the Jrk . . . . . . . . . . . . .
controllers supports a variety of interfaces, including USB.
• 5 V to 28 V operating supply range.
• 3 A maximum continuous current output (5 A peak).
• 6 V to 16 V operating supply range.
• Simple bidirectional control of one DC brush motor.
◦ USB interface for direct connection to a PC.
◦ 0–5 V analog voltage interface for direct connection to potentiometers and analog joysticks.
◦ 0–5 V analog voltage.
◦ Frequency/tachometer digital input up to 2 MHz with 1 ms PID period.
◦ PID period and PID constants (feedback tuning parameters).
◦ Input calibration (learning) for analog and RC control.
• Optional CRC error detection eliminates communication errors caused by noise or software faults.
• Optional feedback potentiometer disconnect detection.
smaller pieces, such as an 8×1 piece and two 3×1 pieces, and solder these strips into the jrk’s I/O pads.
this device to a computer.
Pololu jrk 21v3 USB motor controller with feedback, labeled top view.
Pololu jrk 12v12 USB motor controller with feedback, labeled top view.
send and receive TTL serial bytes on the TX and RX lines.
all of its functions except for driving the motor.
supply a continuous 3 A with peaks up to 5 A.
with peaks up to 30 A.
off linearly from 50 mA at 12 V to zero at 30 V.
the configuration utility is running and connected to the jrk, the green LED will flicker constantly.
error, ERR will be driven high, and otherwise it will be pulled low through the LED.
is flashing quickly (16 times per second), then the motor is on and the motor has not reached its desired state.
about the jrk’s serial interface, see Section 4.
more information on control input signals.
used as a measurement of the output of the system. Please see Section 3.c for more information on feedback signals.
suspend mode), the pin is tri-stated and pulled low through a resistor.
drive AUX low for about 150 μs each PID period to check if the feedback and/or analog inputs are disconnected.
necessary for typical applications. The line is internally pulled high, so it is safe to leave this pin unconnected.
but after that it can be controlled from a Linux or Mac computer.
USB interface (see Section 6).
for Mac OS X is limited.
quantities computed by the jrk.
scaling parameters to determine the target, also a value from 0 to 4095 (see Section 3.b).
1. The error is computed as the difference of scaled feedback and target (error = scaled feedback − target).
constants of proportionality are the most important parameters determining the behavior of the control system.
The result of the PID algorithm is a number from -600 to +600 called the duty cycle target.
the reverse direction, and a value of 0 corresponds to 0% duty cycle or off.
motors from being driven, but all measurements and calculations continue to occur normally.
Controller page [http://www.pololu.com/product/1393] for additional information.
anything else you would like to say!
the jrk. See below for details.
jrk drivers on your computer.
7, and Vista) or “Continue Anyway” (Windows XP).
controller, as well as see real-time information about its state.
drivers when you connect a jrk. No further action from you is required.
Windows XP users: Follow steps 5-9 for each new jrk you connect to your computer.
times. Each time the “Found New Hardware Wizard” pops up, follow steps 6-9.
6. When the “Found New Hardware Wizard” is displayed, select “No, not this time” and click “Next”.
stop the installation. Click “Continue Anyway”.
pop up. You will see a total of three wizards when plugging in the jrk. Follow steps 6-9 for each wizard.
utility will work even if the serial port drivers are not installed properly.
entry for the Pololu jrk motor controller.
• Serial indicates that the jrk gets its target setting over a serial interface, either a virtual COM port or the TTLlevel serial port of the jrk, as explained in detail in Section 4.
correponds to an input value of 4092.
be between 2 and 5 V.
which gives you better control near the neutral point.
“Asymmetric” to automatically center the neutral values between minimum and maximum.
more time than the specified PID period.
as expected, the Input disconnect error will occur.
(a Timeout of 0.00 disables the serial timeout feature).
directly with the scrollbar or numerical input.
calculations once per “PID period”.
of 5 V corresponds to a feedback value of 4092.
allows for a maximum frequency of approximately 2 MHz with a PID period of 1 ms.
option if the direction of motion that you would like to call positive actually results in a decreasing feedback value.
respond as expected the Feedback disconnect error will occur.
PID constants might need to be adjusted whenever the PID period is changed.
small effect on the duty cycle.
is 300, the integral will reset whenever the error is larger than 20.
the error exceeds twice this value.
signal applied to the motor, including all limits that are applied when converting duty cycle target to duty cycle.
= VIN and B = 0 V.
to set up low maximum duty cycles and currents, and set the Motor drive error, Feedback disconnect, and Max.
this test will cause the jrk to turn off the motor.
audible PWM-induced motor humming, which makes this frequency desirable for typical applications.
frequency a better choice for certain applications.
cycle greater than 98% will be the same as a duty cycle of 100%.
Max. duty cycle limits the duty cycle itself.
period is limited to be within -10 to 310.
reverse, and the “reverse” setting refers to switching from reverse to forward.
limit. The Feedback disconnect error should be disabled when this option is used.
state of the motor driver: brake (A and B both connected to GND) and coast (A and B floating).
The jrk 21v3 PWMs the motor outputs between driving and braking, and a duty cycle of zero is the same as braking.
The jrk 12v12 PWMs the motor outputs between driving and coasting when the duty cycle is non-zero.
brake the motor in one direction but let it coast in the other direction.
The jrk’s response to the different errors can be configured. Each error has up to three different available settings.
Command error bit. The jrk will not drive the motor again until it receives one of the serial set target commands.
The motor can also be restarted from the configuration utility.
corner of the main window. All of the variables discussed in Section 1.c are available.
on the left. The time scale of the plot can be shortened using the Time (s) setting at the bottom of the window.
Each variable can be independently shown or hidden using the checkbox next to the variable’s name.
The jrk has field-upgradeable firmware that can be easily updated with bug fixes or new features.
after August 24, 2012 ship with firmware version 1.4.
firmware onto a jrk 21v3, or vice-versa.
settings will be reset to default values during the firmware upgrade.
umc01a_v1.3.pgm?file_id=0J223] (35k pgm) — released 2009-08-25.
(34k pgm) — released 2012-08-15.
3. Connect your jrk to a computer running Windows using a USB cable.
will have to use the “Connected to” dropdown box to select which jrk you want to connect to.
“Pololu umc01a Bootloader” or “Pololu umc02a Bootloader”.
◦ Windows 8, Windows 7, and Vista: the driver for the bootloader will automatically be installed.
◦ Windows XP: follow steps 6-8 from Section 3.a to get the driver working.
“Browse…” button and select the firmware file you downloaded.
Device Manager and look in the “Ports (COM & LPT)” section.
erased and asking you if you are sure you want to proceed: click Yes.
the jrk during the upgrade.
now indicates the latest version of the firmware.
If you run into problems during a firmware upgrade, please contact us [http://www.pololu.com/contact] for assistance.
The jrk has three different serial interfaces. First, it has the RX and TX lines. The jrk can send bytes on the TX line.
COM port numbers of these ports by looking in your computer’s Device Manager. See Section 3.a for information.
The USB Dual Port serial mode.
purpose serial port that can communicate with other types of TTL serial devices.
The USB Chained serial mode.
computer to control multiple jrks, or a jrk and other devices that have a compatible protocol.
microcontroller or other TTL serial device.
jrk is in (Section 4.a). The voltage on the RX pin should not go below 0 V and should not exceed 5 V.
receiving TTL serial bytes from the jrk, you can leave the TX line disconnected.
bits. Asynchronous TTL serial is available as hardware modules called “UARTs” on many microcontrollers.
Asynchronous serial output can also be “bit-banged” by a standard digital output line under software control.
realizable data rate, with a start bit coming immediately after the preceding byte’s stop bit, is 11,520 bytes per second.
You can control the jrk by issuing serial commands.
0xAA (170 in decimal) on the RX line (so it can detect the baud rate) before sending it any commands.
only transmit seven bits of information.
The byte 0xE1 is the Set Target Low Resolution Forward command, and the data byte contains the motor speed.
there is not a one-to-one correspondence between command bytes and commands.
using this protocol, send commands specifically to the desired jrk without confusing the other devices on the line.
Note that 0x61 is the command 0xE1 with its most significant bit cleared.
parameter to identify which protocol you are using.
For certain applications, verifying the integrity of the data you are sending and receiving can be very important.
as it can detect errors that would not affect a checksum, such as an extra zero byte or bytes out of order.
byte to the data it transmits in response to serial commands.
motor controller but differs from that on the TReX [http://www.pololu.com/product/777] motor controller.
10001001 to carry out the computation below.
2. Add 7 zeros to the end of your message.
the LSB of your message.
the LSB of your CRC-7 is aligned under a 0, do nothing.
talking to the jrk with CRC enabled).
byte represent the upper 7 bits of the target.
serialBytes = 0xC0 + (target & 0x1F); // Command byte holds the lower 5 bits of target.
// Data byte holds the upper 7 bits of target.
byte followed by a data byte (0–127) will result in setting the target to a value of 32 multiplied by the data byte.
or greater which is determined by the magnitude (0–127).
Target = 2048 + 16×magnitude.
Target = 2048 + (600/127)×magnitude.
zero will make the motor stop.
error bit will be set, so the jrk will turn the motor off until another Set Target command is received.
value less than 2048 which is determined by the magnitude (0–127).
Target = 2048 − 16×magnitude.
Target = 2048 − (600/127)×magnitude.
This means that a magnitude of 127 will set the duty cycle target to full-speed reverse (-600).
when the Jrk is powered on.
so it can not drive the motor. If this error occurs, check your power supply and power connections.
that motor output A is shorted to ground or VIN.
In Pulse Width Input Mode, the jrk will only update the input value if it has received four good pulses in a row.
in Analog Input Mode or Serial Input Mode.
and generates this error if it finds that it is (Section 3.b).
generates this error if it finds that it is (Section 3.c).
you are communicating at a baud rate that differs from the jrk’s baud rate.
from RX has been lost as a result. This error should not occur during normal operation.
the end of the command packet does not match what the jrk has computed as that packet’s CRC (Section 4.d).
In such a case, the jrk ignores the command packet and generates a CRC error.
another command packet, this error occurs.
the event that serial communication between the jrk and its controller is disrupted.
These bits do not represent any errors; they will always read as zeroes.
not report any errors that have been disabled in the configuration utility, because those errors do not stop the motor.
utility, and then clicking the “Clear Errors” button.
the ERR line high, and this command can be used to determine the cause of the error.
from your microcontroller, or from the jrk’s virtual Command Port.
complement system is used (a response of 0xFE, 0xFF means -2).
• Low byte: These commands will result in a one-byte serial response from the jrk containing just the leastsignificant byte of the variable.
• High byte: These commands will result in a one-byte serial response from the jrk containing just the mostsignificant byte of the variable.
The command bytes are listed in the table below.
and 4092 is 5 V. In pulse width input mode, the input is the duration of the last pulse measured, in units of 2/3 μs.
See Section 3.b for more information.
pin, where 0 is 0 V and 4092 is 5 V. In no feedback mode (speed control mode), the feedback is always zero.
of the Feedback tab in the configuration utility.
enabled. See Section 3.e for more information about current measurement and calibration.
• Error sum (integral): Every PID period, the error (scaled feedback minus target) is added to the error sum.
integral limit that the integral can not exceed.
the duty cycle target is the sum of the proportional, integral, and derivative terms of the PID algorithm.
acceleration, maximum duty cycle, maximum current, and also brake duration (Section 3.e).
• PID period count: This is the number of PID periods that have elapsed. It resets to 0 after reaching 65535.
The duration of the PID period can be configured (Section 3.d).
generate a serial protocol error. These commands are not useful, but they are not harmful.
by Pololu Protocol serial commands. For the jrk, this can be done in the Input tab of the configuration utility.
your application or easiest to implement in your programming language.
not required, though an RX-only Comand Port is available on the PC for debugging or other purposes.
will then be received by all slaves.
slave device to the RX line of the jrk.
necessary, and the TX lines can be left unconnected.
devices to be individually addressed, and it allows responses to be sent without collisions.
devices can automatically detect the baud from the initial 0xAA byte.
0xAA, and jrks will ignore command packets that start with 0x80.
also need to modify the line that specifies the name of the COM port device.
compiler. For Windows-specific example code that works with either compiler, see Section 4.i.2.
Uses POSIX functions to send and receive data from a jrk.
NOTE: The jrk's input mode must be "Serial".
NOTE: The jrk's serial mode must be set to "USB Dual Port".
NOTE: You must change the 'const char * device' line below.
// Reads a variable from the jrk.
// the jrk user's guide.
// Gets the value of the jrk's Feedback variable (0-4095).
// Gets the value of the jrk's Target variable (0-4095).
// Sets the jrk's Target variable (0-4095).
// Open the Jrk's virtual COM port.
the comments in the source code for more details.
1. Connect your jrk to a PC with a USB cable and launch the configuration utility. The red LED should be on.
2. Select the “Reset to default settings…” option from the File menu to load a safe set of settings.
3. With your power supply off, make the power connections to VIN and GND.
AUX pin to power it, and enable Detect disconnect with AUX in the Feedback tab.
the Error tab to Enabled and latched. This should stop your system in case of any major problem.
6. Click “Apply settings to device”.
8. On the Error tab, click “Clear Errors” to remove the errors caused by turning off the power.
but that no target has been set. If the red LED is on, examine the Errors tab to determine the source of the problem.
1. Select the correct value for Feedback mode.
positions, so that readings of the feedback sensor can be determined at each extreme.
4. Click “Apply settings to device”.
5. Move the system to the middle of its range.
1. Set Max. duty cycle to a safe value, like 200.
power to do any damage if something goes wrong.
3. Set other limits as necessary.
power supply if anything goes wrong and the limits and errors set previously fail to stop the motor.
voltage at A causes the motor to drive forward.
system that does not destroy itself when run without feedback.
2. On the Error tab, click “Clear Errors” to remove the errors caused by turning off the power.
feedback sensor, then Invert motor direction will be checked.
4. Click “Apply settings to device” to apply any changes.
2. Click “Apply settings to device”.
3. Use the slider on the Input tab to send various input values to your jrk, and see how it behaves.
later, moves the motor just a bit, reducing the error to ±1.
the integral term would have continued to build up, but at a slower rate, after the first adjustment.
the error is close to zero.
get the behavior that you need.
There are two ways to write PC software to control the jrk: the native USB interface and the virtual serial port.
and it can work with existing software programs that use serial ports, such as LabView.
from the jrk and automatically recover from disconnection.
in case you want to make your own graphs or do something special with the data.
• C# .NET class libraries that enable native USB communication with the jrk.
applications in any language that control the jrk over USB.
either “USB Dual Port” or “USB Chained”.

References: V.

 V.

 V.

 V.

 V. 
 V.