Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Pololu Simple Motor Controller User's Guide Page 1 of 96
Pololu Simple Motor Controller User's Guide 1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1. 18v7 Included Hardware . . . . . . . . . . . . . . . 1.2. 18v15 and 24v12 Included Hardware . . . . . . . . . 1.3. 18v25 and 24v23 Included Hardware . . . . . . . . . 2. Contacting Pololu . . . . . . . . . . . . . . . . . . . . . . . 3. Getting Started . . . . . . . . . . . . . . . . . . . . . . . . 3.1. Installing Windows Drivers and Software . . . . . . 3.2.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation 1. Overview The Pololu Simple Motor Controllers are versatile, general-purpose motor controllers for brushed, DC motors. A wide operating range of up to 5.5–40V and the ability to deliver up to several hundred Watts in a small form factor make these controllers suitable for many motor control applications.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation • 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 kHz to 22 kHz (maximum frequency is ultrasonic, eliminating switchinginduced audible motor shaft vibration).
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation • 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.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation 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. 18v7 Included Hardware Simple Motor Controller 18v7, partial kit with included hardware.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation 1.2. 18v15 and 24v12 Included Hardware Simple High-Power Motor Controller 18v15 or 24v12, partial kit with included hardware. Simple High-Power Motor Controller 18v15 or 24v12, fully assembled. Simple High-Power Motor Controller 18v15 or 24v12, partial kit with custom power and motor connectors (NOT included).
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation 1.3. 18v25 and 24v23 Included Hardware Simple High-Power Motor Controller 18v25 or 24v23 with included hardware. Simple High-Power Motor Controller 18v25 or 24v23 with included hardware installed. Simple High-Power Motor Controller 18v25 or 24v23 with custom power and motor connectors (NOT included).
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation 2. Contacting Pololu You can check the Pololu Simple Motor Controller pages [http://www.pololu.com/catalog/category/94] for additional information. The “Resources” tab on each product page contains links to this users guide as well as other valuable resources, such as drivers and the Simple Motor Control Center software.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation 3. Getting Started 3.1. Installing Windows Drivers and Software If you are using Windows XP, you will need to have Service Pack 3 [http://www.microsoft.com/downloads/ details.aspx?FamilyId=68C48DAD-BC34-40BE-8D85-6BB4F56F5110] installed before installing the drivers for the Simple Motor Controller. See below for details.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Windows XP users: Follow steps 5–9 for each new Simple Motor Controller you connect to your computer. 5. Connect the device to your computer’s USB port. The Simple Motor Controller shows up as two devices in one so your XP computer will detect both of those new devices and display the “Found New Hardware Wizard” two times. Each time the “Found New Hardware Wizard” pops up, follow steps 6-9. 6.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation 8. Windows XP will warn you again that the driver has not been tested by Microsoft and recommend that you stop the installation. Click “Continue Anyway”. 9. When you have finished the “Found New Hardware Wizard”, click “Finish”. After that, another wizard will pop up. You will see a total of two wizards when plugging in a Simple Motor Controller. Follow steps 6–9 for each wizard. 3.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation If you use Windows XP and experience problems installing or using the serial port drivers, the cause of your problems might be a bug in older versions of Microsoft’s usb-to-serial driver usbser.sys. Versions of this driver prior to version 5.1.2600.2930 will not work with the Simple Motor Controller. You can check what version of this driver you have by looking in the “Details” tab of the “Properties” window for usbser.sys in C:\Wi
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Windows Vista or Windows 7 device manager showing a Simple Motor Controller. Windows XP device manager showing a Simple Motor Controller. Some software will not allow connection to higher COM port numbers. If you need to change the COM port number assigned to your USB device, you can do so using the Device Manager. Bring up the properties dialog for the COM port and click the “Advanced…” button in the “Port Settings” tab.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation 3.2. Installing Linux Drivers and Software You can download the Pololu Simple Motor Control Center (SmcCenter) and the command-line utility (SmcCmd) for Linux here: Simple Motor Controller Linux Software [http://www.pololu.com/file/download/ smc_linux_101119.tar.gz?file_id=0J411] (115k gz). Unzip the tar/gzip archive by running “tar -xzvf” followed by the name of the file. After following the instructions in README.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation The Status tab in the Simple Motor Control Center 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/USB commands, analog voltages, or RC signals.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Motor Limits The Motor Limits box in the Status tab shows the current 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 (SmcCmd) or a serial command. For more information on these limits, see the section that documents the Motor Settings tab.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation • Temperature: This is a measurement of the temperature of the device. This reading is 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.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation 3.4. Errors The Simple Motor Controller 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.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation 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 commands clear this error. The native USB commands for setting the speed and exiting safe start also clear this error.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Simple High-Power Motor Controller 18v15 or 24v12 LEDs. Simple High-Power Motor Controller 18v25 or 24v23 LEDs. The Simple Motor Controllers have three indicator LEDs: Green USB LED This LED indicates the USB status of the device. When the Simple Motor 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.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Red Error LED This LED turns on whenever there is an error stopping the motor (see Section 3.4 for information on errors that can stop the motor). 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.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation 4. Connecting Your Motor Controller This chapter explains all the electrical connections you might need to make to get your motor controller working the way you want it to. 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. 4.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Simple High-Power Motor Controller 18v15 and 24v12 Pin-Out 4.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Simple High-Power Motor Controller 18v25 and 24v23 Pin-Out 4.
Pololu Simple Motor Controller User's Guide © 2001–2010 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.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Power Considerations The Pololu Simple Motor Controllers can be powered either from USB using a USB A to mini-B cable [http://www.pololu.com/catalog/product/130] or from a power supply, such as a battery pack, connected to the large VIN and GND pads. When the VIN supply is not present, the controller can use USB power to perform all of its functions except for driving the motor.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Motor Considerations The two terminals of your brushed, DC motor connect to the OUTA and OUTB pins. When selecting a motor for your controller (or a controller version for your motor), it is important to consider how the motor will be used in your system.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Power and Motor Connectors Simple High-Power Motor Controller 18v15 or 24v12, fully assembled. Simple High-Power Motor Controller 18v25 or 24v23 with included hardware installed. The fully-assembled 18v15 and 24v12 Simple Motor Controller versions ship with terminal blocks soldered into the large VIN, OUTA, OUTB, and GND pads and a power capacitor pre-installed, as shown in the pictures above.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation All other versions ship with terminal blocks and a power capacitor included but not installed, which provides flexibility in making connections. These versions offer two options for connecting to the high-power signals (VIN, OUTA, OUTB, GND): large holes on 0.2" centers, which are compatible with the included terminal blocks [http://www.pololu.com/catalog/ product/830], and pairs of 0.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Status tab in the Pololu Simple Motor Control Center. Before you can move the motor, you will probably need to click the green Resume button in the lower left corner to clear the safe-start violation. If the Resume button is grayed out, there are errors that are preventing the motor from moving. See Section 3.4 for information on how to identify and fix errors.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Simple High-Power Motor Controller 18v15 or 24v12 serial connections. Simple High-Power Motor Controller 18v25 or 24v23 serial connections. Serial Connections Overview The pins along the left side of the Simple Motor Controller can be used to communicate with devices with logic-level (TTL) serial interfaces, such as microcontrollers. As explained in Section 4.1, the Simple Motor Controller uses 3.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Note: You must use an inverter and level shifter such as a MAX232 or a Pololu 23201a Serial Adapter [http://www.pololu.com/catalog/product/126] if you want to interface an RS-232 device with the Simple Motor Controller. Connecting an RS-232 device directly to the Simple Motor Controller can permanently damage it.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation The ERR Pin in Detail One function of the ERR pin is to communicate that an error is preventing the motor from moving. When such an error occurs, the red error LED turns on and the ERR pin outputs 3.3 V. When there are no errors stopping the motor, the ERR pin is pulled low and the red error LED is off.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Wiring diagram for controlling multiple Simple Motor Controllers with single TTL serial source, such as a microcontroller. Inside each Simple Motor Controller, an AND gate is used to combine the input from the TXIN pin with the controller’s serial transmissions.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation speed, which makes intuitive throttle+steering control of a differential-drive robot possible using a pair of Simple Motor Controllers. A BEC jumper lets the Simple Motor Controller optionally power your RC receiver at 3.3 or 5 V, eliminating the need for a second battery. Simple High-Power Motor Controller 18v15 or 24v12 RC connections. Simple High-Power Motor Controller 18v25 or 24v23 RC connections.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation RC receiver’s power source. Your receiver and Simple Motor controller must always have a common ground, even if you power the RC receiver separately. The channel pins have a 0.1" spacing, which means that a female-female servo extension cable [http://www.pololu.com/catalog/ product/780] can be used to connect an RC receiver directly to the board.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Wiring diagram for pairing two Simple Motor Controllers with RC channel mixing. You should configure the controller that drives the right motor as “mixing mode right” and the controller that drives the left motor as “mixing mode left”. You can splice together your own cables or use premade Y splitter cables [http://www.pololu.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Unused RC channels can also be used as limit or kill switches. For example, you could use an RC signal as a kill switch to stop your autonomous, serially-controlled robot if it gets into trouble. When configured as a limit or kill switch, if the channel’s value exceeds more than half of its “forward” value, the switch is activated.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Simple High-Power Motor Controller 18v25 or 24v23 analog connections. Analog Connections Overview The analog connection block consists of two channels. Each channel has a signal pin and a + and – pin for powering the analog voltage source.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Simple Wiring Example: Connecting to a Potentiometer Wiring diagram for connecting a potentiometer or joystick to a Simple Motor Controller. Using the Analog Channels The Simple Motor Controller is constantly sampling the two analog channels and making the measured voltages available via the USB and serial interfaces, even when the controller is not in analog mode.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Unused analog channels can also be used as limit or kill switches. When configured as a limit or kill switch, if the channel value exceeds more than half of its “forward” value, the switch is activated.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation 5. Configuring Your Motor Controller The Simple Motor Controllers can be configured over USB using the Pololu Simple Motor Control Center, which is available for download from the Pololu website (see Section 3.1). 5.1. Input Settings The Input Settings tab of the Pololu Simple Motor Control Center 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.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Input Settings tab in the Pololu Simple Motor Control Center. Input Mode The Input Mode specifies what kind of input the controller will use to calculate the Target Speed of the motor. The available options are: • Serial/USB: In this input mode, the Target Speed is specified by serial or USB commands, and the Target Speed is reset to zero whenever there is an error. This is the default input mode.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation The primary use of mixing is for controlling a motor on a differential drive robot. You can use one Simple Motor Controller for each motor on the robot, and feed the same inputs in to both of them. We recommend connecting the throttle (forward/ reverse) input to channel 1, and the steering (left/right) input to channel 2.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation switch feature and the Serial/USB input mode to make an autonomous robot that you can conveniently immobilize from a distance using an RC transmitter and receiver. The Forward and Reverse Limit Switch options allow you to set up limits that prevent your actuator from moving out of its allowed range. See Section 4.4 for information about connecting limit switches.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation The Error min. and Error max. parameters should be set so that the input channel’s Raw Value is always within that range whenever the input is operating properly. One way to do this is to move your input to the minimum position, and set Error min. to be 10–200 counts lower than the current channel value. Similarly, move your input to its maximum position, and set Error max. to be 10–200 counts higher than the current channel value.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation 5.2. Motor Settings The Motor Settings tab of the Pololu Simple Motor Control Center allows you to set up limits to protect your system and lets you specify the details of how your motor should be driven. Motor Settings tab in the Pololu Simple Motor Control Center. Hard Limits The Hard Limits box allows you to set up hard limits on the motion of your motor in order to protect your system and reduce mechanical stress.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation If you want to enter different limits for the reverse and forward directions, check the Asymmetric checkbox. Max speed is a number between 0 and 3200 that specifies the maximum speed at which the motor controller will ever drive the motor. The default value is 3200, which corresponds to 100% and means there is no limit. A value of 0 means that the motor will not be allowed to drive in the specified direction.
Pololu Simple Motor Controller User's Guide PWM Frequency Duty cycle when speed is 100% 21.77 kHz 96.8% 11.07 kHz 98.4% 7.42 kHz 98.9% 5.58 kHz 99.2% 4.47 kHz 99.3% 3.20 kHz 99.5% 2.04 kHz 99.7% 1.12 kHz 99.8% © 2001–2010 Pololu Corporation Speed zero brake amount is a number between 0 and 32 that specifies how strongly to brake the motor when the Current Speed is set to 0. This corresponds to the percentage of time that the low-side MOSFETs will be turned on and braking the motor.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Advanced Settings tab in the Pololu Simple Motor Control Center. VIN Detection These options specify how to measure the voltage on the VIN line. The Low VIN options specify what constitutes a Low VIN error. A Low VIN error occurs when the voltage on the VIN line drops below the Low VIN shutoff voltage and stays below it for the amount of time specified by the Low VIN timeout.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation The VIN multiplier offset is a calibration factor used in computing VIN. The default value of 0 should work fine for most purposes. If you have a multimeter or another accurate way of measuring voltage, you can click the Learn… button to have the software automatically set this number for you. If you find that the VIN reading shown in the Status tab is too high, you should decrease this number.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation The Ignore pot disconnect option disables the disconnect detection for analog channels. Enabling this option means that the device will stop toggling the positive (+) analog power pins in order to detect whether your potentiometer is connected. The analog channel will still be considered invalid if the voltage goes out of the acceptable range specified by the Error min and Error max parameters for that channel.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Firmware Change Log Firmware version 1.01 fixes a bug that made the ASCII Get Variable serial command malfunction for negative numbers. Firmware version 1.02 fixes a bug that caused the controller to detect the wrong baud rate if the baud rate detection byte was sent during the first two milliseconds after a reset. Firmware version 1.03 fixes a bug that caused the yellow LED to flicker sometimes. 5.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Upgrade Instructions You can determine the version of your controller’s firmware by running the Pololu Simple Motor Control Center software, connecting to the controller, and selecting “Device Information…” from the Device menu. If you don’t have the latest firmware, you can upgrade the firmware by following these steps: 1. Save the settings stored on your controller using the “Save settings file…” option in the File menu.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation 6. Using the Serial Interface The Simple Motor Controller has two serial interfaces that allow you to send commands and receive responses from the controller. The commands and responses are represented as a series of bytes [http://simple.wikipedia.org/wiki/Byte]. Serial commands let you set the speed of the motor when the Input Mode is Serial/USB.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation leave the TX line disconnected. See Section 4.2 for more information on connecting a serial device to the Simple Motor Controller. The serial interface is asynchronous, meaning that the sender and receiver are separately configured ahead of time to agree on the length of a bit (this is known as the “baud rate” and it is usually specified in bits per second, or bps), and each side independently times the serial bits.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation 6.1. Serial Settings The behavior of the Simple Motor Controller’s serial interface is determined by a number of settings, almost all of which can be configured under the Input Settings tab of the Simple Motor Control Center: The serial settings in the Input Settings tab of the Pololu Simple Motor Control Center. Serial Mode: The Serial Mode determines which protocols the Simple Motor Controller will accept.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Device Number: This is the device number (0–127) that is used to address this device in Pololu Protocol and Mini SSC protocol commands. This setting is useful when using the Simple Motor Controller with other devices in a daisy-chained configuration (see Section 6.6). Baud Rate: This setting only applies to TTL serial communication via the RX and TX pins; it is not relevant for serial communication over the virtual COM port.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation This guide displays byte values in the format: “hex (decimal)”, where hex is the hexadecimal [http://simple.wikipedia.org/wiki/Hexadecimal] (base-16) representation of the byte’s value, and decimal is the decimal representation of the byte’s value. The hexadecimal representation starts with the prefix 0x (e.g. 0x10). Keep in mind that a byte is simply a number between 0x00 (0) and 0xFF (255).
Pololu Simple Motor Controller User's Guide Hex notation: Decimal notation: © 2001–2010 Pololu Corporation 0xAA, 0x0D, 0x05, 0x00, 0x64 170, 13, 5, 0, 100 The byte 0x05 is the Set Motor Forward command (0x85) with its most significant bit cleared. Mini SSC Protocol The Simple Motor Controller also responds to the Scott Edwards Mini SSC protocol, a simple, three-byte serial protocol commonly used by servo controllers.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Sending Binary (Compact Protocol) commands to the Simple Motor Controller with the Pololu Serial Transmitter utility. 6.2.1.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation is an error (e.g. the battery becomes disconnected) then the motor will start running immediately when the error has been resolved (e.g. the battery is reconnected). If you want to prevent your motor from starting up unexpectedly after the controller has recovered from an error, then you should only send an Exit Safe Start command after either waiting for user input or issuing a warning to the user.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation If we want to set the motor target speed to half-speed forward, we can use the above equations to compute that the first speed byte must be the remainder of 1600/32, or 0, and the second speed byte must be the quotient of 1600/32, or 50.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Command Byte Data Byte 1 Compact Protocol 0x89 (137) 0x3F (63) Motor Reverse 7-Bit (Serial/USB input mode only) Command Format: Command Byte Data Byte 1 Data Byte 2 Data Byte 3 Compact Protocol 0x8A (138) speed - - Pololu Protocol 0xAA (170) device number 0x0A (10) speed Description: This command sets the motor target speed in the reverse direction based on the specified low-resolution (7-bit) Speed byte.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Command Byte Data Byte 1 Compact Protocol 0x92 (146) 0x10 (16) Get Variable (any input mode) Command Format: Command Byte Data Byte 1 Data Byte 2 Data Byte 3 Compact Protocol 0xA1 (161) variable ID - - Pololu Protocol 0xAA (170) device number 0x21 (33) variable ID Response Format: Response Byte 1 Response Byte 2 variable low byte variable high byte Description: This command lets you read a 16-bit variable from the
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation 30 + 256 * 1 = 286 in units of 0.1 °C, which means the board temperature is 28.6 °C.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation The first limit value byte, limit byte 1, can be computed by taking the full limit value modulo (or “mod”) 128, which is the same as dividing the value by 128, discarding the quotient, and keeping only the remainder. We can get the same result using binary math by bitwise-ANDing the limit with 0x7F (127).
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Example: To set the reverse deceleration limit (limit ID 10) to 500, we can use the above equations to compute that limit byte 1 must be the remainder of 500/128, or 116, and limit byte 2 must be the quotient of 500/128, or 3.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Command Byte Compact Protocol 0xC2 (194) We Receive: Response Byte 1 Response Byte 2 Response Byte 1 Response Byte 2 0x98 (152) 0x00 (0) 0x00 (0) 0x01 (1) This response tells us that the product ID is 0x0098 (152) and the firmware version is 1.0.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation command string + [argument 1 + [‘,’ + argument 2]] + termination character For example, to command the motor to drive forward at speed 3200 (full speed), we could send the following ASCII command: “F3200” Here the command string is “F”, the argument string is “3200”, and the termination character is . ASCII commands are case-insensitive and white-space is ignored, so “F3200” has the same effect as “f 3200 ”.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation • Null Character: This character is used to terminate strings in C. It is often written as and has a character value of 0. In C, the string “abc” is comprised of the four characters: ‘a’, ‘b’, ‘c’, and . One of the above three characters must be the last character in your ASCII command string.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation We recommend you enable local echoing of transmitted characters when typing commands into a terminal program. The following picture shows our recommended ASCII settings when using HyperTerminal: You can get to this dialog by going to the File > Properties menu and clicking on the ASCII Setup… button under the Settings tab. 6.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation 6.3.1. ASCII Command Reference Exit Safe-Start (Serial/USB input mode only) Command Format: “GO” Description: This command clears the Serial/ USB safe-start violation and allows the motor to run. When Safe-Start protection is enabled, this command must be issued when the controller is first powered up, after any reset, and after any error stops the motor.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation ◦ “B100%” ◦ “B20H” Get Variable (any input mode) Command Format: “D” Description: This command lets you read a variable from the Simple Motor Controller. See Section 6.4 for a list of all of available variables. The value of the requested variable is transmitted as an ASCII-encoded decimal number. If the argument variable_id is between 41 and 127, a Serial Format Error occurs.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Note: The Brake Duration units used by this command are 4 ms, which differs from 1 ms units used by the Brake Duration variables returned by the Get Variable command. Note that the Hard Motor Limit settings place restrictions on the limit values you can set with this command (see Section 5.2 for more information on the hard motor limits).
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Description: This command prints the Simple Motor Controller product number (in decimal) and firmware version number (the two major firmware version digits followed by the two minor firmware version digits). For example, the response to this command might be “.152 01.00”, which indicates a product ID of 152, a major firmware version of 1, and a minor firmware version of 0.
Pololu Simple Motor Controller User's Guide ID Name © 2001–2010 Pololu Corporation Description The set bits of this variable indicate the errors that are currently stopping the motor. The motor can only be driven when this register has a value of 0. (See Section 3.4 for error descriptions.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation • Bit 8: AN2 limit/kill switch is active (scaled value ≥ 1600). • Bit 9: USB kill switch is active. • Bits 10-15: reserved 127 Reset Flags Flags indicating the source of the last board reset. This variable does not change while the controller is running and is not reported under the Status Tab of the Simple Motor Control Center.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Analog Channel Inputs The raw and scaled voltages measured on the analog channel inputs are always available through serial variable requests, which allows programs using the serial interface to factor the channel inputs into their motor control algorithms.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation ID Name Type Target Speed signed 16-bit Motor target speed (-3200 to +3200) requested by the controlling interface. internal units 21 Speed signed 16-bit Current speed of the motor (-3200 to +3200). internal units 20 Description Units 22 Brake Amount When Speed=0, this variable indicates how hard the controller is braking with unsigned a value from 0 (full coast) to 32 (full brake).
Pololu Simple Motor Controller User's Guide ID Name Type © 2001–2010 Pololu Corporation Description Units 30 Max Speed Forward unsigned Maximum allowed motor speed in the forward direction (0 to 3200). 16-bit 31 Max Acceleration Forward unsigned Maximum allowed motor acceleration in the forward direction (0 to Δspeed per 16-bit 3200; 0 means no limit).
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation For sample C code that computes the CRC byte of a command packet, see Section 6.7.3. The CRC implemented on the Simple Motor Controller is the same as the one on the Maestro [http://www.pololu.com/catalog/product/1352] servo controller and jrk [http://www.pololu.com/catalog/product/ 1392] and qik [http://www.pololu.com/catalog/product/1110] motor controllers, but it differs from that on the TReX [http://www.pololu.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation 1 0 0 0 1 0 0 1 | | _______________ | | 1 0 0 1 0 1 0 0 1 0 0 0 1 0 0 1 _______________ 1 1 1 0 1 | | | | | 0 | | | | | 0 = 0x17 So the full command packet we would send with CRC enabled is: 0x83, 0x01, 0x17. 6.6. Daisy Chaining This section is a guide to integrating the Simple Motor Controller in to a project that has multiple TTL serial devices that use a compatible protocol.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation Connections Connect the TX line of your controlling device to the RX lines of all of the slave devices. Sent commands will then be received by all slaves. When receiving serial responses from multiple slaves, each device should only transmit when requested, so if each device is addressed separately, multiple devices will not transmit simultaneously.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation than hardware serial, but the burden on the processor can still be relatively small if the software serial is implemented well (e.g. by using interrupts to receive data rather than polling). In the following examples, we use the NewSoftSerial library [http://arduiniana.org/libraries/newsoftserial/] to transmit bytes on digital pin 4 and receive bytes on digital pin 3.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation delay(5); // if the Simple Motor Controller has automatic baud detection // enabled, we first need to send it the byte 0xAA (170 in decimal) // so that it can learn the baud rate mySerial.
Pololu Simple Motor Controller User's Guide } © 2001–2010 Pololu Corporation while (!mySerial.available()) { if (millis() - time > 500) return -1; } return mySerial.read(); // required to allow motors to move // must be called when controller restarts and after any error void exitSafeStart() { mySerial.print(0x83, BYTE); } // speed should be a number from -3200 to 3200 void setMotorSpeed(int speed) { if (speed < 0) { mySerial.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation setMotorSpeed(3200); // full-speed forward // signed variables must be cast to ints: Serial.println((int)getVariable(TARGET_SPEED)); delay(1000); setMotorSpeed(-3200); // full-speed reverse Serial.println((int)getVariable(TARGET_SPEED)); delay(1000); // print input voltage (in millivolts) to the serial monitor Serial.print("VIN = "); Serial.print(getVariable(INPUT_VOLTAGE)); Serial.
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation This program demonstrates how to initiate serial communication with the Simple Motor Controller and how to send commands to set the motor speed. For information about the serial commands used by this sample code, refer to Section 6.2.1. Note that the Simple Motor Controller must be powered when this Orangutan program starts running. #include
Pololu Simple Motor Controller User's Guide exitSafeStart(); } © 2001–2010 Pololu Corporation // clear the safe-start violation and let the motor run // program execution starts here int main() { setup(); while (1) // loop forever { setMotorSpeed(3200); delay_ms(1000); setMotorSpeed(-3200); delay_ms(1000); } } Advanced Example This example assumes the following connections exist between the Orangutan and the Simple Motor Controller: • Orangutan pin PD0 to Simple Motor Controller TX • Orangutan pin PD1
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation void setBaudRate(unsigned long baud) { #if _SERIAL_PORTS > 1 // Orangutan X2 and SVP users serial_set_baud_rate(UART0, baud); #else serial_set_baud_rate(baud); #endif } void sendBlocking(char * buffer, unsigned char size) { #if _SERIAL_PORTS > 1 // Orangutan X2 and SVP users serial_send_blocking(UART0, buffer, size); #else serial_send_blocking(buffer, size); #endif } char receiveBlocking(char * buffer, unsigned char size, unsigned
Pololu Simple Motor Controller User's Guide } © 2001–2010 Pololu Corporation return response; // initialization code called once when the program starts running void setup() { setBaudRate(115200); // briefly reset SMC when Arduino starts up (optional) set_digital_output(resetPin, LOW); delay_ms(1); // wait 1 ms set_digital_input(resetPin, HIGH_IMPEDANCE); // let SMC run again // must wait at least 1 ms after reset before transmitting delay_ms(5); // this lets us read the state of the SMC ERR pin (option
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation 6.7.3. CRC Computation in C Simple Example The following example program shows how to compute a CRC byte in the C language. The outer loop processes each byte, and the inner loop processes each bit of those bytes. In the example main() routine, this is applied to generate the CRC byte in the message 0x83, 0x01, that was used in Section 6.5. The getCRC() function will work without modification in both Arduino and Orangutan programs.
Pololu Simple Motor Controller User's Guide } } © 2001–2010 Pololu Corporation CRCTable[i] = getCRCForByte(i); unsigned char getCRC(unsigned char message[], unsigned char length) { unsigned char i, crc = 0; } for (i = 0; i < length; i++) crc = CRCTable[crc ^ message[i]]; return crc; int main() { unsigned char message[3] = {0x83, 0x01, 0x00}; int i, j; buildCRCTable(); message[2] = getCRC(message, 2); } for (i = 0; i < sizeof(message); i++) { for (j = 0; j < 8; j++) printf("%d", (message[i] >> j) %
Pololu Simple Motor Controller User's Guide © 2001–2010 Pololu Corporation 7. Writing PC Software to Control the Simple Motor Controller There are two ways to write PC software to control a Simple Motor Controller: the native USB interface and the virtual serial port. The native USB interface provides more features than the serial port, such as the ability to change configuration parameters and select the Simple Motor Controller by its serial number.