A new version of my previous sketch !
Now you are able to drive up to 6 motors with only one Arduino (be careful you need at least 7 analog inputs for 6 motors) and you can use serial monitor to talk with your Arduino.
Let's look at this file before uploading to Arduino :
- First thing do to after extracting : copy the folder Sabertooth in Documents\Arduino\libraries
- You can notice the config.h file : THIS IS THE ONLY FILE YOU NEED TO EDIT and it must be in the same directory than the ino file.
IMPORTANT NOTE : this sketch has been written for an Arduino Micro, if you are using another model, please be sure all pin exists (even you will not use it) otherwise you will probably have an error message when compiling.
- Define numbers of motors you will use (4 default)
- Deadzone : global deazone (5 default)
- Read Analog : Arduino will read "Read Analog" times values of potentiometers to reduce noise (4 is default)
- Pin standby : pin where you can add a switch (connected to ground on other side) to force all motors to move in a standby position (defined in parameters for motors)
- Pin power and Use pot : you can use a potentiometer for global power (0 to 200%) and specify a pin. To enable this option you need to set Use pot = 1 and of course the pin used by the potentiometer.
- Speed pos is the maximum speed when Start/stop commands are received (30 default ~ 25%)
- For each motors you can set different options : pot min, pot max, deadzone, standby value (used too when idle) and P.I.D values.
If you are using less than 6 motors, you can set all unused pins for potentiometers with same value (A4 for example)
As I said, you can talk with your Arduino using serial monitor :
Just type :
XV00C : to know the current version of sketch
XC00C : to see the global parameters (read analog, deadzone, speed post, etc...)
XM00C : to see all parameters for all motors
XP00C : to see real time values of potentiometers (retype XP00C to stop it)
Simtools configuration :
Serial 57600 bauds 8N1 10bits BINARY
Start : XS00C 5ms
Interface : X1<Axis1a>CX2<Axis2a>CX3<Axis3a>CX4<Axis4a>CX5<Axis5a>CX6<Axis6a>C 5ms
Stop : XE00C 5ms
Sabertooth 1 S1 : pin 2
Sabertooth 2 S1 : pin 3
Sabertooth 3 S1 : pin 4
for potentiometers and switch see config.h file
You must be a registered member to be able to access this page and to download game plugins. Please register here. It´s for free.
Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
Arduino + Sabertooth 2x32 up to 6 motors 1.8
Arduino sketch for Arduino and up to 3 Sabertooth 2x32 (6 motors)