USB Sabertooth Packet Serial Library for Arduino
Control your USB-enabled Sabertooth with reliable Packet Serial.
|
Make sure DIP switches 1 and 2 are OFF for Plain Text/Packet Serial.
For full information about configuring your DIP switches, consult the DIP Switch Wizard at http://www.dimensionengineering.com/datasheets/USBSabertoothDIPWizard/.
Connect 0V to Arduino GND, S1 to Arduino TX, and if you want to power the Arduino with your Sabertooth, 5V to Arduino 5V. If you will be reading back motor currents, temperatures, etc., also connect S2 to Arduino RX.
This Arduino library uses Packet Serial. If you don't need all of its features or don't want to use a library, Plain Text Serial is an extremely easy way to interact with a USB-enabled Sabertooth from a microcontroller or PC.
For example, if you open up a terminal at 9600 baud (8-N-1), all of the following are valid commands you can type:
M1: 0 M1: 2047 M1: -2047 M2: 500 M1: GET M1: GET B M1: GET C M1: GET T M1: SHUT DOWN M1: START UP
Mixed mode (tank-style differential drive) is similarly easy with drive and turn:
MD: 0 MT: 0 MT: 2047
Power outputs (P1 and P2, if configured as controllable outputs in DEScribe), freewheeling (Q1 and Q2), and ramping (R1 and R2) can also be controlled. If this interests you, see the manual's section on Plain Text Serial.
Once you have the library installed, try any of the included examples. This is the best way to get a feel for things.
To find the examples, first start up the Arduino software (if you installed with it running, restart it). Click File, Examples, USBSabertooth, and then take your pick.
The USBSabertooth library exposes features that only exist on USB-enabled Sabertooth motor drivers, such as 12-bit motor outputs, power outputs, control over freewheeling, motor current read-back, and User Mode variables. If you do not need these features, and want your code to be compatible with all Sabertooth/SyRen motor drivers, including those that are not USB-enabled, use the Sabertooth library instead.
Feel free to contact us if you have questions. Our Help Desk is at http://help.dimensionengineering.com.