Squirrels have fuzzy tails.
0 Members and 1 Guest are viewing this topic.
Took me awhile to jump through your recent posts, to find out which motor controller you had. I believe it is a sabertooth 2x25, which you can hook up several different ways. The Sabertooth you are using can be controlled 4 different ways (Analog, RC, simple Serial, and Packet serial). Personally I would go with Packet Serial with the Arduino 2560. I would connect it up to one of the 4 hardware serial ports (Not 0 as this is your USB). You need to run a wire from the TX of the USART to I believe S1 on the controller and RX to S2 and run a ground wire between the two boards. I have not done this with your setup, but have done similar with Arduino to a Basic Micro Roboclaw controller. (I did this with a non mega Arduino board using software serial to talk to the roboclaw), but it would be even simpler with the MEGA.Kurt
// Labels for use with the Sabertooth 2x5 motor controller// Set to 9600 through Sabertooth dip switches#define SABER_BAUDRATE 9600// Simplified serial Limits for each motor#define SABER_MOTOR1_FULL_FORWARD 127#define SABER_MOTOR1_FULL_REVERSE 1#define SABER_MOTOR2_FULL_FORWARD 255#define SABER_MOTOR2_FULL_REVERSE 128// Motor level to send when issuing the full stop command#define SABER_ALL_STOP 0#define SaberSerial Serial1void initSabertooth( void ){ SaberSerial.begin( SABER_BAUDRATE ); // 2 second time delay for the Sabertooth to init delay( 2000 ); // Send full stop command setEngineSpeed( SABER_ALL_STOP );}
Hi Again got your message, better to answer here, so that others can make use as well.Since you are using a hardware serial port, you don't need to use the software serial to talk to the Arduino.You should change the start of the program to look more like:Quote// Labels for use with the Sabertooth 2x5 motor controller// Set to 9600 through Sabertooth dip switches#define SABER_BAUDRATE 9600// Simplified serial Limits for each motor#define SABER_MOTOR1_FULL_FORWARD 127#define SABER_MOTOR1_FULL_REVERSE 1#define SABER_MOTOR2_FULL_FORWARD 255#define SABER_MOTOR2_FULL_REVERSE 128// Motor level to send when issuing the full stop command#define SABER_ALL_STOP 0#define SaberSerial Serial1void initSabertooth( void ){ SaberSerial.begin( SABER_BAUDRATE ); // 2 second time delay for the Sabertooth to init delay( 2000 ); // Send full stop command setEngineSpeed( SABER_ALL_STOP );}The rest of the code should not have to change to use the hardware serial. Also make sure the dip switches on your Sabertooth are properly set for packet serial mode at 9600 baud.Kurt
Yes, you should change the start of your program to what I mentioned.Yes the wiring you mentioned sounds correct, but in addition you need a ground wire between the two boards, as signals (electricity) can not flow if it does not have a return path to make the circuit.The dip switches on the Sabertooth needs to be set correctly. Dimension Engineering documents show what each switch does, or you can try their wizard: http://www.dimensionengineering.com/datasheets/Sabertoothdipwizard/start.htmNote: looking closer at your program, it looks like it is using the simplified serial communications. For 9600 baud I think it would be something like: 101011 But I am guessing as I depends on what type of battery you wish to init for... On Arduino, you use the upload command to download your compiled program to your board. Don't remember which board you are using, but you need to configure the IDE to your board type. Sometime soon, I will upload my rover code. It will probably be put up on the Lynxmotion forums, once their new Arduino board is ready to ship.KurtHi kurt, I am using 4 AA batery Alkaline and using DIP Swithc 9600, What is the IDE configuration for?, I am using Mega 2560, After connecting the ground, the motor does not seem to run. I hope my ground is correct, i connect the ground on the header pin on my arduino.I will update again kurt, hope i can sort out the problem