Pololu Jrk G2 21v3, Jrk G2 Series, Jrk G2 18v19, Jrk G2 24v21, Jrk G2 24v13 User Manual

...
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation
Jrk G2 Motor Controller User’s
Guide
https://www.pololu.com/docs/0J73/all Page 1 of 199
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation
1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1. Supported operating systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2. Comparison to the original Jrk controllers . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2. Contacting Pololu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3. Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.2. Installing Linux software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.3. Installing macOS software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4. Basic setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.1. Choosing the motor, power supply, and Jrk . . . . . . . . . . . . . . . . . . . . . . . . 19
4.2. Connecting the motor and power supply . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.3. Configuring and testing the motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5. Setting up the feedback method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
5.1. Setting up open-loop control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
5.2. Setting up analog feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
5.3. Setting up frequency feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
6. Setting up the control method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
6.1. Setting up USB control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
6.2. Setting up serial control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
6.3. Setting up I²C control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
6.4. Setting up analog control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
6.5. Setting up RC control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
7. Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
7.1. LED feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
7.2. Graph window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
7.3. Analog/RC input handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
7.4. Analog/frequency feedback handling . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
7.5. PID calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
7.6. Motor settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
7.7. Error handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
7.8. Logic power output (5V) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
7.9. Upgrading firmware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
8. Pinout and components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
9. Setting reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
10. Variable reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
11. Command reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
12. Serial command encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
13. I²C command encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
14. USB command encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
15. Writing PC software to control the Jrk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Page 2 of 199
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation
15.1. Example code to run jrk2cmd in C . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
15.2. Example code to run jrk2cmd in Ruby . . . . . . . . . . . . . . . . . . . . . . . . . 179
15.3. Example code to run jrk2cmd in Python . . . . . . . . . . . . . . . . . . . . . . . . 180
15.4. Running jrk2cmd with Windows shortcuts . . . . . . . . . . . . . . . . . . . . . . . 182
15.5. Example serial code for Linux and macOS in C . . . . . . . . . . . . . . . . . . . . 184
15.6. Example serial code for Windows in C . . . . . . . . . . . . . . . . . . . . . . . . . 189
15.7. Example serial code in Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
15.8. Example I²C code for Linux in C . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
15.9. Example I²C code for Linux in Python . . . . . . . . . . . . . . . . . . . . . . . . . 197
Page 3 of 199
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation

1. Overview

The second-generation Jrk G2 motor controllers are designed to enable easy closed-loop speed
control or position control (but not both!) of a single brushed DC motor. They feature integrated support
for analog voltage or tachometer (frequency) feedback and a variety of control interfaces–USB for
direct connection to a computer, TTL serial and I²C for use with a microcontroller, RC hobby servo
pulses for use in an RC system, and analog voltages for use with a potentiometer or analog joystick.
A free configuration utility simplifies initial setup of the device, provides access to a wide array of
configurable settings, and allows for in-system testing and monitoring of the controller via USB.
Side-by-side comparison of the different Jrk G2 USB Motor Controllers with Feedback.
The table below lists the members of the Jrk G2 family and shows the key differences among them.
Jrk G2
21v3
Minimum operating voltage:
Recommended max operating voltage:
Max nominal battery voltage:
Max continuous current (no additional cooling):
Dimensions: 1.0″ × 1.2″ 1.4″ × 1.2″ 1.7″ × 1.2″
1 The 5V logic voltage drops when powered from a supply below about 5.2 V. 2 Transient operation (< 500 ms) up to 40 V. 3 30 V absolute max. 4 40 V absolute max.
(1)
4.5 V
(2)
28 V
24 V 18 V 28 V 18 V 28 V
2.6 A 19 A 13 A 27 A 21 A
Jrk G2 18v19
6.5 V 6.5 V 6.5 V 6.5 V
(3)
24 V
Jrk G2 24v13
(4)
34 V
Jrk G2 18v27
(3)
24 V
Jrk G2 24v21
34 V
(4)
1. Overview Page 4 of 199
• Easy open-loop or closed-loop control of one brushed DC motor
• A variety of control interfaces:
USB for direct connection to a computer
TTL serial operating at 5 V for use with a microcontroller
I²C for use with a microcontroller
RC hobby servo pulses for use in an RC system
Analog voltage for use with a potentiometer or analog joystick
• Feedback options:
Analog voltage (0 V to 5 V), for making a closed-loop servo system
Frequency, for closed-loop speed control using pulse counting (for higher-
frequency feedback) or pulse timing (for lower-frequency feedback)
None, for open-loop speed control
Note: the Jrk does not support using quadrature encoders for position control
• Ultrasonic 20 kHz PWM for quieter operation (can be configured to use 5 kHz instead)
• Simple configuration and calibration over USB with free configuration software utility (for
Windows, Linux, and macOS)
• Configurable parameters include:
◦ PID period and PID coefficients (feedback tuning parameters)
◦ Maximum current
◦ Maximum duty cycle
◦ Maximum acceleration and deceleration
◦ Error response
◦ Input calibration (learning) for analog and RC control
• Optional CRC error detection eliminates communication errors caused by noise or software
faults
• Reversed-power protection
• Field-upgradeable firmware
• Optional feedback potentiometer disconnect detection
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation

Features and specifications

1. Overview Page 5 of 199
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation
Jrk G2 21v3 USB Motor Controller with
Feedback, bottom view with dimensions.
Jrk G2 18v19 USB Motor Controller with
Feedback, bottom view with
dimensions.
Jrk G2 18v27 USB Motor Controller with
Feedback, bottom view with
dimensions.
Note: This guide only applies to the Jrk G2 motor controllers, which have black circuit
boards. If you have one of the first-generation Jrk 21v3 or Jrk 12v12 controllers, which
have green circuit boards, you can find their user’s guide here [https://www.pololu.com/docs/
0J38].

1.1. Supported operating systems

We support using the Jrk G2 and its configuration software on Windows 7, Windows 8, Windows 10,
Linux, and macOS 10.11 or later. The Jrk G2 software is not likely to work on Windows 10 IoT Core,
which is very different from the normal desktop versions of Windows. The software is open source
[https://github.com/pololu/pololu-jrk-g2-software], so it could be ported to more platforms.

1.2. Comparison to the original Jrk controllers

This section lists most of the things you should consider if you have an existing application using the
original Jrk 21v3 or Jrk 12v12 controllers and are considering upgrading to a Jrk G2.
1. Overview Page 6 of 199
• The Jrk G2 circuit boards have different dimensions, mounting hole locations, and pin
locations.
• On the Jrk G2, the RC pulse input should be connected to the pin named RC instead of RX.
• On the Jrk G2, analog control inputs should be connected to SDA/AN instead of RX.
• An analog control potentiometer should generally be powered from SCL and GND if you want
to detect disconnection (instead of AUX and GND).
• The Jrk G2 does not have a pin named FB: analog feedback signals should be connected
to the FBA pin and frequency/tachometer feedback signals should be connected to the FBT
pin.
• An analog feedback potentiometer should generally be powered from AUX and POT− (21v3,
18v19, and 24v13 only), or AUX and GND.
• Unlike the FB pin on the original jrks, the FBA pin does not have a pull-up resistor. If you need
one, you can add it externally or connect FBA to FBT to take advantage of the FBT pull-up
resistor.
• The Jrk G2 uses a USB Micro-B connector (the original Jrks used Mini-B).
• The Jrk G2 uses different configuration software from the original Jrk controllers. It is
open source [https://github.com/pololu/pololu-jrk-g2-software] and works on Windows, Linux, and
macOS. See Section 3 for installation instructions.
• The Jrk G2 serial protocol is generally a superset of the original Jrk serial protocol, so in many
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation

Motor driver improvements

Compared to the original Jrk controllers, the discrete MOSFET H-bridges on the Jrk G2 18v19,
24v13, 18v27, and 24v21 support higher operating voltages and larger output currents. Additionally,
those Jrk G2 models have configurable hardware current limiting: when the motor current exceeds a
configurable threshold, the motor driver uses current chopping to actively limit it.
The Jrk G2 21v3 uses a TB9051FTG motor driver that features hardware current chopping with a fixed
threshold of approximately 6.5 A.

Physical connection changes

You will need to keep some things in mind when updating the physical connections of an existing
application:

Configuration and software changes

There are several changes to keep in mind when configuring the Jrk G2 or updating any software that
communicates with it:
1. Overview Page 7 of 199
cases, serial interface software running on a microcontroller or computer (using the Jrk’s RX
and TX lines or its virtual USB serial ports) will not need to be modified to work with the Jrk
G2.
• The Jrk G2 native USB interface uses different product IDs and supports a different set of
USB commands. However, the “Set target” and “Motor off” commands are unchanged.
• The “detect baud rate” feature was removed, so you will need to configure the baud rate of
your Jrk ahead of time using the Jrk G2 Configuration Utility if you are controlling it over serial
with a microcontroller.
• The default “Feedback mode” on the Jrk G2 is “None” instead of “Analog”.
• On the Jrk G2, the analog control input pin (SDA/AN) does not have its pull-up resistor
enabled by default, but there is an option to enable it in the “Pin configuration” tab of the Jrk
G2 configuration utility. (The original Jrk always enabled a pull-up on RX, which served as
the analog input.)
• The Jrk G2’s “Feedback deadzone” feature has been changed so that it applies to “Duty cycle
target” instead of “Duty cycle”, which makes it compatible with the new deceleration limits.
• The Jrk G2’s “Duty cycle” variable will move towards zero (either immediately or limited by the
configurable deceleration limit) when there is an error, so the Jrk G2 will respect acceleration
limits properly once the error is resolved.
• The 8-bit “Current” variable (which can be fetched with the serial command 0x8F) has units
of 256 mA on the Jrk G2. A new 16-bit current variable is available with higher resolution.
• Unlike the original Jrk controllers, the Jrk G2 does not reset the state of all of its error
flags when you click “Apply settings” in the configuration utility. Error flags will generally be
preserved.
• The current limiting and current regulation options have changed. See Section 7.6 for details.
• The Jrk G2 has configurable deceleration limiting. Additionally, you can choose which errors
respect the deceleration limits.
• The Jrk G2 has a new “Wraparound” option for analog feedback, which is useful for systems
that continuously rotate over a full circle.
• PID coefficients and many other settings can be adjusted on the fly over serial, I²C, or USB,
using the new “Set RAM settings” command.
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation

New features

The Jrk G2 also supports a variety of new, optional features. These features were added in a
backward-compatible way and should not have an effect on your application unless you purposely use
them. Some of the most notable new features are:
1. Overview Page 8 of 199
• The new “Force duty cycle target” command lets you override the result of the PID algorithm.
• The new “Force duty cycle” command lets you override the result of the PID algorithm while
also ignoring acceleration and deceleration limits.
• New frequency feedback options allow closed-loop speed control using a much larger range
of tachometer frequencies.
• Measurements of the RC input, analog control input, analog feedback input, and the
tachometer input can all be enabled even if the Jrk’s main algorithm is not using them to
control the motor.
• The Jrk G2’s new I²C interface provides another option to connect a microcontroller to the
Jrk, and allows you to control multiple Jrks without using AND gates or level shifters.
• The Jrk G2 can measure the voltage of its VIN power supply and provide this reading over
serial, I²C, and USB.
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation
1. Overview Page 9 of 199
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation

2. Contacting Pololu

We would be delighted to hear from you about any of your projects and about your experience with
the Jrk G2 motor controllers. You can contact us [https://www.pololu.com/contact] directly or post on our
forum [https://forum.pololu.com/]. Tell us what we did well, what we could improve, what you would like
to see in the future, or anything else you would like to say!
2. Contacting Pololu Page 10 of 199
1. Download and install the Jrk G2 Software and Drivers for Windows [https://www.pololu.com/
file/0J1494/pololu-jrk-g2-1.4.0-win.msi] (10MB msi).
2. During the installation, Windows will ask you if you want to install drivers. Click “Install” to
proceed.
3. After the installation has completed, plug the Jrk into your computer via USB. Windows
should recognize the Jrk and load the drivers that you just installed.
4. Open your Start Menu and search for “Jrk G2”. Select the “Jrk G2 Configuration Utility”
shortcut (in the Pololu folder) to launch the software.
5. In the upper left corner of the window, where it says “Connected to:”, make sure that it shows
something like “18v19 #01234567”. This indicates the version and serial number of the Jrk
G2 that the software has connected to. If it says “Not connected”, see the troubleshooting
section below.
• The Jrk G2 Configuration Utility is a graphical user interface (GUI) for configuring the Jrk,
viewing its status, and controlling it manually. You can find the configuration utility in your
Start Menu by searching for it or looking in the Pololu folder.
• The Jrk G2 Command-line Utility (jrk2cmd) is a command-line utility that can do most of what
the GUI can do, and more. You can open a Command Prompt and type jrk2cmd with no
arguments to a see a summary of its options.
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation

3. Getting started

3.1. Installing Windows drivers and software

To install the drivers and software for the Jrk G2 on a computer running Microsoft Windows, follow
these steps:
The Jrk’s native USB interface implements Microsoft OS 2.0 Descriptors, so it will work
on Windows 8.1 or later without needing any drivers. The Jrk’s USB serial ports will work
on Windows 10 or later without drivers.
This Jrk G2 software consists of two programs:
The source code for the software [https://github.com/pololu/pololu-jrk-g2-software] is available.

USB troubleshooting for Windows

If the Jrk G2 software cannot connect to your Jrk after you plug it into the computer via USB, the tips
here can help you troubleshoot the Jrk’s USB connection.
3. Getting started Page 11 of 199
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation
If you are using the Jrk G2 configuration utility, try opening the “Connected to:” drop-down box to see
if there are any entries in the list. If there is an entry, try selecting it to connect to it.
Make sure you have a Jrk G2. The Jrk G2 software does not work with the older Jrk 21v3 or Jrk 12v12.
If you have one of those products, you should refer to its user’s guide instead of this user’s guide.
Make sure you are using software that supports the Jrk G2. The original Jrk Configuration Utility does
not work with the Jrk G2. The Jrk G2 controllers have new USB product IDs. Third-party software for
the older Jrk 21v3 and Jrk 12v12 controllers might need to be updated, depending on how the software
works. If you are a developer of such software, see Section 1.2.
If you have connected any electronic devices to your Jrk besides the USB cable, you should
disconnect them.
You should look at the LEDs of the Jrk. If the LEDs are off, then the Jrk is probably not receiving power
from the USB port. If the green LED is flashing very briefly once per second, then the Jrk is receiving
power from USB, but it is not receiving any data. These issues can be caused by using a broken USB
port, using a broken USB cable, or by using a USB charging cable that does not have data wires.
Using a different USB port and a different USB cable, both of which are known to work with other
devices, is a good thing to try. Also, if you are connecting the Jrk to your computer via a USB hub, try
connecting it directly.
If the Jrk’s green LED is on all the time or flashing slowly, but you can’t connect to it in the Jrk software,
then there might be something wrong with your computer. A good thing to try is to unplug the Jrk from
USB, reboot your computer, and then plug it in again.
If that does not help, you should go to your computer’s Device Manager and locate all the entries for
the Jrk. Be sure to look in these categories: “Other devices”, “Ports (COM & LPT)”, and “Universal
Serial Bus devices”.
If the driver for the Jrk’s native USB interface is working, you should see an entry in the “Universal
Serial Bus devices” category named something like “Pololu Jrk G2 18v19” (or the corresponding name
if you have a different version).
If the drivers for the Jrk’s USB serial ports are working, you should see two entries in the “Ports
(COM & LPT)” category named something like “Pololu Jrk G2 18v19 Command Port” and “Pololu
Jrk G2 18v19 TTL Port”. The serial ports might be named “USB Serial Device” instead if you are
using Windows 10 or later and you plugged the Jrk into your computer before installing our drivers
for it. The generic names in the Device Manager will not prevent you from using the ports, but we
recommend fixing the names by right-clicking on each “USB Serial Device” entry, selecting “Update
Driver Software…”, and then selecting “Search automatically for updated driver software”. Windows
should find the drivers you already installed, which contain the correct name for the port.
3. Getting started Page 12 of 199
1. Download the version for your system from this list:
Jrk G2 Software for Linux (x86) [https://www.pololu.com/file/0J1500/pololu-jrk-
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation
If any of the entries for the Jrk in the Device Manager has a yellow triangle displayed over its icon, you
should double-click on the entry to get information about the error that is happening.
If you do not see entries for the Jrk in the Device Manager, then you should open the “View” menu
and select “Devices by connection”. Then expand the entries until you find your computer’s USB
controllers, hubs, and devices. See if there are any entries in the USB area that disappear when you
unplug the Jrk. This might give you important information about what is going wrong.
Do not attempt to fix driver issues in your Device Manager using the “Add legacy hardware” option.
This is only for older devices that do not support Plug-and-Play, so it will not help. If you already tried
this option, we recommend unplugging the Jrk from USB and then removing any entries you see for
the Jrk by right-clicking on them and selecting “Uninstall”. Do not check the checkbox that says “Delete
the driver software for this device”.
Windows 10 Device Manager showing the Jrk G2.

3.2. Installing Linux software

To install the software for the Jrk G2 on a computer running Linux, follow these steps:
3. Getting started Page 13 of 199
g2-1.4.0-linux-x86.tar.xz] (9MB xz) — works on 32-bit and 64-bit systems
Jrk G2 Software for Linux (Raspberry Pi) [https://www.pololu.com/file/0J1501/pololu-
jrk-g2-1.4.0-linux-rpi.tar.xz] (6MB xz) — works on the Raspberry Pi and might work on
other ARM Linux systems
2. In a terminal, use cd to navigate to the directory holding the downloaded file. For example,
run cd ~/Downloads if it was downloaded to the “Downloads” folder in your home directory.
3. Run tar -xvf pololu-jrk-g2-*.tar.xz to extract the software. If you downloaded multiple
versions of the software, you should use an exact file name instead of an asterisk.
4. Run sudo pololu-jrk-g2-*/install.sh to install the software. You will need to have sudo
privilege on your system and you might need to type your password at this point. Look at the
output of the script to see if any errors happened.
5. After the installation has completed, plug the Jrk into your computer via USB. If you already
connected the Jrk earlier, unplug it and plug it in again to make sure the newly-installed udev
rules are applied.
6. Run jrk2cmd --list to make sure the software can detect the Jrk. This command should
print the serial number and product name of the Jrk. If it prints nothing, see the “USB
troubleshooting for Linux” section below.
7. If you are using a graphical desktop environment, run jrk2gui to start the configuration
utility. In the upper left corner of the window, where it says “Connected to:”, make sure that it
shows something like “18v19 #01234567”. This indicates the version and serial number of the
Jrk G2 that the software has connected to. If it says “Not connected”, see the troubleshooting
section below.
• The Jrk G2 Configuration Utility (jrk2gui) is a graphical user interface (GUI) for configuring
the Jrk G2 and viewing its status. You can open a terminal and type jrk2gui to run it.
• The Jrk G2 Command-line Utility (jrk2cmd) is a command-line utility that can do most of what
the GUI can do, and more. You can open a terminal and type jrk2cmd with no arguments to
a see a summary of its options.
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation
This Jrk G2 software consists of two programs:
The Jrk G2 software for Linux is statically linked; it does not depend on any shared libraries. The
source code for the software [https://github.com/pololu/pololu-jrk-g2-software] is available. The Jrk G2
does not require any driver installation on Linux.

Software installation troubleshooting for Linux

If you do not have sudo privilege or you do not remember your password, you can skip running
3. Getting started Page 14 of 199
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation
install.sh and just run the programs directly from the directory you extracted them to. You should
also consider moving the software to a more permanent location and adding that location to your PATH
as described below.
If you get a “No such file or directory” error while running ./install.sh , it is possible that your
system is missing one of the directories that the install script assumes will be present. Please contact
[https://www.pololu.com/contact] us to let us know about your system so we can consider supporting it
better in the future.
If you get the error “command not found” when you try to run jrk2cmd or jrk2gui , then you should
run echo $PATH to see what directories are on your PATH, and then make sure one of those directories
contains the Jrk executables or symbolic links to them. The installer puts symbolic links in /usr/local/
bin , so if that directory is not on your PATH, you should run export PATH=$PATH:/usr/local/bin to
add it. Also, you might want to put that line in your ~/.profile file so the directory will be on your
PATH in future sessions.
If you get the error “cannot execute binary file: Exec format error” when you try to run jrk2cmd or
jrk2gui , then it is likely that you downloaded the wrong version of the software from the list above.
If all of the listed versions give you this error, you will probably need to compile the software from
source by following the instructions in BUILDING.md [https://github.com/pololu/pololu-jrk-g2-software/blob/
master/BUILDING.md] in the source code [https://github.com/pololu/pololu-jrk-g2-software]. Please contact
[https://www.pololu.com/contact] us to let us know about your system so we can consider supporting it
better in the future.
If the Jrk G2 Configuration Utility window is too big to fit on your screen properly, try setting the
JRK2GUI_FONT_SIZE environment variable to “6” before running the software. You can do this by
running the command JRK2GUI_FONT_SIZE=6 jrk2gui in your terminal. You can experiment with font
sizes other than 6 to see if they work for you. You could also add the line export JRK2GUI_FONT_SIZE=6
to your ~/.profile to make the change permanent.

USB troubleshooting for Linux

If the Jrk G2 software cannot connect to your Jrk after you plug it into the computer via USB, the tips
here can help you troubleshoot the Jrk’s USB connection.
If you are using the Jrk G2 Configuration Utility, try opening the “Connected to:” drop-down box to see
if there are any entries in the list. If there is an entry, try selecting it to connect to it.
Make sure you have a Jrk G2. The Jrk G2 software does not work with the older Jrk 21v3 or Jrk 12v12.
If you have one of those products, you should refer to its user’s guide instead of this user’s guide.
Make sure you are using software that supports the Jrk G2. The original Jrk Configuration Utility does
3. Getting started Page 15 of 199
1. Download the Jrk G2 Software for macOS [https://www.pololu.com/file/0J1502/pololu-jrk-
g2-1.4.0-macos.pkg] (8MB pkg).
2. Double-click on the downloaded file to run it, and follow the instructions.
3. After the installation has completed, plug the Jrk into your computer via USB.
4. In your Applications folder, look for “Pololu Jrk G2”. Double-click on “Pololu Jrk G2” to start
the configuration utility.
5. In the upper left corner of the window, where it says “Connected to:”, make sure that it shows
something like “18v19 #01234567”. This indicates the version and serial number of the Jrk
G2 that the software has connected to. If it says “Not connected”, see the troubleshooting
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation
not work with the Jrk G2. The Jrk G2 controllers have new USB product IDs. Third-party software for
the older Jrk 21v3 and Jrk 12v12 controllers might need to be updated, depending on how the software
works. If you are a developer of such software, see Section 1.2.
If you have connected any electronic devices to your Jrk besides the USB cable, you should
disconnect them.
You should look at the LEDs of the Jrk. If the LEDs are off, then the Jrk is probably not receiving power
from the USB port. If the green LED is flashing very briefly once per second, then the Jrk is receiving
power from USB, but it is not receiving any data. These issues can be caused by using a broken USB
port, using a broken USB cable, or by using a USB charging cable that does not have data wires.
Using a different USB port and a different USB cable, both of which are known to work with other
devices, is a good thing to try. Also, if you are connecting the Jrk to your computer via a USB hub, try
connecting it directly.
If the Jrk’s green LED is on all the time or flashing slowly, but you can’t connect to it in the Jrk software,
then there might be something wrong with your computer. A good thing to try is to unplug the Jrk from
USB, reboot your computer, and then plug it in again.
If you get a “Permission denied” error when trying to connect to the Jrk, you should make sure to copy
the 99-pololu.rules file into /etc/udev/rules.d and then unplug the Jrk and plug it back in again.
The install script normally takes care of installing that file for you.
If that does not help, you should try running lsusb to list the USB devices recognized by your
computer. Look for the Pololu vendor ID, which is 1ffb. You should also try running dmesg right after
plugging in the Jrk to see if there are any messages about it.

3.3. Installing macOS software

To install the configuration software for the Jrk G2 on a computer running macOS, follow these steps:
3. Getting started Page 16 of 199
section below.
• The Jrk G2 Configuration Utility (jrk2gui) is a graphical user interface (GUI) for configuring the
Jrk G2 and viewing its status. You can run it by clicking on “Pololu Jrk G2” in the Applications
folder, or you can open a terminal and type jrk2gui to run it.
• The Jrk G2 Command-line Utility (jrk2cmd) is a command-line utility that can do most of what
the GUI can do, and more. You can open a terminal and type jrk2cmd with no arguments to
a see a summary of its options.
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation
This Jrk G2 software consists of two programs:
The source code for the software [https://github.com/pololu/pololu-jrk-g2-software] is available. The Jrk
G2 does not require any driver installation on macOS.

Software installation troubleshooting for macOS

If you get the error “command not found” when you try to run jrk2cmd or jrk2gui , then you should try
starting a new Terminal window. The installer adds a file named 99-pololu-jrk2 in the /etc/paths.d
directory to make sure the software gets added to your PATH, but the change will not take effect until
you open a new Terminal window.
The Jrk G2 software will not work on versions of macOS prior to 10.11.

USB troubleshooting for macOS

If the Jrk G2 software cannot connect to your Jrk after you plug it into the computer via USB, the tips
here can help you troubleshoot the Jrk’s USB connection.
If you are using the Jrk G2 Configuration Utility, try opening the “Connected to:” drop-down box to see
if there are any entries in the list. If there is an entry, try selecting it to connect to it.
Make sure you have a Jrk G2. The Jrk G2 software does not work with the older Jrk 21v3 or Jrk 12v12.
If you have one of those products, you should refer to its user’s guide instead of this user’s guide.
Make sure you are using software that supports the Jrk G2. The original Jrk Configuration Utility does
not work with the Jrk G2. The Jrk G2 controllers have new USB product IDs. Third-party software for
the older Jrk 21v3 and Jrk 12v12 controllers might need to be updated, depending on how the software
works. If you are a developer of such software, see Section 1.2.
If you have connected any electronic devices to your Jrk besides the USB cable, you should
disconnect them.
You should look at the LEDs of the Jrk. If the LEDs are off, then the Jrk is probably not receiving power
3. Getting started Page 17 of 199
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation
from the USB port. If the green LED is flashing very briefly once per second, then the Jrk is receiving
power from USB, but it is not receiving any data. These issues can be caused by using a broken USB
port, using a broken USB cable, or by using a USB charging cable that does not have data wires.
Using a different USB port and a different USB cable, both of which are known to work with other
devices, is a good thing to try. Also, if you are connecting the Jrk to your computer via a USB hub, try
connecting it directly.
If the Jrk’s green LED is on all the time or flashing slowly, but you can’t connect to it in the software,
then there might be something wrong with your computer. A good thing to try is to unplug the Jrk from
USB, reboot your computer, and then plug it in again.
Another thing to try is to run dmesg right after plugging in the Jrk to see if there are any messages
about it.
3. Getting started Page 18 of 199
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation

4. Basic setup

4.1. Choosing the motor, power supply, and Jrk

The information in this section can help you select a motor [https://www.pololu.com/category/22/motors-and-
gearboxes], a power supply [https://www.pololu.com/category/84/regulators-and-power-supplies], and a Jrk G2
controller that will work well together.
The Jrk requires a DC power supply. The Jrk is designed to drive a brushed DC motor, either by itself
or as part of a device like a linear actuator [https://www.pololu.com/category/127/linear-actuators].

Voltage and current ratings

When selecting your motor, power supply, and Jrk controller, you must consider the voltage and
current ratings of each.
The rated voltage of a DC motor is the voltage it was designed to run at, and this is the voltage
at which it will draw its rated currents. It is fine to drive a motor with a lower voltage than what it is
rated for, in which case its current draw will be proportionally lower, as well as its speed and torque.
Conversely, using a higher-than-rated voltage will result in proportionally higher current draw, speed,
and torque, and could negatively affect the lifetime of the motor. However, you can limit the PWM
duty cycle used to drive the motor to keep its average current draw within rated limits. (For example,
running a 6 V motor at 12 V but limiting its duty cycle to a maximum of 50% should generally be OK).
The stall current of a DC motor is how much current the motor will draw when power is applied but it
is not spinning (for example, if the motor shaft is prevented from rotating), producing maximum torque
and minimum (zero) speed. The stall current depends on the voltage that is applied to the motor, and
the stall current is usually measured at the rated voltage of the motor. Most brushed DC motors are
not designed to be stalled for extended periods and can be damaged if they are.
It is not unusual for the stall current of a motor to be an order of magnitude (10×) higher
than its free-run current. When a motor is supplied with full power from rest, it briefly
draws the full stall current, and it draws nearly twice the stall current if abruptly switched
from full speed in one direction to full speed in the other direction.
The free-run current of a DC motor (or no-load current) is how much current the motor draws when it
is running freely, producing maximum speed and minimum torque (since there is no external opposing
torque). Like the stall current, the free-run current depends on the voltage that is applied to the motor,
and is usually measured at the rated voltage of the motor.
The voltage range of your power supply is the range of voltages you expect your power supply to
produce while operating. There is usually some variation in the output voltage so you should treat it as
4. Basic setup Page 19 of 199
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation
a range instead of just a single number. In particular, keep in mind that a fully-charged battery might
have a voltage that is significantly higher than its nominal voltage.
The current limit of a power supply is how much current the power supply can provide. Note that the
power supply will not force this amount of current through your system; the properties of the system
and the voltage of the power supply determine how much current will flow, but there is a limit to how
much current the power supply can provide.
The minimum operating voltage of a Jrk is the lowest voltage that is acceptable for the Jrk’s motor
power supply. If you try to power the Jrk with a voltage lower than this, it might fail to deliver power to
the motor, but it should not cause any permanent damage.
The absolute maximum operating voltage of a Jrk is the maximum voltage that can be tolerated by
the Jrk. If the voltage of the power supply rises above this voltage, even for just a brief period of time,
the Jrk could be permanently damaged.
The recommended maximum operating voltage of a Jrk is the maximum voltage we recommend
using for the Jrk’s motor power supply. We have chosen this number to be significantly lower than the
absolute max operating voltage so that if there is noise on the power supply it is unlikely to exceed the
absolute max operating voltage.
The maximum nominal battery voltage of a Jrk is the maximum nominal voltage we recommend
using for batteries that supply power to the Jrk. We have chosen this number to be significantly
lower than the recommended maximum operating voltage because fully-charged batteries can have a
voltage that is significantly higher than their nominal voltage.
The maximum continuous current of a Jrk indicates the motor current that it can continuously
supply without overheating in typical conditions (at room temperature with no additional cooling). The
Jrk’s MOSFETs can handle large current spikes for short durations (e.g. 100 A for a few milliseconds),
and the Jrk’s hardware current limit can be configured to help it handle large transients, such as when
starting a motor. However, note that the Jrk does not have an over-temperature shut-off. (The Jrk’s
motor driver error can indicate an over-temperature fault, but the Jrk does not directly measure the
temperature of the MOSFETs, which are usually the first components to overheat.) As a result, an
over-temperature or over-current condition can still cause permanent damage.
The voltage and current ratings of the different Jrk G2 controllers are shown in the table below.
4. Basic setup Page 20 of 199
1. The voltage of your power supply should ideally be greater than or equal to the rated voltage
of your motor so that you can get the full performance that the motor is capable of. It is
OK for the power supply voltage to be higher than the rated voltage of the motor, but if it is
significantly higher then you should consider configuring the Jrk’s maximum duty cycle limits
in order to limit the voltage applied to the motor.
2. The voltage of your power supply should be within the operating voltage range of the Jrk.
Otherwise, the Jrk could malfunction or (in the case of high voltages) be damaged.
3. The maximum continuous current of the Jrk and the current limit of the power supply should
ideally be greater than or equal to the stall current of the motor. However, this might be
impractical or unnecessary in some applications, especially with high-power motors that are
not intended to be stalled for prolonged periods (and will be damaged if they are). If so, you
should at least make sure that both current ratings are greater than the free-run current of the
motor. The higher the stall current of your motor, the more important it is to consider using
the Jrk’s acceleration limiting and hardware current limiting to prevent the motor from drawing
too much current.
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation
Jrk G2 21v3 Jrk G2 18v19 Jrk G2 24v13 Jrk G2 18v27 Jrk G2 24v21
Minimum operating voltage:
Absolute max operating voltage:
Recommended max operating voltage:
Max nominal battery voltage:
Max continuous current (no additional cooling):
1 The 5V logic voltage drops when powered from a supply below about 5.2 V. 2 Operation from 28 V to 40 V should be transient (< 500 ms).
(1)
4.5 V
(2)
40 V
28 V 24 V 34 V 24 V 34 V
24 V 18 V 28 V 18 V 28 V
2.6 A 19 A 13 A 27 A 21 A
6.5 V 6.5 V 6.5 V 6.5 V
30 V 40 V 30 V 40 V
These are the main constraints you should keep in mind when selecting your power supply, Jrk
controller, and motor:

4.2. Connecting the motor and power supply

The information in this section can help you connect your motor and power supply to the Jrk G2.
Warning: This product is not designed to or certified for any particular high-voltage safety
standard. Working with voltages above 30 V can be extremely dangerous and should only
be attempted by qualified individuals with appropriate equipment and protective gear.
4. Basic setup Page 21 of 199
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation
Warning: This product can get hot enough to burn you long before the chips overheat. Take
care when handling this product and other components connected to it.
It is a good practice to check that things are working in small chunks, rather than doing your first
checks after you have spent hours making a complicated system. Before connecting anything to the
Jrk, we recommend connecting it to USB and running the Jrk G2 Configuration Utility, as described in
Section 3.
Before connecting anything else, disconnect the Jrk from USB. Generally, rewiring anything while it is
powered is asking for trouble.
You can solder the terminal blocks that come with the Jrk to the four large through-holes to make your
motor and power connections, or you can solder an 8-pin piece of the 0.1″ header strip (which also
comes with the Jrk) into the smaller through-holes that border these larger holes. Note, however, that
the terminal blocks are only rated for 16 A, and each header pin pair is only rated for a combined 6 A,
so for higher-power applications, we recommend soldering thick wires directly to the board. If you have
a Jrk G2 21v3 with connectors already soldered [https://www.pololu.com/product/3143], then you do not
need to solder anything to the Jrk to make your motor and power connections.
4. Basic setup Page 22 of 199
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation
Jrk G2 18v19 or 24v13 USB Motor
Controller with thick wires and included
headers soldered.
Jrk G2 18v19 or 24v13 USB Motor
Controller with included terminal
blocks and headers soldered.
Jrk G2 18v27 or 24v21 USB Motor
Controller with thick wires and included
headers soldered.
Jrk G2 18v27 or 24v21 USB Motor
Controller with included terminal
blocks and headers soldered.
Jrk G2 21v3 USB Motor Controller with
Feedback (Connectors Soldered).
You should connect the motor leads to the OUTA and OUTB pins (which are labeled “A” and “B” on
some boards). You should connect the negative terminal of the power supply to GND and the positive
terminal of the power supply to VIN.
Next, turn on the power supply (if needed). Make sure that the Jrk’s yellow or red LEDs turn on at
4. Basic setup Page 23 of 199
• Set the “Max. duty cycle” to a safe value, like 200 (33%).
• Set the “Max. acceleration” to a safe value, like 6. (It will take 100 PID periods, or 1 second,
for the motor to reach a duty cycle of 600 (100%).)
• For now, you should probably leave the “Max. deceleration” set to its default value of 600 so
that the Jrk will always stop the motor immediately when commanded.
• If there is a “Hard current limit” setting, set it to a safe value, like 3 A. (The Jrk G2 21v3 does
not have configurable hardware current limiting so that setting is hidden. Its TB9051FTG
motor driver always limits the current to approximately 6.5 A.)
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation
this point. If neither LED turns on, you might have connected power backwards, and you should fix it
before connecting the Jrk to any other electronics.

4.3. Configuring and testing the motor

This section explains how to configure and test your motor over USB using the Jrk G2 Configuration
Utility, without using feedback. It is a good idea to test the motor like this to make sure that the motor
is working and that you can get the desired performance out of it before you try to set up feedback or a
different input mode. Of course, this requires that you have a system that does not destroy itself when
run without feedback.
If you have not done so already, you should connect your motor and power supply to the Jrk G2 as
described in Section 4.2. Then, connect the Jrk to your computer via USB, open Jrk G2 Configuration
Utility, and connect to the Jrk.
If you have changed any of the settings of your Jrk, you should probably reset the Jrk to its default
settings by opening the “Device” menu and selecting “Restore default settings”. Then, make sure the
“Input mode” is set to “Serial / I²C / USB” (in the “Input” tab) and make sure the “Feedback mode” is
set to “None” (in the “Feedback” tab).
The “Motor” tab has several settings that affect the behavior of the motor. For your initial tests, we
recommend changing a few of these settings to safe values to help avoid damage:
In the “Errors” tab, set the “No power” error to enabled and latched so that your system will stop if
there is a power issue and not automatically start running again until you command it to.
You might want to set other limits as necessary. You can read more about the motor settings in
Section 7.6.
Click “Apply settings” to apply the new settings to the Jrk.
Click the “Run motor” button to clear any latched errors. The message at the bottom of the Jrk G2
4. Basic setup Page 24 of 199
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation
configuration utility should now say “Motor stopped.”. If that message indicates errors instead, you can
find out what errors are stopping the motor by looking in the “Errors” tab. You will need to fix those
errors before you can test your motor.
You can use the slider in the “Manually set target” box to try out some different duty cycles. The
slider controls the “Target” variable, and the Jrk will set the duty cycle to the target minus 2048,
after accounting for the limits you have configured. A target of 2048 corresponds to the motor being
stopped. One way to set the target to 2048 is to click the “Center” button. You can also stop the motor
at any time by clicking the “Stop motor” button.
The green dot on the slider shows the duty cycle (plus 2048). This makes it easy to see if the Jrk’s
duty cycle is different from its duty cycle target due to motor limits.
If you have a concept of “forward” for your system but the motor does not go in that direction when you
drive it with positive duty cycles, you might want to swap the motor leads or enable the “Invert motor
direction” option in the “Motor” tab.
If everything goes well, you should try increasing your “Max. duty cycle”, “Max. accleration”, “Hard
current limit”, and other limits in to reasonable values for high-performance operation of your system.
If possible, make sure you can get the desired performance out of your motor before setting up
feedback.
4. Basic setup Page 25 of 199
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation

5. Setting up the feedback method

5.1. Setting up open-loop control

To configure the Jrk G2 for open-loop speed control, you should open the Jrk G2 Configuration Utility,
go to the “Feedback” tab, and set the “Feedback mode” to “None” (which is the default). We also
recommend following the instructions in Section 4.3 to configure and test your motor.
When the “Feedback mode” is “None”, the Jrk calculates its “Duty cycle target” variable by simply
subtracting 2048 from the “Target” variable. So a target of 2048 corresponds to the motor being off,
while a target of 2648 corresponds to full speed forward (100%), and a target of 1448 corresponds to
full speed reverse (−100%).
You can set the target directly over USB, serial, or I²C, or you can configure the Jrk to calculate the
target by scaling the reading from an analog or RC input. If you are using an analog or RC input,
you will probably want to configure the input scaling settings to map all input values to targets within
the 1448 to 2648 range, so that more of your input range is usable. There is more information about
setting up the scaling settings in Section 6.4 and Section 6.5.

5.2. Setting up analog feedback

This section explains how to connect an analog feedback signal to the Jrk G2 and configure the Jrk
G2 to do position control. Please note that this is different from setting up an analog control signal,
which is documented in Section 6.4.

Connecting analog feedback

If you have not done so already, you should follow the instructions in Section 4.3 to configure and
test your motor. Next, with the system unpowered, connect your analog feedback signal to the Jrk as
described below.
If you are using a potentiometer to generate the analog feedback signal, then you should connect the
potentiometer’s wiper to FBA. You should connect the other two ends of the feedback potentiometer to
the power pins that are in line with FBA: on the Jrk G2 18v27 and 24v21, the pins are AUX and GND,
while on the other Jrk G2 versions the pins are AUX and POT−.
5. Setting up the feedback method Page 26 of 199
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation
Connecting analog voltage feedback to the Jrk G2.
If you are using something other than a potentiometer to generate the analog feedback signal, make
sure that the ground node of that device is connected to a GND pin of the Jrk, and that the signal from
that device is connected to the FBA pin. The Jrk can only accept signals between 0 V and 5 V with
respect to GND; signals outside of this range could damage the Jrk.

Configuring and calibrating analog feedback

Now connect your Jrk to your computer via USB. In the Jrk G2 Configuration Utility, go to the
“Feedback tab” and set the “Feedback mode” to “Analog voltage”.
If you are powering a feedback potentiometer from the AUX pin, you should check the “Detect
disconnect with power pin (AUX)” checkbox. This causes the Jrk to drive AUX low periodically to help
detect whether the feedback potentiometer has been disconnected.
Go to the “Errors” tab and set the “Feedback disconnect” error to “Enabled and latched”. Click the
“Apply settings” button.
Turn on motor power.
In the “Scaling” box of the “Feedback” tab, click “Learn…” to start the feedback setup wizard.
Steps 1 and 2 of the feedback setup wizard helps you configure the direction of your motor and the
5. Setting up the feedback method Page 27 of 199
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation
direction of your feedback. These steps ensure that a positive duty cycle corresponds to the motor
moving in the direction that you consider to be forward in your system, and that this forward movement
also causes the Jrk’s “Scaled feedback” variable to increase.
Step 3 of the feedback setup wizard lets you set the range of your feedback.
If possible, the range you enter in step 3 should be at least a little larger than the range
of motion that you actually plan on using. Raw feedback values within this range get
mapped to “Scaled feedback” values from 0 to 4095. Raw feedback values outside of
the range will be mapped to a “Scaled feedback” value of either 0 or 4095, depending
on whether they are below or above the range. The Jrk’s PID algorithm does not look at
the raw feedback variable: it compares the “Scaled feedback” to the “Target” and drives
the motor in attempt to eliminate the difference between those two, also known as the
“Error”. If you set the “Target” to 0 or 4095 but something pulls your system outside of
the feedback range entered in step 3, the “Scaled feedback” variable will not change so
the Jrk will not know it should drive the motor to get the system back within the desired
range.
Once you have finished the wizard, the new settings should be applied to the Jrk.

Testing basic feedback

At this point, the Jrk is almost ready to do position control. Go to the “PID” tab and enter a “Proportional
coefficient” of 1, while leaving the other two coefficients set to zero. This will probably drive your motor
at its maximum duty cycle, so make sure that this and other motor parameters are configured correctly.
Click “Apply settings”.
Use the target slider at the bottom of the window to send various target values to your Jrk, and see
how it behaves. The red dot on the slider shows the “Scaled feedback” value.
If you did everything correctly, your feedback system should now be active, approximately following
the target value.

Troubleshooting basic feedback

If the steps above do not result in a working position feedback system, these tips can help you figure
out what is wrong and get the system working.
First of all, look in the “Errors” tab and look at the status message at the bottom of the Jrk G2
Configuration Utility. These messages might tell you why things are not working.
It is possible that you did not do one of the steps of the Feedback wizard correctly. You might consider
5. Setting up the feedback method Page 28 of 199
• During each PID update period (which is 10 ms by default), the Jrk measures the analog
voltage on the FBA pin and uses that to set the (raw) “Feedback” variable, which you can
see in the Status tab of the Jrk Configuration Utility. A value of 0 should represent 0 V, while
a value of 4092 represents approximately 5 V.
• The Jrk scales the raw feedback value using the scaling settings from the “Feedback” tab
in order to compute the “Scaled feedback” value, which is also a number between 0 and
4095. Raw feedback values above the “Maximum” feedback value get mapped to a “Scaled
feedback” value of 4095 (if the feedback direction is not inverted) or 0 (if the feedback
direction is inverted. Raw feedback values below the “Minimum” feedback value get mapped
to a “Scaled feedback” value of 0 (if the feedback direction is not inverted) or 4095 (if the
feedback direction is inverted).
• The Jrk’s PID algorithm calculates the “Scaled Feedback” minus the “Target” (which is called
the Error), multiplies it by the proportional coefficient, then multiplies by −1, and assigns that
value to the “Duty cycle target” variable (assuming the derivative and integral coefficients
are zero). A “Duty cycle target” of −600 represents full speed reverse while a “Duty cycle
target” of 600 represents full speed forward, but the target can be outside of this range. A
proportional coefficient of 1 means that the “Target” and “Scaled feedback” have to differ by
600 counts before the Jrk will drive the motor at full speed.
• The Jrk applies max duty cycle, max acceleration, and other motor limits to the “Duty cycle
target” to produce the “Duty cycle” variable between −600 (full speed reverse) and 600 (full
speed forward).
• The Jrk drives the motor at the specified duty cycle. The direction of the motor is determined
by the sign of the “Duty cycle” variable and the “Invert motor direction” setting, which was
determined in step 1 of the feedback setup wizard.
• Measure the analog voltage on the FBA pin with respect to GND and make sure it accurately
reflects the position of your system.
• Compare those measurements to the “Feedback” variable, and make sure it accurately
reflects the voltage on the FBA pin as described above.
• Make sure that the “Scaled feedback” values goes to roughly 4095 at your system’s extreme
forward position (according to your definition of forward for your system), and goes to roughly
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation
trying the wizard again and carefully reading each instruction.
To troubleshoot effectively, you should know a little bit about how the Jrk’s PID algorithm works.
The “Status” tab displays the “Feedback”, “Scaled feedback”, “Target”, “Error”, “Duty cycle target”, and
“Duty cycle” variables so you can see what is happening at each step of this process and figure out
exactly where things are going wrong:
5. Setting up the feedback method Page 29 of 199
0 at your system’s extreme reverse position. If not, the feedback scaling settings should
probably be adjusted.
• Make sure that the “Duty cycle target” is equal to the “Target” minus the “Scaled feedback”
(assuming your proportional coefficient is 1 and the other coefficients are 0).
• Make sure that the “Duty cycle” responds properly to changes in the “Duty cycle target”. If the
“Duty cycle” is not being calculated properly, check the limits in the “Motor” tab.
• Make sure that the “Duty cycle” goes below −150 (−25%) or above 150 (25%) when you try to
drive the motor, or else you might not be applying enough power to actually move the motor.
• Make sure that when the motor is moving, a positive duty cycle corresponds to forward
movement (according to your definition of forward for your system), while a negative duty
cycle corresponds to reverse movement. If this is not the case, you should toggle the “Invert
motor direction” checkbox in the “Motor” tab or retry the feedback setup wizard.
• Make sure that when the motor is moving with a positive duty cycle, the scaled feedback
value is increasing, and that when the motor is moving with a negative duty cycle, the scaled
feedback value is decreasing. If this is not the case, you should toggle the “Invert feedback
direction” checkbox in the “Feedback” tab or retry the feedback setup wizard.
Jrk G2 Motor Controller User’s Guide © 2001–2019 Pololu Corporation

Tuning the PID coefficients

After getting a basic feedback system working, you might want to tune it for better performance. You
should first increase your “Max. duty cycle”, and other limits to reasonable values for high-performance
operation of your system. Tuning the PID coefficients might also be worthwhile. We are working on
adding more information about tuning the PID coefficients to this section. In the meantime, you might
find the “Tuning the PID constants” subsection of the Setting Up Your System [https://www.pololu.com/
docs/0J38/5] section in the orignal user’s guide for the original Jrk controllers to be helpful, even though
it was written for a different product.

5.3. Setting up frequency feedback

This section explains how to connect a frequency feedback signal to the Jrk G2 and configure the
Jrk G2 to do PID speed control. Please note that this is different from setting up RC control, which is
documented in Section 6.5.
Also, please note that the Jrk cannot detect the direction your motor is moving in this mode. It will
measure the frequency on FBT using one of the methods described below and set the “Feedback”
variable to 2048 plus or minus the frequency measurement (restricted to be between 0 and 4095). It
will use “plus” if the “Target” variable (which specifies the desired speed) is 2048 or more, and it will
use “minus” otherwise.
5. Setting up the feedback method Page 30 of 199
Loading...
+ 169 hidden pages