Using your PC to control a Sabertooth motor driver with Roborealm

Introduction
With some additional hardware, you can use our motor drivers to control the speed of motors with your computer. Roborealm is a free piece of software designed to aid you in making a vision controlled robot. Put it all together and you have a platform that will allow you to develop a robot with a PC camera vision system. This article is aimed at people who have some experience with windows programming but are unfamiliar with the hardware needed for serial communications in a typical robotics environment.

Overview
In order to control our motor drivers with your PC you will need a way of getting control information from your PC to the motor driver. Most PCs nowadays communicate with peripherals via USB. Our motor drivers require TTL level serial data for control information. So what is the solution? A USB to TTL serial converter! Here we will show you how to easily set one up.

Parts
Superdroid Robots sell a highly integrated USB to TTL serial cable. There are cheaper solutions that you can build yourself, but the SuperDroids USB to TTL cable is nice because it lets you get your project started with no soldering and minimum effort.
- USB to TTL serial cable
- Motor(s) to connect to the motor driver
- Battery to power the motor driver
- Jumper wire
- Pliers, screwdrivers and other common hand tools.


USB to TTL cable
USB to TTL serial cable

Setting up the Sabertooth
First, connect your battery connector and motors to Sabertooth as normal.


Sabertooth motor and battery connector hookup

Next use the DIP switch wizard to set up Sabertooth in Packetized serial mode at whichever address you want. I was using a lead acid battery and I feel like making this Sabertooth appear at address 128, so here is what my settings were:

address 128
Sabertooth with address set to 128

Setting up the USB to TTL serial cable
First you will need to install the virtual COM port drivers for the cable. You can get the drivers from here. If you are having trouble choosing the right driver, give this one a try.

Cable
Both ends of the cable

After the drivers are installed, plug the USB end of the cable into your PC. You should see Windows detecting the virtual COM port. After this takes place, go to Control panel, System, Hardware, Device manager. Under the Ports section you should see a USB Serial Port appearing with a COM port number next to it. This might be COM2, COM3, COM4 etc. depending on your computer. Note this number down! In the case of my PC I got COM5 assigned for the cable.


We will be using COM5 for the remainder of the tutorial

Connecting the cable to Sabertooth
The USB to TTL serial cable has many wires coming out of it that have different functions. Fortunately for us, we only have to worry about two of them! Use a pair of jumper wires to make a connection between the cable's black wire and the driver's 0V terminal and a connection between the cable's green wire and the motor driver's S1 input. This creates a common ground connection between the driver and your PC, and allows serial communications data to reach Sabertooth. Once you have a test project working you can cut and solder the cable for a more durable connection.


Connecting the cable to Sabertooth with two wires.

Now is a good time to power up the motor driver.

Using Roborealm
First, register to download the roborealm software from here. They will email you a link to download the software. While you are waiting check out their help pages. When you run Roborealm.exe go to Control, Motors, DE_Sabertooth.

Select the COM port that your USB to TTL serial cables was assigned. Mine was COM5. You can leave the baud rate at 9600 for now.

Once the COM port has been initialized you should see Sabertooth's Status 1 LED go from bright to dim. This means that Sabertooth has detected a valid baud rate. You should now be able to control the speed of two motors with the sliders and any additional code you write.

Back to Dimension Engineering