Building an RC Robot Using a Wheelchair Base—Part 2

In Part 2 of building our RC robot, we'll learn how to use a Sabertooth 2x32 motor controller and Arduino to modify an electric wheelchair into an RC robot.

In my first article, we used a Sabertooth 2x25 to create a functioning RC robot base. In this article, we'll configure joystick control, create a kill switch, and connect an Arduino and you can customize to your heart's content.  You can use any microcontroller-compatible analog or digital sensor to send information to your microcontroller, and have the microcontroller send information to the Sabertooth to control your robot's motion.

Wearable Game Controller by Nintendo
Wearable game controller by Nintendo

Parts Required

Note that instead of the Sabertooth 2x25 motor controller we worked with in Part 1, this time we will use a Sabertooth 2x32.

Sabertooth 2x25Sabertooth 2x32
Average Current Per Channel25 Amps32 Amps
Peak Current Per Channel50 Amps64 Amps
InputsRC, Analog, TTL SerialRC, Analog, TTL Serial, USB
Brake ControlNoYes
SteeringIndependent and Mixed ModeIndependent and Mixed Mode
ProgrammingUSB-Serial converter requiredMicro-USB on board
Arduino LibrariesYesYes
Input Voltage6-30V nominal; 33.6V max6-33.6V max
Designed forEase of UseMaximum Configurability

Parts Needed

Jumper WiresVarious F/F, F/M, and M/M terminal wiresLink$10Standard DuPont connectors on multi-strand wire
SabertoothDual 32A Motor ControllerLink$125
Electric WheelchairMerits P101 Folding Power ChairLink$1400 new (<$150 used)If more than $150, consider buying motors and batteries online.
E-stop switchPush Down, Twist Release SwitchLink$4
Arduino Uno R3Any Arduino compatible board should workLink$15
Purchase the Sabertooth motor controller from Dimension Engineering and try to find the electric wheelchair from the local used market. You do not need the entire chair—just the motors, wheels, batteries, and harness. If you cannot find a chair on the local used market, you can usually find the parts you need on eBay.

Creating a Kill Switch

When creating controls, make your first design consideration a way to safely bring the robot base to a stop. The preferred way to do this is with an e-stop switch. E-stops (emergency stops) are switches that typically have one normally-open and one normally-closed contact. These switches can be pushed closed, but must be twisted to reopen.
Sometimes reaching a single switch on a misbehaving robot can be difficult, so you'll have to introduce other mechanical means to activate it.

Two designs for an e-stop switch: pull style (left) and kick-bar style (right)

That might be a kick bar, or a fabric rope someone pulls or steps on. It is important to incorporate an actual e-stop switch in your design, though, because they are readily identified in case of emergencies.
If you come up with an idea that is too clever or takes any amount of time at all to figure out, there is a good chance that when your robot has you pinned on the edge of a cliff with its running buzz-saw, or in another emergency situation, someone in a panic will not know how to shut it off.

The Sabertooth 2x32

The Sabertooth 2x32 is slightly larger than the Sabertooth 2x25 used in the first part of the project for a robot controller. Both controllers are excellently designed and can be user programmed with Dimension Engineering's DEScribe software. Both controllers also accept analog, RC, and TTL serial input. The changes between the two come with the advanced configurability and additional outputs of the 2x32.

The Sabertooth 2x25 (left) and the Sabertooth 2x32 (right)

Along with greater current capacity, the Sabertooth 2x32 can be controlled directly by a computer or Raspberry Pi with the micro-USB connector or a combination of the previously mentioned inputs. Additionally, it can be programmed to activate the brakes on an electric wheelchair and respond to e-stops. Both options must be configured using the DEScribe software.

Sabretooth 2x32
The Sabertooth 2x32 motor controller

If you can imagine a remote control robot or wheelchair design, you can likely find a way to bring it to life with the Sabertooth 2x32.
For the Sabertooth to work in the mode that you want, you must set the DIP switches correctly. Use this tool to choose the correct settings.

Sabertooth 2x32 User Guide & Joystick Holder Files


Repurposing the Joystick

We will reuse the joystick included in the wheelchair controller—it should be salvaged and used for future projects if you don't use it here. But note that you can create any analog or digital signal to feed into the Arduino and then interpret it for use in the Sabertooth. 
The headers on the wheelchair joysticks are quite small and something you might not want to work with without converting it into a larger pitch. The quickest way I found to move to a larger pitch is to simply clip the end off of the connector and crimp an RJ45 connector on the end of the wire, then from the RJ45 connector to either an RJ45 breakout or RJ45 Punchdown. The first four pins are all that are required for the easiest implementation.
If you are fortunate enough to have access to a laser-cutter/engraver, I have included a simple joystick holder you can cut out of 1/8" plywood that you can use for experimenting or as a jumping off point for further design in the attached .zip.

Pin IO / Ref Description Notes
1 In
Connect to Arduino 5V
2 Out Left / Right 1 Connect to Arduino A1
3 Ref Gnd Connect to Arduino Gnd
4 Out Fore / Aft 1 Connect to Arduino A0
5 Out Fore / Aft 2 Unused in the sample program
6 Ref
7 Out Left / Right 2
8 Unused

The joystick hooked up to the Arduino

                    //  Code to read contactless joystick outputs via Arduino.
int ForeAft_Pin = 1;        //Fore/Aft input is Arduino pin A1
int LeftRight_Pin = 0;     //Left/Right input is Arduino pin A0

float ForeAft_Input ;       // Expected Range 220-800
float LeftRight_Input ;    // Expected Range 220-800

void setup()               // Main Program Initialization
  Serial.begin(9600);      // Prepare debug information

void loop()
  ForeAft_Input = analogRead(ForeAft_Pin) ;
  LeftRight_Input = analogRead(LeftRight_Pin) ;


  delay( 100 );           // Just to slow down the output for debug

Hooking Up the Sabertooth


First, here are a couple of resources that you might find useful for these next sections:
Here's your checklist for connecting everything:
  1. Disconnect all power to all controllers and disconnect motors.
  2. Connect the Left Motor + and - wires to the M1A and M1B on the Sabertooth.
  3. Connect the Right Motor + and - wires to the M2A and M2B on the Sabertooth.
  4. Connect the positive brake lines from the left and right wheels to Battery + on the Sabertooth.
  5. Connect the battery wires to the Sabertooth (make sure the harness is not connected to the battery).
  6. Connect L Brake - to P1 and R Brake - to P2.
  7. Connect the Sabertooth S1 line to Arduino Digital pin 2.
  8. Connect the Sabertooth S2 line to Arduino Digital pin 3.
  9. Connect the Sabertooth 5V and 0V line to the Arduino 5V and Gnd lines.
  10. Connect the joystick's 5V and Gnd lines to the Arduino 5V and Gnd lines.
  11. Connect the joystick's output pins, Fore/Aft & Left/Right to Arduino analog 0 and 1.

Connection diagram. Click to enlarge.

L Motor +M1A
L Motor -M1B
L Brake +Bat +
L Brake -P1
R Motor +M2A
R Motor -M2B
R Brake +Bat +
R Brake -P2
S2Digital 3
S1Digital 2
5V5 V5 V
Analog input 0ForeAft
Analog input 1LeftRight

Using the Sabertooth with Arduino

Libraries and installers for Arduino can be found here.
Click here for the Sabertooth "DIP switch wizard." DIP switch settings depend on the mode you wish to use. We will be starting with packetized serial mode and setting the Sabertooth to receive at address 128
  1 2 3 4 5 6
Top row: joystick and e-stop
Bottom row: voltage regulators (left over from development), Arduino Uno clone, Sabertooth 2x32, and cable harness
  1. Connect the Sabertooth to the computer and download settings from DEScribe software.
  2. Connect the Arduino and download the code.
  3. Raise the wheels off the ground and connect the batteries—test it out.

                    // Software Serial Sample for Packet Serial
// Copyright (c) 2012 Dimension Engineering LLC
// Edited by Mark J. Hughes for AllAboutCircuits
// See license.txt for license details.


// Decide where you are going to plug the joystick into the circuitboard.
int ForeAft_Pin = 0;        // Plug Joystick Fore/Aft into Analog pin 1
int LeftRight_Pin = 1;      // Plug Joystick Left/Right into Analog pin 0

//Decide where you are going to plug in the Arduino
int Tx_pin = 2;             // Arduino Transmit Pin to Sabertooth S1
int Rx_pin = 3;             // Arduino Receive Pin to Sabertooth S2

// Create variables to read joystick values
float ForeAft_Input ;       // Variable to store data for Fore/Aft input from joystick
float LeftRight_Input ;     // Variable to store data for Left/Right input from joystick

// These variables allow for math conversions and later error checking as the program evolves.
int Fore_Limit = 800;       // High ADC Range of Joystick ForeAft
int Aft_Limit = 220;        // Low ADC Range of Joystick ForeAft
int Right_Limit = 800;      // High ADC Range of Joystick LeftRight
int Left_Limit = 226;       // Low ADC Range of Joystick LeftRight

// Create variables for Sabertooth
int ForwardReverse_power = 0; // -127 for full reverse, 0 for stop, +127 for full forward.
int LeftRight_power = 0;      // -127 for full CounterClockwise, 0 for stop, +127 for full Clockwise

SoftwareSerial SWSerial(Rx_pin, Tx_pin); // RX, TX on pin 2 (to S1).
Sabertooth ST(128, SWSerial); // Address 128, and use SWSerial as the serial port.

/*  Sabertooth can be used in independent or mixed mode.  We're using mixed mode which controls the motion
of both motors with a single command.  Independent mode controls one motor with one command */

void setup()
{;              // Send command to stop transldational motion
  ST.turn(0);               // Send command to stop rotational motion
  SWSerial.begin(9600);     // Establish serial connection to Sabertooth
  Serial.begin(9600);       // Establish serial connection back to computer for debugging

void loop()                 // Main program loop
// Read the joystick values
  ForeAft_Input = analogRead(ForeAft_Pin) ;              // Read the Fore/Aft joystick value
  LeftRight_Input = analogRead(LeftRight_Pin) ;          // Read the Left/Right joystick value

// Convert the joystick values to Sabertooth values
  ForwardReverse_power=map(ForeAft_Input,Fore_Limit, Aft_Limit, 127,-127);  // Translate and scale joystick values to Sabertooth values
  LeftRight_power=map(LeftRight_Input,Left_Limit, Right_Limit, 127,-127);  // Translate and scale joystick values to Sabertooth values

// Command the Sabertooth to drive the motors.;  //Command the Sabertooth translational motion
  ST.turn(LeftRight_power);        //Command the Sabertooth rotational motion

// Create debug information

  Serial.print(ForwardReverse_power); Serial.print("\t"); Serial.println(LeftRight_power);  //Debug


Next Steps

  1. Test your e-stops!
  2. Open the example files that come with the Sabertooth software and test the various transmit/receive functions available to use.
  3. Create a wireless controller with an nRF24L01+.
  4. Mount your hardware in an enclosure for extended use.
  5. Create a speed setting by adjusting the limits of the map function. Instead of typing 127, create a variable that can be adjusted to change the speed.  Also note that you can create code to eliminate reverse by replacing the map function with an equivalent.

                    /* Code to control speed */
//Decide what speeds to use with 127 maximum

int fast = 127;
int slow = 40;
int inPin= 5; // toggle switch on pin5 between gnd/5V

// Create code to change speed with SPDT toggle input
void setup(){
pinMode(inPin, INPUT);
speed = slow;
// Map 
void loop(){
} else {
speed = slow

map(x, Left_Limit, Right_Limit, -speed, speed);
/* End Code to control speed */

                    /* Code to customize controller mapping */
// Map truncates data -- if you need a bit more control ,or for some reason
// need to eliminate reverse, these functions should give it to you.

 float convertForeAftToServo(float y) {                         // take joystick input
   float result;                                                // create output variable
   result = ((y - Aft_Limit) / (Fore_Limit - Aft_Limit) * 180); // adjust equation to adjust output
   return result;

 float convertLeftRightToServo(float x) {
   float result;
   result = ((x - Left_Limit) / (Right_Limit - Left_Limit) * 180);
   return result;

/* End Code to customize controller mapping */

Here's a video of me testing my directional controls:

It Works! Now What?

Several hundred dollars and several hours later, you have now created a new Sabertooth-powered, Arduino-controlled robot via the joystick that came with it.  Are you pondering what I'm pondering?  Now instead of using just a joystick from an old wheelchair to control the robot, we need to get a bit more creative with our controllers:

  1. Makey Makey can be used to create very novel controllers
  2. Head tracking cameras
  3. Voice recognition controllers
  4. Muscle sensors
  5. Brainwave scanners
  6. Surface sensors
  7. Flex sensors
  8. Object tracking sensors
  9. Break beam sensors
  10. Accelerometer/compass sensors
  11. Single-channel or multiple-channel capacitive touch functionality
  12. Gesture sensors
  13. 9-DOF sensors

Hi, I`m Sostenes, Electrical Technician and PLC`S Programmer.
Everyday I`m exploring the world of Electrical to find better solution for Automation. I believe everyday can become a Electrician with the right learning materials.
My goal with BLOG is to help you learn Electrical.

Share this

Related Posts

Next Post »
My photo

Hi, I`m Sostenes, Electrical Technician and PLC`S Programmer.
Everyday I`m exploring the world of Electrical to find better solution for Automation. I believe everyday can become a Electrician with the right learning materials.
My goal with BLOG is to help you learn Electrical.