Pololu G2 User Manual

Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
Pololu Simple Motor Controller
G2 User’s Guide
https://www.pololu.com/docs/0J77/all Page 1 of 143
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1. 18v15 and 24v12 included hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.2. 18v25 and 24v19 included hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.3. Supported operating systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.4. Comparison to the original Simple Motor Controllers . . . . . . . . . . . . . . . . . . . 12
3.1. Installing Windows drivers and software . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.2. Understanding the control center Status tab . . . . . . . . . . . . . . . . . . . . . . . 18
3.3. Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.5. LED feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.1. Connecting power and a motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.2. Serial/I²C interface pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
4.3. Connecting a serial device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.4. Connecting an I²C device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.5. Connecting an RC receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
4.6. Connecting a potentiometer or analog joystick . . . . . . . . . . . . . . . . . . . . . . 46
5.1. Input settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
5.1.1. Configuring a limit or kill switch . . . . . . . . . . . . . . . . . . . . . . . . . . 57
5.2. Motor settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
5.3. Advanced settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
5.4. Upgrading firmware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
6.1. Serial and I²C settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.2. Binary commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.2.1. Binary command reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
6.3. ASCII commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
6.3.1. ASCII command reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
6.4. Controller variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
6.5. Cyclic redundancy check (CRC) error detection . . . . . . . . . . . . . . . . . . . . 103
6.6. Serial daisy chaining . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
7. Writing PC software to control the Simple Motor Controller G2 . . . . . . . . . . . . . . . . 108
8. Example code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Page 2 of 143
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
8.1. Example code to run smcg2cmd in C . . . . . . . . . . . . . . . . . . . . . . . . . . 109
8.2. Example code to run smcg2cmd in Python . . . . . . . . . . . . . . . . . . . . . . . . 110
8.3. Example native USB code in C#, Visual C++, and VB .NET . . . . . . . . . . . . . . . 111
8.4. Example serial code for Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
8.5. Example serial code for Orangutan . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
8.6. Example serial code for Linux and macOS in C . . . . . . . . . . . . . . . . . . . . . 123
8.7. Example serial code for Windows in C . . . . . . . . . . . . . . . . . . . . . . . . . 128
8.8. Example serial code in Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
8.9. Example serial code for Linux or macOS in Bash . . . . . . . . . . . . . . . . . . . . 134
8.10. Example I²C code for Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
8.11. Example I²C code for Linux in C . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
8.12. Example I²C code for Linux in Python . . . . . . . . . . . . . . . . . . . . . . . . . 140
8.13. Example CRC computation in C . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Page 3 of 143
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
1. Overview
The second-generation G2 Simple Motor Controllers are
versatile, general-purpose motor controllers for brushed,
DC motors. Wide operating voltage ranges and the ability
to deliver up to several hundred Watts in a small form
factor make these controllers suitable for many motor
control applications. With a variety of supported
interfaces—USB for direct connection to a computer, TTL
serial and I²C for use with embedded systems, RC hobby
servo pulses for use as an RC-controlled electronic
speed control (ESC), and analog voltages for use with a potentiometer or analog joystick—and a wide
array of configurable settings, these motor controllers make it easy to add basic control of brushed DC
motors to a variety of projects. A free configuration utility for Windows simplifies initial setup of the
device and allows for in-system testing and monitoring of the controller via USB.
The table below lists the members of the Simple Motor Controller G2 family and shows the key
differences among them:
Side-by-side comparison of the different
G2 Simple Motor Controllers.
18v15 24v12 18v25 24v19
Minimum operating voltage:
Recommended max operating voltage:
Max nominal battery voltage:
Max continuous current (no additional cooling):
Dimensions: 2.1″ × 1.1″ 1.7″ × 1.2″
Available with connectors installed?
1 30 V absolute max. 2 40 V absolute max.
6.5 V 6.5 V 6.5 V 6.5 V
(1)
24 V
18 V 28 V 18 V 28 V
15 A 12 A 25 A 19 A
Yes Yes No No
34 V
(2)
24 V
(1)
34 V
(2)
1. Overview Page 4 of 143
• Simple bidirectional control of one DC brush motor.
• Five communication or control options:
1. USB interface for direct connection to a PC.
2. Logic-level (TTL) serial interface for use with a microcontroller.
3. I²C interface for use with a microcontroller.
4. Hobby radio control (RC) pulse width interface for direct connection to an RC
receiver or RC servo controller [https://www.pololu.com/category/12/rc-servo-controllers].
5. 0 V to 3.3 V analog voltage interface for direct connection to potentiometers and
analog joysticks.
• Simple configuration and calibration over USB with a free configuration program for Windows
• Reverse-voltage protection
• Hardware current limiting with a configurable threshold
• Current sensing
• Adjustable maximum acceleration and deceleration to limit electrical and mechanical stress
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
Key features
High-Power Simple Motor Controller G2 18v25 or 24v19 simplified
connection diagram.
Note: A USB A to Micro-B cable [https://www.pololu.com/product/2073] (not included) is
required to connect this controller to a computer.
Additional features
1. Overview Page 5 of 143
on the system.
• Adjustable starting speed and maximum speed.
• Option to brake or coast when speed is zero.
• Optional safety controls to avoid unexpectedly powering the motor.
• Input calibration (learning) and adjustable scaling degree for analog and RC signals.
• Under-voltage shutoff with hysteresis for use with batteries vulnerable to over-discharging
(e.g. LiPo cells).
• Adjustable over-temperature threshold and response.
• Adjustable PWM frequency from 1.13 kHz to 22.5 kHz (maximum frequency is ultrasonic,
eliminating switching-induced audible motor shaft vibration).
• Error LED linked to a digital ERR output, and connecting the error outputs of multiple
controllers together optionally causes all connected controllers to shut down when any one
of them experiences an error.
• Field-upgradeable firmware.
Features of the serial, I²C, and USB interfaces:
◦ Optional CRC error detection to eliminate communication errors caused by noise or
software faults.
◦ Optional command timeout (shut off motors if communication ceases).
Serial features:
◦ Controllable from a computer via serial commands sent to the device’s USB virtual
serial (COM) port, or via TTL serial through the device’s RX/TX pins.
◦ TTL serial uses 0 V and 3.3 V on TX, accepts 0 V to 5 V on RX.
◦ Supports automatic baud rate detection from 1200 bps to 500 kbps, or can be
configured to run at a fixed baud rate.
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
1. Overview Page 6 of 143
◦ Supports standard compact and Pololu protocols as well as the Scott Edwards
Mini SSC protocol and an ASCII protocol for simple serial control from a terminal
program.
◦ Optional serial response delay for communicating with half-duplex controllers such
as the Basic Stamp.
◦ Controllers can be easily chained together and to other Pololu serial motor and
servo controllers to control hundreds of motors using a single serial line.
I²C features:
◦ Compatible with I²C bus voltage levels from 1.8 V to 5 V.
USB features:
◦ Full-speed USB interface (12 Mbps)
◦ Example code in C#, Visual Basic .NET, and Visual C++ is available in the Pololu
USB Software Development Kit [https://www.pololu.com/docs/0J41]
RC features:
◦ 1/4 µs pulse measurement resolution.
◦ Works with RC pulse frequencies from 10 to 333 Hz.
◦ Configurable parameters for determining what constitutes an acceptable RC signal.
◦ Two RC channels allow for single-stick (mixed) motor control, making it easy to use
two simple motor controllers in tandem on an RC-controlled differential-drive robot.
◦ RC channels can be used in any mode as limit or kill switches (e.g. use an RC
receiver to trigger a kill switch on your autonomous robot).
◦ Battery elimination circuit (BEC) jumper can power the RC receiver with 5 V or 3.3 V.
Analog features:
◦ 0.8 mV (12-bit) measurement resolution.
◦ Works with 0 to 3.3 V inputs.
◦ Optional potentiometer/joystick disconnect detection.
◦ Two analog channels allow for single-stick (mixed) motor control, making it easy to
use two simple motor controllers in tandem on a joystick-controlled differential-drive
robot.
◦ Analog channels can be used in any mode as limit or kill switches.
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
1. Overview Page 7 of 143
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
Note: This guide only applies to the G2 Simple Motor Controllers, which have blue circuit
boards. If you have one of the first-generation Simple Motor Controllers, which have
green circuit boards, you can find their user’s guide here [https://www.pololu.com/docs/0J44].
Warning: Take proper safety precautions when using high-power electronics. Make sure
you know what you are doing when using high voltages or currents! During normal
operation, this product can get hot enough to burn you. Take care when handling this
product or other components connected to it.
1.1. 18v15 and 24v12 included hardware
High-Power Simple Motor Controller G2
18v15 with included hardware.
High-Power Simple Motor Controller G2
18v15 with connectors soldered.
High-Power Simple Motor Controller G2
24v12 with included hardware.
High-Power Simple Motor Controller G2
24v12 with connectors soldered.
1. Overview Page 8 of 143
Dimension diagram [https://www.pololu.com/file/0J1600/pololu-smc-
g2-18v15-or-24v12-dimensions.pdf] (424k pdf)
3D model [https://www.pololu.com/file/0J1602/pololu-smc-g2-18v15-or-24v12.step] (12MB step)
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
High-Power Simple Motor Controller G2 18v15 or 24v12,
Pinout diagram of the High-Power Simple Motor Controller G2 18v15 or 24v12.
bottom view with dimensions.
The 18v15 and 24v12 versions are available with connectors included but not soldered in or with the
connectors pre-installed.
The terminal blocks are only rated for 16 A, so for higher-power applications, we recommend soldering
thick wires directly to the board.
These files provide further documentation of the hardware design of the Simple Motor Controller G2
18v15 and 24v12:
1. Overview Page 9 of 143
Drill guide [https://www.pololu.com/file/0J1601/umc08a-drill.dxf] (100k dxf)
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
1.2. 18v25 and 24v19 included hardware
High-Power Simple Motor Controller G2
18v25 with included hardware.
High-Power Simple Motor Controller G2
18v25 with connectors soldered.
High-Power Simple Motor Controller G2
24v19 with included hardware.
High-Power Simple Motor Controller G2
24v19 with connectors soldered.
High-Power Simple Motor Controller G2
18v25, bottom view with dimensions.
1. Overview Page 10 of 143
High-Power Simple Motor Controller G2
24v19, bottom view with dimensions.
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
Pinout diagram of the High-Power Simple Motor Controller G2 18v25 or 24v19.
The 18v25 and 24v19 versions come with connectors included but not soldered.
The terminal blocks are only rated for 16 A, so for higher-power applications, we recommend soldering
thick wires directly to the board.
High-Power Simple Motor Controller G2 18v25 or 24v19
1. Overview Page 11 of 143
with thick wires soldered.
Dimension diagram [https://www.pololu.com/file/0J1603/pololu-smc-
g2-18v25-or-24v19-dimensions.pdf] (379k pdf)
3D model [https://www.pololu.com/file/0J1605/pololu-smc-g2-18v25-or-24v19.step] (12MB step)
Drill guide [https://www.pololu.com/file/0J1604/umc07a-drill.dxf] (102k dxf)
• The Simple Motor Controller G2 uses a USB Micro-B connector (the original controllers used
Mini-B).
• The through-hole capacitors have been replaced with SMT capacitors.
• The SMC G2 18v15 and 24v12 boards have the same size and nearly the same layout as
the original SMC 18v15 and 24v12. An SCL pin was added.
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
These files provide further documentation of the hardware design of the Simple Motor Controller G2
18v25 and 24v19:
1.3. Supported operating systems
The Simple Motor Controller G2 configuration software works on Windows 7, Windows 8, and
Windows 10.
We do not currently provide configuration software for Linux or macOS, but Section 8.6 has some
example code for controlling the Simple Motor Controller via its USB serial port from Linux or macOS.
1.4. Comparison to the original Simple Motor Controllers
This section lists most of the things you should consider if you have an existing application using the
original Simple Motor Controller controller (green board) and are considering upgrading to a Simple
Motor Controller G2 (blue board).
Motor driver changes
The G2 Simple Motor Controllers have configurable hardware current limiting: when the motor current
exceeds a configurable threshold, the motor driver uses current chopping to actively limit it. The
current limit threshold can be configured ahead of time, and can also be changed dynamically via
serial, I²C, or USB. The SMC G2 can also measure the current being drawn by the motor.
The G2 Simple Motor Controllers do not support variable braking. Instead, they can either do full
braking or full coasting when the speed is zero.
Physical connection changes
You need to keep some things in mind when updating the physical connections of an existing
application:
1. Overview Page 12 of 143
• The SMC G2 18v25 and 24v19 are significantly smaller than the original SMC 18v25 and
24v23, and the motor/power connections are different. Two SCL pins were added, but
otherwise the control I/O pins are the same.
• The Simple Motor Controller G2 uses different configuration software from the original Simple
Motor Controllers.
• We do not currently provide a Linux version of the SMC G2 configuration software.
• The Simple Motor Controller G2 serial protocol is generally a superset of the original serial
protocol, so in many cases, serial interface software running on a microcontroller or computer
(using the controller’s RX and TX lines or its virtual USB serial ports) will not need to be
modified to work with the Simple Motor Controller G2.
• The Simple Motor Controller G2 native USB interface uses different product IDs and a
different arrangement of settings in memory. One command was added (Set current limit).
Most of the commands remain unchanged.
• Since the Simple Motor Controller G2 does not have variable braking, any “Motor brake”
command received via serial or I²C that specifies a non-zero brake amount will be interpreted
as a request for full braking. This also applies to the USB “Set speed” command.
• The SMC G2 boards have reverse voltage protection.
• The SMC G2’s new I²C interface provides another option for connecting to a microcontroller.
• The SMC G2 can be configured to send CRC bytes for serial responses without requiring
them on serial commands.
• The SMC G2’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 USB serial ports will work on
Windows 10 or later without drivers.)
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
Configuration and software changes
There are several changes to keep in mind when configuring the Simple Motor Controller G2 or
updating any software that communicates with it:
New features
1. Overview Page 13 of 143
Pololu Simple Motor Controller G2 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 G2 Simple 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 14 of 143
1. Download the Simple Motor Controller G2 Software and Drivers for Windows
[https://www.pololu.com/file/0J1599/smc-g2-1.0.0-windows.zip] (550k zip)
2. Open the ZIP archive and run setup.exe. The installer will guide you through the steps
required to install the Simple Motor Control Center G2, the Simple Motor Controller G2
command-line utility (smcg2cmd), and the Simple Motor Controller drivers on your computer.
If the installer fails, you might have to extract all the files to a temporary directory, right click
setup.exe, and select “Run as administrator”.
3. During the installation, Windows will ask you if you want to install the drivers. Click “Install” to
proceed.
4. After the installation has completed, plug the Simple Motor Controller G2 into your computer
via USB. Windows should recognize the controller and load the drivers that you just installed.
5. Open your Start Menu and search for “G2”. Select the “Simple Motor Control Center G2”
shortcut (in the Pololu folder) to launch the software.
6. In the upper left corner of the window, where it says “Connected to:”, make sure that it shows
something like “18v25 #33FF-7006-4D4B-3731-4818-1543”. This indicates the version and
serial number of the controller that the software has connected to. If it says “Not connected”,
see the troubleshooting section below.
• The Simple Motor Control Center G2 is a graphical user interface (GUI) for configuring the
controller, 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 Simple Motor Controller G2 Command-line Utility (smcg2cmd) 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 smcg2cmd with no arguments to see a summary of its options.
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
3. Getting started
3.1. Installing Windows drivers and software
To install the drivers for the Simple Motor Controller G2 on a computer running Microsoft Windows,
follow these steps:
The SMC G2’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 USB serial ports will work
The Simple Motor Controller G2 software consists of two programs:
3. Getting started Page 15 of 143
on Windows 10 or later without drivers.
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
USB troubleshooting for Windows
If the Simple Motor Controller G2 software cannot connect to your controller after you plug it into the
computer via USB, the tips here can help you troubleshoot the SMC’s USB connection.
If you are using the Simple Motor Control Center G2, 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 Simple Motor Controller G2 (blue board). The G2 software does not work with
the original Simple Motor Controllers (green boards). 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 Simple Motor Controller G2. The original Simple
Motor Control Center does not work with the SMC G2. The SMC G2 controllers have new USB product
IDs. Third-party software for the older controllers might need to be updated, depending on how the
software works. If you are a developer of such software, see Section 1.4.
If you have connected any electronic devices to your Simple Motor Controller besides the USB cable,
you should disconnect them.
You should look at the LEDs of the Simple Motor Controller. If the LEDs are off, then the controller
is probably not receiving power from the USB port. If the green LED is flashing very briefly once per
second, then the controller 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
controller to your computer via a USB hub, try connecting it directly.
If the controller’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 controller 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 Simple Motor Controller. Be sure to look in these categories: “Other devices”, “Ports (COM &
LPT)”, and “Universal Serial Bus devices”.
If the driver for the Simple Motor Controller’s native USB interface is working, you should see an entry
in the “Universal Serial Bus devices” category named something like “Pololu High-Power Simple Motor
Controller G2 18v15” (or the corresponding name if you have a different version).
If the drivers for the Simple Motor Controller’s USB serial ports are working, you should see an entry in
the “Ports (COM & LPT)” category named something like “Pololu High-Power Simple Motor Controller
3. Getting started Page 16 of 143
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
G2 18v15 Command Port”. The serial port might be named “USB Serial Device” instead if you are
using Windows 10 or later and you plugged the controller into your computer before installing our
drivers for it. The generic name in the Device Manager will not prevent you from using the port, but
we recommend fixing the name 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.
If any of the entries for the Simple Motor Controller 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 Simple Motor Controller 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 controller. 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 Simple Motor Controller from USB and then removing any
entries you see for Simple Motor Controller by right-clicking on them and selecting “Uninstall”. Do not
check the checkbox that says “Delete the driver software for this device”.
3. Getting started Page 17 of 143
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
Windows 10 Device Manager showing the Simple Motor Controller G2.
3.2. Understanding the control center Status tab
After installing the software for the Simple Motor Controller G2, it is a good idea to run the Simple
Motor Control Center G2 software and look at the Status tab. The Status tab lets you monitor the
status of your motor controller in real time and control the speed of the motor. The Status tab also
shows what errors and limits are affecting your motor controller so it can help you quickly troubleshoot
any issues you are having.
To use the Status tab, you should connect your Simple Motor Controller to your PC using a USB cable
(not included) and run the Pololu Simple Motor Control Center. This is what the Status tab should
look like initially, before you have modified any settings or connected anything to the Simple Motor
Controller (besides USB):
3. Getting started Page 18 of 143
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
The Status tab in the Simple Motor Control Center G2 should look like this when you first
connect the controller to the PC.
Target speed and current speed
The Target speed is the speed that the motor controller is trying to achieve. The target speed source
is determined by the settings in the “Input settings” tab, and can come from serial/I²C/USB commands,
analog voltages, or RC signals.
The Current speed is the speed at which the controller is currently your driving your motor. There are
several reasons why the current speed might be different from the target speed: errors, acceleration
limits, deceleration limits, brake duration, maximum speed limits, starting speed limits, and gradual
temperature-based speed limiting. If any of these things are affecting the current speed, the
appropriate part of the Status tab will be highlighted to let you know. Anything that is stopping the
motor completely will be highlighted in red. Anything that is limiting the speed of the motor will be
highlighted in yellow. While hardware current limiting can affect the power delivered to the motor, it
does not affect this “current speed” reading.
3. Getting started Page 19 of 143
Valid: There is an RC or analog input connected to this channel and it is working.
Invalid (disconnected): This message is shown for analog channels when the controller
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
The Simple Motor Controller represents speeds internally as a number from -3200 (full reverse) to
3200 (full forward). However, by default the speeds in the Status Tab are displayed as percentages so
-3200 (full reverse) is shown as -100.00% and 3200 (full forward) is shown as 100.00%.
Below the Target Speed label is a two-dimensional diagram that represents the values of the inputs
that are used to set the Target Speed. This diagram is especially useful in RC or Analog mode with
Mixing enabled because it graphically shows you the value of both input channels and makes it easier
to tell how well the Simple Motor Controller is calibrated for your controller.
Motor limits
The “Motor limits” box in the Status tab shows the current values of the limits on the movement of the
motor. These limits will be equal to the hard motor limits specified in the “Motor settings” tab, unless
you have temporarily changed the motor limits using the command-line utility (smcg2cmd) or a serial/
I²C/USB command. For more information on these limits, see Section 5.2.
Current limit
The “Current limit” is displayed below the “Motor limits” box. This is the current value of the hardware
current limit.
Input channels
The “Input channels” box in the Status tab shows the current status of the RC and Analog input
channels of the device.
The Raw value is the raw, unscaled value of the input channel. For RC channels, the raw value
is the width of pulses received on the input line (RC1 or RC2). It is typically between 1000 µs and
2000 µs, and it is stored internally as an integer in units of quarter-microseconds (6000 corresponds
to 1500 µs). For analog channels, the raw value is the average voltage measured on the input line
(A1 or A2). It is always between 0 mV and 3300 mV, and it is stored internally as a 12-bit integer (0
corresponds to 0 mV while 4095 corresponds to 3300 mV).
The Scaled value is a number between −3200 and 3200 that is determined entirely by the raw value
and the scaling parameters in the “Input settings” tab. If the scaling parameters are set up correctly,
then the scaled value should be 0 when the input is in its neutral position (if it has a neutral position),
and they should be ±100 % (±3200 internally) when the input is moved to either extreme.
The Status column summarizes the state of each channel. Here are the different things you might see
in this column:
3. Getting started Page 20 of 143
detects that they are disconnected. If you do not intend to use this channel, you do not need
to worry about this message. Otherwise, to correct this situation, make sure that all three pins
of your potentiometer or analog joystick are connected correctly to the three analog interface
pins (see Section 4.6). The controller toggles the power supply on the Analog + pins in order
to detect when your potentiometer is disconnected. This feature can be turned off in the
Advanced tab, in which case you will not see the “Invalid (disconnected)” message.
Invalid signal: This message is shown for RC channels when the controller detects no signal
or a bad signal on the RC input. If you do not intend to use this channel, you do not need
to worry about this message. Otherwise, to correct this situation, make sure that your RC
receiver is powered and connected correctly (see Section 4.5), and check your RC pulse
detection settings in the “Advanced settings” tab.
Invalid (too high) and Invalid (too low): These messages are shown for analog channels
when the voltage read on the A1 or A2 pin is outside of the normal range, as specified by the
“Error min” and “Error max” parameters for that channel in the “Input settings” tab. To correct
this error, you can re-configure the range of your analog input by clicking the “Learn…” button
for that channel, or you can manually adjust the scaling parameters.
Invalid (high signal) and Invalid (low signal): These messages are shown for RC channels
when the pulse width measured on the RC1 or RC2 pin is outside of the normal range as
specified by the “Error min” and “Error max” parameters for that channel in the “Input settings”
tab. To correct this error, you can re-configure the range of your RC input by clicking the
“Learn…” button for that channel, or you can manually adjust the scaling parameters.
VIN: This is the voltage of your power supply, measured on the VIN line. When your power
supply is disconnected, this should read 0.0 V. This reading is continually compared to the
VIN thresholds in the Advanced Settings tab and will generate an error and shut down the
motor if it passes these thresholds. This allows a properly configured controller to avoid over-
discharging your batteries.
Temperature A and Temperature B: These are measurements of the temperature of two
different points on the circuit board. These readings are used prevent damage to the device
by shutting down the motor when the board gets too hot (the over-temperature threshold is
can be adjusted in the “Advanced settings” tab). Please note that this product can get hot
enough to burn you during normal operation. Take care when handling this product or other
components connected to it. Parts of the board can be significantly hotter than this reading,
so you should not rely on this temperature reading when deciding whether it is safe to touch
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
Conditions
The Conditions box in the Status tab shows miscellaneous information about the current state of the
controller:
3. Getting started Page 21 of 143
the board.
Up time: This is the total amount of time that the controller has been running since its last
reset or power-up. The up time reading can be used to help identify if the controller has reset
unexpectedly. You can determine the cause of a reset by looking at the pattern of the yellow
LED (see Section 3.5), or you can look in the Device Information window, available from the
Device menu. The “Up time” reading will overflow back to zero after 49.7 days.
Baud rate: This is the current baud rate that the device is using on the TTL serial interface
(RX and TX lines) in units of bits per second (bps). By default, the device is configured to
auto-detect the baud rate, so this value will be “N/A” until the baud rate is detected. After a
0xAA byte is received on the RX line, the device will detect the baud rate and you can see it
here. Please note that the baud rate display in the Status tab has nothing to do with the USB
virtual COM port; it doesn’t matter what baud rate you use when connecting to the virtual
COM port.
RC period: This is the period of the RC signal on the RC1 input channel. You can use this
reading to help you make the RC period settings in the “Advanced settings” tab more strict
so that the controller can better identify bad RC signals. If the signal on RC1 is invalid, this
reading is reported as “N/A”.
Current: This is a measurement of the current going through the motor.
Cur. lim. count: This is short for “Current limit count”, and it reports how many times the
controller has detected that the hardware current limiting activated in order to limit the current
through the motor. You can clear this count by opening the “Device” menu and selecting
“Clear counts”.
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
Manually set speed (Serial/USB mode only)
The “Manually set speed” box
in Status tab allows you to
control the speed of your motor
over USB by using a scrollbar
or by typing in a speed. To use
this feature, the input mode (configured in the “Input settings” tab) must be USB/Serial, and there must
be no errors currently stopping the motor. You will need to press the Resume button if you have not
disabled safe start or if you previously pressed the “Stop motor” button.
3.3. Errors
3. Getting started Page 22 of 143
• Checking the Errors box in the Status tab of the Simple Motor Control Center. This is
recommended because it gives you the most information, including a running count of how
many times the error has been reported.
• Running the command-line utility (just type smcg2cmd -s at the command line).
• Looking at the red LED on the device. It will be lit if there are any errors stopping your motor.
• Writing PC software or using a microcontroller to send the “Get errors” serial/I²C command.
• Using a microcontroller to measure the voltage on ERR pin. This pin is linked to the red
LED so it should go high (3.3 V) when there is an error stopping your motor and low (0 V)
otherwise.
Safe start violation: Safe start is a feature that helps prevent the motor from starting up
unexpectedly. This feature is enabled by default, but can be disabled in the “Advanced
settings” tab. The behavior of safe start depends on what input mode you are using.
In Serial/USB input mode, the safe start violation error occurs whenever any other error is
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
The Simple Motor Controller G2 has
several features that stop the motor when
something is going wrong. These are
called errors, and they can help protect
your project from damaging itself.
Whenever you are having an issue with
the controller, you should first check to
see what (if any) errors are occurring.
You can get information about the errors
by:
The Errors box in the Status tab of the Simple Motor
Control Center G2 shows problems that are stopping
your motor.
All the errors are explained below:
3. Getting started Page 23 of 143
stopping the motor. After all the other errors have been fixed, you can clear the safe start
violation error by pressing the Resume button (which issues a native USB command) or using
a serial command.
In Analog or RC input mode, the safe start violation error occurs whenever the motor is
stopped because of an error AND the inputs that control the speed of the motor are not
near their neutral positions. This helps prevent the situation where there might be an error
stopping your motor (such as a disconnected battery), and the motor starts running at a high
speed when you fix the error. To clear the safe start violation error, move all the inputs that
control the speed of the motor to their neutral positions (the sum of the absolute values of
their scaled values must be less than 8%).
Required channel invalid: This error occurs whenever any required RC or analog channel
is invalid. This error helps ensure that your motor will stop if you accidentally disconnect your
joystick, potentiometer or RC receiver. A channel is invalid if it is disconnected, or has a
value that is out of range. A channel is required if it controls the speed of the motor or it is
configured as a limit switch or kill switch. By default, there are no required channels because
the input mode is serial and no limit or kill switches have been configured. You can check
the “Input settings” tab to see which channels are required. Channels that are required and
invalid are highlighted in red in the “Input channels” box of the Status tab so you can quickly
see which channel is causing this error.
Command timeout: This error occurs if you are controlling your motor using a
microcontroller or a PC (input mode is Serial/USB) and the (configurable) time period has
elapsed with no valid serial, I²C, or USB commands being received by the controller. The
purpose of this error is to ensure that your motor will stop if the software talking to the
controller crashes or if the communications link is broken. All valid serial and I²C commands
clear this error. The native USB commands for setting the speed and exiting safe start also
clear this error. By default, this error is disabled, but it can be enabled from the “Advanced
settings” tab by setting a non-zero command timeout value.
Limit/kill switch: This error occurs when a limit or kill switch channel stops the motor. More
specifically, it occurs in three cases: when a kill switch is active, when a forward limit switch
is active AND the target speed is positive, or when a reverse limit switch is active AND the
target speed is negative. A limit/kill switch is considered active if its scaled value is above
50 %. If you are using a limit switch and your input mode is Serial/USB, you will need to check
the Count column in the Status tab to see this error because in Serial/USB mode the Target
Speed gets set to 0 whenever there is an error.
Low VIN: This error occurs whenever your power supply’s voltage is too low or it is
disconnected. If you set the correct thresholds in the “Advanced settings” tab, this error will
prevent you from over-discharging your battery.
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
3. Getting started Page 24 of 143
High VIN: This error occurs whenever your power supply’s voltage is too high. You can set
the threshold voltage in the “Advanced settings” tab.
Motor driver error: This error occurs whenever the motor driver chip reports an under-
voltage, over-current, or over-temperature error.
Over temperature: This error occurs whenever a reading from one of the temperature
sensors is too high. You can see the temperature readings in the “Conditions” box of the
Status tab. The behavior of this error and the threshold temperatures can be configured in
the “Advanced settings” tab.
ERR line high: This error occurs whenever there are no other errors but the voltage on the
ERR line is high (2.3 V to 5 V). This error allows you to connect the error lines of two Simple
Motor Controllers together and have both of them stop when either one experiences an error.
This error can be disabled in the Advanced Settings tab.
Serial errors: Serial errors are recorded whenever something goes wrong with the serial
or I²C communication, either on the TX/RX/SDA/SCL lines or on the USB virtual COM port.
If the input mode is Serial/USB, then a serial error will stop the motor from running until a
valid serial command is received, or the Resume button is pressed, or the native USB “Set
speed” or “Exit safe start” commands are sent. If you are using serial and have not disabled
safe start mode, you will need to send the “Exit safe-start” command followed by a “Set
speed” command to recover from an error and get the motor running again. If you are using
serial and have disabled safe start, the motor will start driving as soon as a valid “Set speed”
command is received. These are the types of serial errors that are recorded:
Frame: This is error occurs when a de-synchronization or excessive noise on the
RX line is detected.
Noise: This error occurs when noise is detected on the RX line.
RX overrun: This error occurs when the buffer for storing bytes received on the
RX line is full and data was lost as a result. This should not occur during normal
operation.
Format: This error occurs if the serial or I²C bytes received do not obey the protocol
specified in this guide. If you get this error, check the bytes you are sending
carefully, and compare them to the examples provided.
CRC: This error occurs if you have enabled cyclic redundancy check (CRC) for
serial commands, but the CRC byte received was invalid. CRC helps prevent the
motor controller from accidentally performing unwanted actions when it is receiving
commands over a noisy serial link. If you get this error, check your algorithm for
calculating CRCs and check the quality of your serial signal at the RX pin.
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
The count that is displayed next to each error in the Simple Motor Control Center G2 indicates how
3. Getting started Page 25 of 143
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
many times the occurrence of the error has been reported. You can clear these counts by opening the
“Device” menu and selecting “Clear counts”.
3.5. LED feedback
The Simple Motor Controller G2 has three indicator LEDs that provide feedback about the current state
of the controller. The LEDs can tell you whether an error is occurring, whether the USB connection is
active, what direction the motor is driving, and much more.
High-Power Simple Motor Controller G2 18v15 or 24v12
High-Power Simple Motor Controller G2 18v25
LEDs.
or 24v19 LEDs.
Green USB LED
This LED indicates the USB status of the device. When the controller is not connected to a computer
via the USB cable, the green LED will always be off. When you connect the controller to USB,
the green LED starts blinking slowly. The blinking continues until the controller receives a particular
3. Getting started Page 26 of 143
• 8 blinks over the first two seconds after start-up indicates that the external RST pin was
driven low to reset the controller.
• 3 blinks over the first two seconds after start-up indicates that the controller last reset
because logic power got too low (power was disconnected or the controller browned out).
• Rapid flickering for the first two seconds after start-up indicates that the controller was reset
by a software fault or by a firmware upgrade.
• An even blinking pattern of on for 2/3 s and off for 2/3 s indicates that the controller is not
driving the motor and has not yet detected the baud rate. This pattern only occurs when
the controller is in USB/serial mode with automatic baud detection enabled and helps you
determine when you have established communication between a TTL serial source and the
Simple Motor Controller.
• A brief flash once per second indicates that the controller is not driving the motor. If the
controller is in Serial/USB mode with automatic baud detection enabled, this pattern
additionally indicates that the Simple Motor Controller has successfully learned the TTL serial
baud rate.
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
message from the computer indicating that the controller’s USB drivers are installed correctly (see
Section 3.1 for driver installation instructions). After the controller gets this message, the green LED
turns solidly on, except for brief flickers whenever there is USB activity. The Simple Motor Control
Center G2 software constantly streams data from the controller, so when the control center is running
and connected to the Simple Motor Controller, the green LED will flicker constantly.
Red Error LED
This LED turns on whenever there is an error stopping the motor (see Section 3.3). The red LED is
tied directly to the active-high output ERR, which allows the error status to be monitored by an external
device such as a microcontroller. When no errors are stopping the motor, the error LED is off and the
ERR pin is pulled low. See Section 4.3 for more information about the ERR pin and the error LED.
Yellow Status LED
This LED helps you visually identify the state of the device, which can be useful when the controller
is not connected to the Control Center. On start-up, the status LED briefly flashes a pattern indicating
the source of the last reset (see the Reset Flags variable in Section 6.4 for more information):
This startup behavior can help you detect if your Simple Motor Controller is browning out and resetting
unexpectedly (as can happen if your input voltage drops due to high power demands or electrical
noise).
After the start-up phase ends, the status LED primarily gives feedback about the motor driver outputs:
3. Getting started Page 27 of 143
• A repeating, gradual increase in brightness every second indicates that the controller is
driving the motor forward.
• A repeating, gradual decrease in brightness every second indicates that the controller is
driving the motor in reverse.
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
3. Getting started Page 28 of 143
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
4. Connecting your motor controller
This chapter explains all the electrical connections you might need to make to get your Simple Motor
Controller G2 working.
The diagrams below label the key components and pins on the Simple Motor Controllers. Most of
these pins are also labeled on the bottom side of the board.
High-Power Simple Motor Controller G2 18v15 and 24v12 pinout
High-Power Simple Motor Controller G2 18v25 and 24v19 pinout
4. Connecting your motor controller Page 29 of 143
Pololu Simple Motor Controller G2 User’s Guide © 2001–2019 Pololu Corporation
4.1. Connecting power and a motor
Warning: Take proper safety precautions when using high-power electronics. Make sure
you know what you are doing when using high voltages or currents! During normal
operation, this product can get hot enough to burn you. Take care when handling this
product or other components connected to it.
The first step in using your Simple Motor Controller is connecting power and a motor. With those
connections in place, you can immediately start testing with the Simple Motor Control Center G2
software. The following section explains the power system in detail.
4. Connecting your motor controller Page 30 of 143
Loading...
+ 113 hidden pages