Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation Pololu Simple Motor Controller User's Guide http://www.pololu.
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 . . . . . . . . . 1.4. Supported Operating Systems . . . . . . . . . . . . . 2. Contacting Pololu . . . . . . . . . . . . . . . . . . . . . . . 3. Getting Started . . . . . . . . . . . . . . . . . . . . . . . . 3.1.
Pololu Simple Motor Controller User's Guide © 2001–2014 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–2014 Pololu Corporation Note: A USB A to mini-B cable [http://www.pololu.com/product/130] (not included) is required to connect this controller to a computer. Additional Features • Adjustable maximum acceleration and deceleration to limit electrical and mechanical stress on the system. • Adjustable starting speed, maximum speed, and amount of braking when speed is zero. • Optional safety controls to avoid unexpectedly powering the motor.
Pololu Simple Motor Controller User's Guide © 2001–2014 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 2 © 2001–2014 Pololu Corporation This is the weight of the board without header pins, terminal blocks, or through-hole power capacitor. 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.
Pololu Simple Motor Controller User's Guide © 2001–2014 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–2014 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–2014 Pololu Corporation Mac OS X compatibility: we have confirmed that the Simple Motor Controller works on Mac OS X 10.7 and we can assist with advanced technical issues, but most of our tech support staff does not use Macs, so basic support for Mac OS X is limited. 1.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation 2. Contacting Pololu You can check the Pololu Simple Motor Controller pages 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. [http://www.pololu.
Pololu Simple Motor Controller User's Guide © 2001–2014 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–2014 Pololu Corporation 7. On the second screen of the “Found New Hardware Wizard”, select “Install the software automatically” and click “Next”. 3.
Pololu Simple Motor Controller User's Guide © 2001–2014 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–2014 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.
Pololu Simple Motor Controller User's Guide © 2001–2014 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–2014 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/smclinux-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–2014 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–2014 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–2014 Pololu Corporation 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: This is a measurement of the temperature of the device.
Pololu Simple Motor Controller User's Guide © 2001–2014 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–2014 Pololu Corporation 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.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation 3.5. LED Feedback The Simple Motor Controllers have 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. Simple Motor Controller 18v7 LEDs. Simple High-Power Motor Controller 18v15 or 24v12 LEDs. Simple High-Power Motor Controller 18v25 or 24v23 LEDs.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation 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–2014 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. • Simple Motor Controller 18v7 Pin-Out • Simple High-Power Motor Controller 18v15 and 24v12 Pin-Out 4.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation • Simple High-Power Motor Controller 18v25 and 24v23 Pin-Out 4.
Pololu Simple Motor Controller User's Guide © 2001–2014 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–2014 Pololu Corporation Simple Motor Controller 18v7 power and motor connections. Simple High-Power Motor Controller 18v15 or 24v12 power and motor connections. Simple High-Power Motor Controller 18v25 or 24v23 power and motor connections. 4.
Pololu Simple Motor Controller User's Guide © 2001–2014 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/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–2014 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–2014 Pololu Corporation Power and Motor Connectors Simple Motor Controller 18v7, fully assembled. Simple High-Power Motor Controller 18v15 or 24v12, fully assembled. Simple High-Power Motor Controller 18v25 or 24v23 with included hardware installed.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation [http://www.pololu.com/product/2440], and pairs of 0.1"-spaced holes, which are compatible with the included 0.1" and can be used with perfboards, breadboards [http://www.pololu.com/category/28/solderless-breadboards], and 0.1" connectors.
Pololu Simple Motor Controller User's Guide © 2001–2014 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–2014 Pololu Corporation Simple Motor Controller 18v7 serial connections. 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.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation Whenever connecting devices, remember to wire the grounds together, and ensure that each device is properly powered. Unpowered devices with a TTL serial port can turn on or partially on, drawing power from the serial line, which means that extra care must be taken when turning power off and on to reset the devices. Note: You must use an inverter and level shifter such as a MAX232 or a Pololu 23201a Serial Adapter [http://www.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation from the controller, you can connect the TX pin to the microcontroller’s TTL serial receive pin and/or connect the ERR pin to one of the microcontroller’s digital inputs. Connecting one of the microcontroller’s digital outputs to the RST pin allows the microcontroller to selectively reset the Simple Motor Controller.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation The TXIN Pin in Detail The TXIN pin is a special input that allows multiple Simple Motor Controllers to be chained together without requiring an external AND gate. The following diagram shows how multiple motor controllers can be connected to a single microcontroller UART: Wiring diagram for controlling multiple Simple Motor Controllers with single TTL serial source, such as a microcontroller.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation 4.3. Connecting an RC Receiver Simple Motor Controller can be directly connected to an RC receiver, allowing for wireless, manual motor control. The RC inputs can serve several functions, from directly controlling the motors (RC input mode) to sending signals to an autonomous robot (Serial/USB mode) to providing an RC kill switch (any input mode).
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation RC Connections Overview The RC connection block consists of two channels oriented as columns and a battery elimination circuit (BEC) column for supplying power to the RC receiver. Each channel has a ground pin (outlined in black in the above diagrams), a power pin (outlined in red in the above diagrams), and a signal pin (outlined in yellow in the above diagrams).
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation speed by summing the throttle and steering channels (CH1+CH2) while right mixing mode obtains motor speed by taking the difference of the throttle and steering channels (CH1-CH2). To see why this makes sense, consider a differential-drive robot (a robot with a motor on each side) with a left motor driven by a Simple Motor Controller in left mixing mode and a right motor driven by a Simple Motor Controller in right mixing mode.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation Limit/Kill Switches 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–2014 Pololu Corporation Simple High-Power Motor Controller 18v15 or 24v12 analog connections. 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–2014 Pololu Corporation Note: The analog channel inputs are not 5V tolerant, so you must not connect voltages over 3.3 V to these pins. If your control source outputs voltages higher than 3.3 V, you can use a voltage divider to ensure the voltage is always at an acceptable level. The channel pins have a 0.1" spacing, which means that a female-female servo extension cable [http://www.pololu.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation full forward (CH1=max) and steering is neutral (CH2=0), left- and right-mixed motors are both driven forward at full speed and the robot goes forward. When throttle is neutral (CH1=0) and steering is full right (CH2=max), the left mixing results in motor forward at full speed while right mixing results in motor reverse at full speed, so the robot turns right.
Pololu Simple Motor Controller User's Guide © 2001–2014 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–2014 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–2014 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–2014 Pololu Corporation could use the kill 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–2014 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–2014 Pololu Corporation 7. Click the “Learn…” button for the channel in the Input Settings tab. The Channel Setup Wizard will walk you through the steps needed to calibrate your limit switch’s scaling parameters. 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.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation They are called Hard Limits because they are stored in non-volatile memory and they are always obeyed. However, all of them except Starting Speed can be temporarily modified using the appropriate USB or serial command. Only modifications that make the system safer are allowed. These temporary changes will only last until the next time the device resets, at which point the hard limits will be reloaded. See Section 6.2.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation Invert motor direction option enabled, Forward means the average voltage on OUTA is less than the average voltage on OUTB. The PWM frequency setting specifies the frequency of the rapidly-switching (PWM) signal used to control the speed of the motor. Several PWM Frequency options are available between 1.12 and 21.77 kHz. The default PWM frequency is 21.77 kHz.
Pololu Simple Motor Controller User's Guide © 2001–2014 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–2014 Pololu Corporation is being pulled down a hill by gravity, the extra voltage generated by the motors might trigger a VIN error and the controller would attempt to stop your robot’s descent by braking. The VIN multiplier offset is a calibration factor used in computing VIN. The default value of 0 should work fine for most purposes.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation this means that you will no longer have to center your inputs in order to restart the motor after an error. This option makes it more likely that the motor will start when you are not expecting it. The Ignore ERR line high option disables the ERR line high error, which is described in Section 3.4. This allows your motor to run even if the ERR line is being driven high by some external device.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation Linux users: The Simple Motor Controller’s firmware cannot be upgraded from a Linux computer. This is due to bugs in recent versions of mono, which we were able to reproduce on mono version “Debian 2.10.8.1-5ubuntu2”. If you need to upgrade your firmware, please use a computer running Windows. 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–2014 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–2014 Pololu Corporation The voltage on the RX pin should not go below 0 V and should not exceed 5 V. The Simple Motor Controller provides logic-level (0 to 3.3 V) serial output on its serial transmit line, TX. The bytes sent by the motor controller on TX are typically responses to commands that request information, but they can also be data received by the TXIN pin and passed on.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation Note: TTL serial is not the same as RS-232 serial. You must use an inverter and level shifter such as a MAX232 or a Pololu 23201a Serial Adapter [http://www.pololu.com/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. 6.1.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation • Commands only: The proper CRC byte must be appended to the end of every Binary Mode serial command packet. If the CRC byte is not appended or is incorrect, a Serial CRC Error is generated. Serial responses from the controller do not have a CRC byte appended to the end. • Commands and responses: The proper CRC byte must be appended to the end of every Binary Mode serial command packet.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation This means that each data byte can only transmit seven bits of information. The only exception to this is the Mini SSC command, where the command byte is 0xFF, or 255, and the data bytes can have any value from 0x00 to 0xFE (0 to 254).
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation remaining bytes in the command packet are the same as the compact protocol command packet you would send, with one key difference: the compact protocol command byte is now a data byte for the command 0xAA and hence must have its most significant bit cleared.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation Trying the Binary Serial Interface If you are having trouble using the Binary protocols, it can help to first use a program like the Pololu Serial Transmitter utility for Windows [http://www.pololu.com/docs/0J23] to send bytes to the Simple Motor Controller’s virtual COM port.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation Description: If the Input Mode is Serial/USB, and you have not disabled Safe-start protection, then this command is required before the motor can run. Specifically, this command must be issued when the controller is first powered up, after any reset, and after any error stops the motor. This command has no serial response.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation This command has no serial response. Example: 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–2014 Pololu Corporation To set the motor target speed to approximately half-speed forward (63), we could send the following compact protocol bytes: We Send: 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: T
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation To set the motor outputs to 50% braking (a Brake Amount of 16), we would transmit the following compact protocol bytes: We Send: 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
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation Response Byte 1 Response Byte 2 0x1E (30) 0x01 (1) This response tells us that the temperature is: 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–2014 Pololu Corporation ID Name Allowed Values Units 0 or 4 Max Speed Forward 0–3200 0=0%, 3200=100% 1 or 5 Max Acceleration Forward 0–3200 (0=no limit) Δspeed per update period 2 or 6 Max Deceleration Forward 0–3200 (0=no limit) Δspeed per update period 3 or 7 Brake Duration Forward 0–16384 4 ms 0 or 8 Max Speed Reverse 0–3200 0=0%, 3200=100% Max Acceleration Reverse 0–3200 (0=no limit) Δspeed per update period 2 or 10 Max Deceler
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation be decreased below their hard-limit counterparts. If you try to set a temporary limit in a way prohibited by the corresponding hard limit, the temporary limit value is set to the hard limit and the response code byte indicates that the value could not be set as requested.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation Command Byte Data Byte 1 Data Byte 2 Compact Protocol 0xC2 (194) - - Pololu Protocol 0xAA (170) device number 0x42 (66) Response Format: Response Byte 1 Response Byte 2 Response Byte 3 Response Byte 4 product ID low byte product ID high byte minor FW version (BCD format) major FW version (BCD format) Description: This command lets you read the Simple Motor Controller product number and firmware version number.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation limits will be respected) and not allow the motor to start again until the Safe-Start conditions required by the Input Mode are satisfied. This command has no serial response. 6.3. ASCII Commands When configured in “ASCII” serial mode, the Simple Motor Controller offers a simple serial interface based on ASCII characters.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation Command String Command Name “GO” Exit Safe-Start “F” Motor Forward “R” Motor Reverse “B” Motor Brake “D” Get Variable “L” Set Motor Limit “V” Get Firmware Version “X” Stop Motor Argument Strings Command arguments are expressed as strings of ASCII digits.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation The ASCII mode serial response is always terminated by a carriage return () followed by a line feed (). For example, if we send a Motor Forward command while no errors are stopping the motor, the response would be “.”. If we send a Get Variable command while errors are stopping the motor, the response might be “!123”, which would indicate that the requested variable has a value of 123.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation 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–2014 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 putting an “H” at the end of the number. If the argument Format Error occurs. © 2001–2014 Pololu Corporation brake_amount is outside the allowed range, a Serial Error. Examples: The following commands all make the motor brake as hard as possible: ◦ “B32” ◦ “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.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation ID Name Allowed Values Units “0” or “4” Max Speed Forward 0–3200 0=0%, 3200=100% “1” or “5” Max Acceleration Forward 0–3200 (0=no limit) Δspeed per update period “2” or “6” Max Deceleration Forward 0–3200 (0=no limit) Δspeed per update period “3” or “7” Brake Duration Forward 0–16384 4 ms “0” or “8” Max Speed Reverse 0–3200 0=0%, 3200=100% Max Acceleration Reverse 0–3200 (0=no limit) Δspeed per update period
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation 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, at which point the temporary limit settings are all reinitialized to the hard limit settings.
Pololu Simple Motor Controller User's Guide ID Name © 2001–2014 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–2014 Pololu Corporation • Bit 6: RC2 limit/kill switch is active (scaled value ≥ 1600). • Bit 7: AN1 limit/kill switch is active (scaled value ≥ 1600). • 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.
Pololu Simple Motor Controller User's Guide ID Name Type Description © 2001–2014 Pololu Corporation Units RC1 Unlimited unsigned The positive pulse width of the signal on RC channel 1. This value is 0xFFFF 4 0.25 µs Raw 16-bit (65535) if no valid signal is detected. Value 5 RC1 Raw Value RC1 6 Scaled Value The positive pulse width of the signal on RC channel 1. This value is 0xFFFF unsigned (65535) if no valid signal is detected or if the signal is outside of the Error 0.
Pololu Simple Motor Controller User's Guide ID Name Type © 2001–2014 Pololu Corporation Description Units AN1 Unlimited unsigned The 12-bit ADC reading of analog channel 1. This value is 0xFFFF 0=0 V, 12 Raw 16-bit (65535) if the controller detects the input is disconnected. 4095=3.3 V Value 13 The 12-bit ADC reading of analog channel 1. This value is 0xFFFF AN1 Raw unsigned 0=0 V, (65535) if the controller detects the input is disconnected or if the signal Value 16-bit 4095=3.
Pololu Simple Motor Controller User's Guide © 2001–2014 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 unsigned braking with a value from 0 (full coast) to 32 (full brake).
Pololu Simple Motor Controller User's Guide ID Name 30 Max Speed Forward Type © 2001–2014 Pololu Corporation Description unsigned Maximum allowed motor speed in the forward direction (0 to 16-bit 3200). Units internal units Max 31 Acceleration Forward unsigned Maximum allowed motor acceleration in the forward direction Δspeed per 16-bit (0 to 3200; 0 means no limit).
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation basically a carryless long division of a CRC “polynomial”, 0x91, into your message (expressed as a continuous stream of bits), where all you care about is the remainder. The Simple Motor Controller uses CRC-7, which means it uses an 8-bit polynomial and, as a result, produces a 7-bit remainder. This remainder is the lower 7 bits of the CRC byte you tack onto the end of your command packets.
Pololu Simple Motor Controller User's Guide _______________ | | | | | | | | 1 1 0 1 1 0 0 0 | | | | | 1 0 0 0 1 0 0 1 | | | | | _______________ | | | | | 1 0 1 0 0 0 1 0 | | | | 1 0 0 0 1 0 0 1 | | | | _______________ | | | | 1 0 1 0 1 1 0 0 | | 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 © 2001–2014 Pololu Corporation | | | | | | | | | | | | | 0 | | | | | | | | | | | | | 0 = 0x17 So the full command packet we would send with CRC enabled is: 0x83, 0x0
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation Daisy chaining serial devices that have a TXIN input. For additional connection diagrams and more information about the TXIN pin, see Section 4.2. 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.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation 6.7.1. Arduino Examples The Arduino [http://www.pololu.com/product/2191] is a popular prototyping platform that is well suited for beginners to the world of embedded programming. Arduino boards are based on Atmel’s AVR microcontrollers, like the Orangutan robot controllers [http://www.pololu.com/category/8/robotcontrollers], and are essentially programmed in C++.
Pololu Simple Motor Controller User's Guide } © 2001–2014 Pololu Corporation else { smcSerial.write(0x85); // motor forward command } smcSerial.write(speed & 0x1F); smcSerial.write(speed >> 5); void setup() { // initialize software serial object with baud rate of 19.2 kbps smcSerial.
Pololu Simple Motor Controller User's Guide #define #define #define #define #define ERROR_STATUS 0 LIMIT_STATUS 3 TARGET_SPEED 20 INPUT_VOLTAGE 23 TEMPERATURE 24 // some #define #define #define motor limit IDs FORWARD_ACCELERATION 5 REVERSE_ACCELERATION 9 DECELERATION 2 © 2001–2014 Pololu Corporation // read a serial byte (returns -1 if nothing received after the timeout expires) int readByte() { char c; if(smcSerial.
Pololu Simple Motor Controller User's Guide } © 2001–2014 Pololu Corporation smcSerial.write(0xAA); // send baud-indicator byte setMotorLimit(FORWARD_ACCELERATION, 4); setMotorLimit(REVERSE_ACCELERATION, 10); setMotorLimit(DECELERATION, 20); // clear the safe-start violation and let the motor run exitSafeStart(); void loop() { setMotorSpeed(3200); // full-speed forward // signed variables must be cast to ints: Serial.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation • Orangutan GND to Simple Motor Controller GND Pin PD0 is the Orangutan’s hardware serial receive line and must be connected to the Simple Motor Controller as described above for this sample program to work. See Section 4.2 for more information on connecting a serial device to the Simple Motor Controller.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation // 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 command[0] = 0xAA; sendBlocking(command, 1); // send baud-indicator byte } // next we need to send the Exit Safe Start command, which // clears the safe-start violation and lets the motor run exitSafeStart(); // clear the safe-start violation and let the motor run
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation 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. You can simplify this program by just calling the library function appropriate for your Orangutan board.
Pololu Simple Motor Controller User's Guide { } © 2001–2014 Pololu Corporation command[0] = 0xA1; command[1] = variableID; sendBlocking(command, 2); unsigned int response; if (receiveBlocking((char *)&response, 2, 500)) return 0; // if we don't get a response in 500 ms, return 0 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); // wa
Pololu Simple Motor Controller User's Guide } © 2001–2014 Pololu Corporation setup(); while (1) { loop(); } 6.7.3. Cross-platform C Example The example C code below works on Windows, Linux, and Mac OS X 10.7 or later. It demonstrates how to get the error status from the controller, how to read a variable, and how to set the target speed. This code will work in Windows if compiled with MinGW, but it does not work with the Microsoft C compiler.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation // Returns a number where each bit represents a different error, and the // bit is 1 if the error is currently active. // See the user's guide for definitions of the different error bits. // Returns SERIAL_ERROR if there is an error. int smcGetErrorStatus(int fd) { return smcGetVariable(fd,0); } // Sends the Exit Safe Start command, which is required to drive the motor.
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation printf("Setting Target Speed to %d.\n", newSpeed); smcSetTargetSpeed(fd, newSpeed); } close(fd); return 0; 6.7.4. Windows C Example For example C code that shows how to control a Simple Motor Controller using its serial interface in Microsoft Windows, download SmcSerialCWindows.zip [http://www.pololu.com/file/download/SmcSerialCWindows.zip?file_id=0J558] (5k zip).
Pololu Simple Motor Controller User's Guide © 2001–2014 Pololu Corporation 6.7.6. 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–2014 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–2014 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.