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:...
Page 7
◦ 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.
Page 9
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: •...
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.
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.
Page 23
You can get information about the errors The Errors box in the Status tab of the Simple Motor Control Center G2 shows problems that are stopping your motor. • 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.
Page 25
If you get this error, check your algorithm for calculating CRCs and check the quality of your serial signal at the RX pin. The count that is displayed next to each error in the Simple Motor Control Center G2 indicates how 3. Getting started...
“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.
Page 27
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.
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.
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.
Page 31
USB is connected. It is OK to have both USB and VIN power simultaneously connected. All Simple Motor Controller G2 versions can operate from VIN supplies as low as 6.5 V. The maximum power ratings for the G2 Simple Motor Controllers are shown below: 4.
Page 32
Finally, make sure you select a power source that is capable of delivering the current your motor will require (e.g. alkaline cells are typically poor choices for high-current applications). The Simple Motor Controller G2 features a configurable low-voltage shutoff that can help you avoid damaging batteries that are sensitive to over-discharging, such as Li-Po packs.
Trying out the controller with USB Once you have a connected a power supply and a motor, you can use the Simple Motor Control Center G2 to make the motor move and test how various settings affect the behavior of the motor (see Section 5 for more information on configuring the Simple Motor Controller G2).
Page 37
RC section. Your serial or I²C device must share a common ground with the Simple Motor Controller G2. The VM pin provides access to the board’s reverse-protected motor power. The voltage on this pin is not regulated;...
Page 38
The TX pin is protected by a 220Ω series resistor. The SCL pin acts as the I²C clock signal. The Simple Motor Controller G2 uses a feature of I²C called clock stretching, which means that it will briefly drive this line low while handling I²C transfers. When I²C is disabled, which is the default, this pin acts as a secondary TX pin that ignores the TXIN input.
TXIN and TX pins. 4.3. Connecting a serial device The RX, TX, and TXIN pins on the Simple Motor Controller G2 can be used to communicate with devices with logic-level (TTL) serial interfaces, such as microcontrollers or USB-to-serial adapters. The Simple Motor Controller uses 3.3V logic, but the RX and TXIN inputs 5V-tolerant, which means that the Simple Motor Controller can be used directly with a microcontroller running at 5 V as long as that microcontroller is guaranteed to read the 3.3 V signal from TX as high.
Page 40
Motor Controller G2 can permanently damage it. All you need to control the Simple Motor Controller G2 with a microcontroller is a connection between the microcontroller’s TTL serial transmit pin and the Simple Motor Controller G2’s RX pin. If you want to get feedback from the controller, you can connect the TX pin to the microcontroller’s TTL serial...
You will need to connect the SCL pin of your master device to the SCL pin of the Simple Motor Controller G2, and connect the SDA pin of the master device to the SDA pin of the Simple Motor Controller G2. (On the 18v25 and 24v19, you can use either of the two SCL pins.) To control multiple devices, connect all the SCL pins together and connect all the SDA pins together.
A BEC jumper lets the Simple Motor Controller G2 optionally power your RC receiver at 3.3 V or 5 V, eliminating the need for a second battery.
Page 43
Note: If you want to connect servos directly to your RC receiver, you must power it separately as the Simple Motor Controller G2 regulators cannot supply enough current to power a servo. If your RC receiver is powered separately, you must leave the BEC jumper off to avoid shorting the motor controller’s regulated voltage to your RC receiver’s power...
Page 44
We recommend your first step after connecting your RC receiver be to use the Quick Input Setup Wizard in the Simple Motor Control Center G2. The wizard instructs you to move your transmitter control sticks to their extremes and maps stick full forward/right to the maximum forward motor speed, the neutral stick to speed zero, and the stick full back/left to maximum reverse speed.
Page 45
As demonstrated above, using both RC channels in mixing mode makes it possible to combine two RC-controlled G2 Simple Motor Controllers to achieve single-stick (mixed) control of a differential drive robot. The following diagram shows how to connect two such motor controllers together: Wiring diagram for pairing two Simple Motor Controllers with RC channel mixing.
4.6. Connecting a potentiometer or analog joystick Simple Motor Controller G2 can be directly connected to a 0 V to 3.3 V analog voltage source, such as a potentiometer or analog joystick, allowing for simple manual motor control (e.g. easily control motor speed with a knob).
Page 48
We recommend your first step after connecting your analog voltage source be to use Quick Input Setup Wizard in the Simple Motor Control Center G2. The wizard instructs you to move your inputs to their extremes and maps one extreme to the maximum forward motor speed, the neutral position to speed zero, and the other extreme to maximum reverse speed.
Page 49
As demonstrated above, using both analog channels in mixing mode makes it possible to combine two joystick-controlled G2 Simple Motor Controllers to achieve single-stick (mixed) control of a differential drive robot. The connection diagram for such a setup would be very similar to the RC-mixing diagram...
5.1. Input settings The “Input settings” tab of the Simple Motor Control Center G2 allows you to quickly specify how you want to control the speed of the motor, and also allows you to set up limit and kill switches.
Page 53
The primary use of mixing is for controlling a motor on a differential drive robot. You can use one G2 Simple Motor Controller for each motor on the robot, and feed the same inputs into both of them. We recommend connecting the throttle (forward/reverse) input to channel 1, and the steering (left/right) input to channel 2.
Wizard will walk you through the steps needed to calibrate your switch’s scaling parameters. 5.2. Motor settings The “Motor settings” tab of the Simple Motor Control Center G2 allows you to set up limits to protect your system and lets you specify the details of how your motor should be driven.
Page 60
Internally, the current limit setting has a value between 0 and 3200 and uses internal units. The Simple Motor Control Center G2 software lets you enter the desired current limit in Amps, and converts to the internal units for you. However, if you want to set the current limit using the “Set current limit” serial/I²C command, you will need to do that conversion yourself by following these steps: 1.
Page 61
2. Multiply this number by the following number, which depends on the Simple Motor Controller G2 model: 2 for the 18v15, 3 for the 24v12, 1 for the 18v25, or 2 for the 24v19. 3. Divide by the current scale calibration setting (8057 by default).
5.3. Advanced settings The “Advanced settings” tab of the Simple Motor Control Center G2 lets you fine-tune the details of how your Simple Motor Controller G2 behaves. Advanced settings tab in the Pololu Simple Motor Control Center G2.
Page 63
Over-temperature response The Simple Motor Controller G2 monitors the temperature of the board at two points near the MOSFETs and protects itself from burning up by generating an error when the temperature is too high.
Section 3.3. 5.4. Upgrading firmware The Simple Motor Controller G2 has field-upgradeable firmware that can be easily updated when we release bug fixes or new features. We have not released any firmware upgrades yet. 5. Configuring your motor controller Page 65 of 143...
Serial/USB. In any input mode, you can use these interfaces to request information about the motor controller’s state and monitor the RC and analog channel inputs. The Simple Motor Controller G2 treats each interface independently, so it is OK to use the USB serial port while simultaneously using TTL serial or I²C.
Page 67
“non-inverted” serial. The byte is terminated by a “stop bit”, which is the line going high for at least one bit time. The Simple Motor Controller G2 supports fixed baud rates of 1099 bps to 2 Mbps and can automatically detect baud rates up to 500 kbps in auto-detect baud rate mode.
Page 68
I²C The Simple Motor Controller G2’s I²C interface consists of its SDA pin and its SCL pin. The SDA pin is the same physical pin as the RX pin, and the SCL pin is linked to the TX pin, so you cannot use serial and I²C at the same time.
6.1. Serial and I²C settings The behavior of the Simple Motor Controller G2’s USB virtual serial port, TTL serial port, and I²C interfaces is determined by a number of settings, almost all of which can be found under the “Input settings”...
Page 70
“Binary”; the fixed baud rate option is automatically selected when the serial mode is “ASCII”. • Fixed baud rate: In this mode, the Simple Motor Controller G2 will only respond to TTL serial 6. Using the serial and I²C interfaces...
RX overrun error will be generated). Enabling the Delay TTL serial responses feature causes the Simple Motor Controller G2 to wait for approximately 4 ms before transmitting a TTL serial response. This is useful when interfacing with devices like the Basic Stamp that use half-duplex UARTs and need time to switch from transmit mode to receive mode.
Page 72
Compact Protocol In general, this is the protocol that you should use if a single Simple Motor Controller G2 is the only device that will receive the bytes in your command packets (which is always the case if you are using the I²C or virtual USB serial port).
Page 73
To use the Pololu protocol, you must transmit 0xAA (170 in decimal) as the first (command) byte, followed by a device number data byte. The default device number for the Simple Motor Controller is 0x0D (13 in decimal), but this is a setting you can change.
Page 74
The device number byte and speed byte can be any value except 255, though the Simple Motor Control Center G2 will not let you set the controller’s device number to a value greater than 127. If the device number byte matches the motor controller’s device number or if the device number byte is 254, the motor controller will respond to the command (all controllers respond to Mini SSC commands addressed to Device Number 254).
Page 83
The limit values set with this command persist only until the controller is next reset or the “Apply settings” button is next clicked in the Simple Motor Control Center G2, at which point the temporary limit settings are all reinitialized to the hard limit settings.
Page 84
1 must be the remainder of 500/128, or 116, and limit byte 2 must be the quotient of 500/128, or 3. Therefore, we can send the following compact protocol bytes and wait until we have received one byte in response from the Simple Motor Controller G2: We send:...
Page 85
The current limit set with this command persists only until the controller is next reset or the “Apply settings” button is next clicked in the Simple Motor Control Center G2, at which point the current limit is reinitialized to the value stored in the settings.
Page 86
The first two bytes of the response are the low and high bytes of the product ID (each Simple Motor Controller G2 version has a unique product ID), and the last two bytes of the response are the firmware minor and major version numbers in...
ASCII characters. This mode makes it easy to interact with the Simple Motor Controller G2 through a terminal program, such as Tera Term, and it can provide a more intuitive interface for users who would rather deal with character strings than bits and bytes.
Page 88
(base 10) value, but an “H” can be appended to the end of the string to tell the Simple Motor Controller G2 to interpret it as a hexadecimal (base 16, or hex) value. For example, you can represent an argument value of 127 with “127”...
Page 89
Commands that consist only of termination characters do not result in a serial response from the Simple Motor Controller G2. All other commands, even invalid ones, cause the Simple Motor Controller G2 to respond when a termination character is received.
Page 93
“D< ><CR>” variable_id Description: This command lets you read a variable from the Simple Motor Controller G2. Section 6.4 for a list of the available variables. The value of the requested variable is transmitted as an ASCII-encoded decimal number. If...
Page 94
Section 5.2 for more information on the hard motor limits). The hard limits configured through the Simple Motor Control Center G2 are considered minimal safety requirements, and the temporary limits cannot be changed in a way that makes the controller “less safe”...
Page 95
The limit values set with this command persist only until the controller is next reset or the “Apply settings” button is next clicked in the Simple Motor Control Center G2, at which point the temporary limit settings are all reinitialized to the hard limit settings.
6.4. Controller variables The Simple Motor Controller G2 maintains a set of variables that contain real-time information about the controller’s inputs, outputs, and state. Most of these variables are all displayed in Status tab of the Simple Motor Control Center G2 software (see Section 3.2), and they can all be requested via...
Page 98
If no valid signal is detected, the raw channel value is reported as 0xFFFF (65535) and the scaled channel value is reported as 0. The Simple Motor Controller G2 is always reading the RC input channels, even when the Input Mode is not RC.
Page 99
Advanced Settings tab), the raw channel value is reported as 0xFFFF (65535) and the scaled channel value is reported as 0. The Simple Motor Controller G2 is always reading the analog input channels, even when the input mode is not “Analog”.
Page 100
Diagnostic variables The following variables can be used to monitor various internal conditions of the Simple Motor Controller G2, such as the input voltage, the board temperature, the and the motor speed. 6. Using the serial and I²C interfaces Page 100 of 143...
Page 102
5.2) every time the controller is powered up or reset and every time the “Apply settings” button is pressed in the Simple Motor Control Center G2. Most of these limits can be changed while the controller is running to impose stricter/safer limits than the hard motor limit settings (see the Set Motor Limit command in Section 6.2.1...
Cyclic redundancy checking can be enabled in the “Input settings” tab of the Simple Motor Control Center G2. If CRC is enabled for commands, the Simple Motor Controller G2 expects an extra byte to be added onto the end of every binary mode command packet (CRC error checking is not available for ASCII commands).
Page 104
For sample C code that computes the CRC byte of a command packet, see Section 8.13. The CRC implemented on the Simple Motor Controller G2 is the same as the one on the original Simple Motor Controllers, the Maestro [https://www.pololu.com/product/1352]...
This section is a guide to integrating the Simple Motor Controller G2 into a project that has multiple TTL serial devices that use a compatible protocol. First of all, you will need to decide whether to use the Pololu protocol, the Mini SSC protocol, or a mix of both (see Section 6.2).
Page 106
TX lines. The Simple Motor Controller G2 has a special input called TXIN that eliminates the need for an external AND gate (the AND gate is built in to the control.) To make a chain of devices using the TXIN input, connect them like this: Daisy chaining serial devices that have a TXIN input.
Page 107
This allows the devices to be individually addressed, and it allows responses to be sent without collisions. If the devices are configured to detect the baud rate, then when you issue your first Pololu Protocol command, the devices can automatically detect the baud from the initial 0xAA byte.
7. Writing PC software to control the Simple Motor Controller There are two ways to write PC software to control a Simple Motor Controller G2 that is connected via USB: you can use the native USB interface and the USB virtual serial port. The native USB interface provides more features than the serial port, such as the ability to change settings and select the Simple Motor Controller G2 by its serial number.
The example C code below shows how to invoke the Simple Motor Controller G2 Command-line Utility (smcg2cmd) to control a Simple Motor Controller G2 via USB. If you have multiple Simple Motor Controller G2 devices connected to your computer via USB, you will need to use the option to specify the serial number of the device you want to use.
The example Python code below shows how to invoke the Simple Motor Controller G2 Command- line Utility (smcg2cmd) to send and receive data from a Simple Motor Controller G2 via USB. It demonstrates how to set the target speed of the controller using the...
# Uses smcg2cmd to control a Simple Motor Controller G2 over USB. # Works with either Python 2 or Python 3. # NOTE: The Simple Motor Controller's input mode must be "Serial / USB".
Page 112
In the following examples, we use the SoftwareSerial library to transmit bytes on digital pin 4 and receive bytes on digital pin 3. These sample programs require the Simple Motor Controller G2 to have a fixed baud rate set to 19200 bps. It must also be in binary serial mode with the CRC disabled.
Page 114
Section 4.1), but you can see some interesting things even without a motor connected by using the Status tab of the Simple Motor Control Center G2 application to monitor the effect this sketch has on the controller’s variables (see Section 3.2).
Orangutans, so software serial is not necessary when connecting to serial devices like the Simple Motor Controller G2. In the following example programs, we use the OrangutanSerial functions from the Pololu AVR library to transmit bytes on pin PD1. In the advanced example, we use the OrangutanSerial functions to receive bytes on pin PD0, and we use the OrangutanLCD functions to report feedback obtained from the Simple Motor Controller G2.
Page 118
#include <pololu/orangutan.h> char command[3]; // These first two functions call the appropriate Pololu AVR library serial functions // depending on which Orangutan you are using. The Orangutan SVP and X2 have multiple // serial ports, so the serial functions for these devices require an extra argument // specifying which port to use.
Page 121
#define DECELERATION 2 char command[4]; // These first three functions call the appropriate Pololu AVR library serial functions // depending on which Orangutan you are using. The Orangutan SVP and X2 have multiple // serial ports, so the serial functions for these devices require an extra argument // specifying which port to use.
The example C code below uses the Windows API to communicate with the Simple Motor Controller G2 via serial. It demonstrates how to use the USB virtual serial port or the TTL serial port to get the error status from the controller, read a variable, and set the target speed.
[http://pyserial.readthedocs.io] with the Simple Motor Controller G2 via serial. It demonstrates how to read variables from the controller and set its target speed. For this example to work, the Simple Motor Controller G2’s input mode must be Serial/USB, the serial mode must be Binary, and the CRC must be disabled.
Motor Controller G2 using its USB virtual serial port. For this script to work, the Simple Motor Controller G2’s input mode must be Serial/USB, the serial mode must be Binary, and CRC must be disabled. These are the default settings that the controller is shipped with.
The example C code below uses the I²C API provided by the Linux kernel to send and receive data from a Simple Motor Controller G2. This code only works on Linux. If you are using a Raspberry Pi, please note that the Raspberry Pi’s hardware I²C module has that might cause this code to be unreliable.
The example code below uses a Python library named smbus2 to communicate with a Simple Motor Controller G2 via I²C. This example works on Linux with either Python 2 or Python 3. If you are using a Raspberry Pi, please see the notes about setting up I²C for the Raspberry Pi in Section 8.11.
Need help?
Do you have a question about the G2 and is the answer not in the manual?
Questions and answers