Author Topic: programing in basic for an Sabertooth dual 25A motor driver  (Read 4426 times)

0 Members and 1 Guest are viewing this topic.

Offline epicjr77Topic starter

  • Jr. Member
  • **
  • Posts: 15
  • Helpful? 0
programing in basic for an Sabertooth dual 25A motor driver
« on: April 15, 2008, 08:04:34 PM »
Right now I have a rc robot with a Sabertooth dual 25A motor driver, and I just bought a parallax discovery kit with the basic stamp 2 micro controller.  I am trying to write a program that looks something like this for a differential drive

pseudocode:

if bumper switch is open

drive straight until switch closes

if switch closes

pause

back up

rotate

and loop

The saber tooth looks like there is 2 ways to do it

#1) Mode 1: Analog Input

 Analog input mode takes one or two analog inputs and uses those to set the speed and direction
of the motor. The valid input range is 0v to 5v. This makes the Sabertooth easy control using a
potentiometer, the PWM output of a microcontroller (with an RC filter) or an analog circuit.
Major uses include joystick or foot-pedal controlled vehicles, speed and direction control for
pumps and machines, and analog feedback loops.

#2)  Simplified Serial Mode

Simplified serial uses TTL level single-byte serial commands to set the motor speed and
direction. This makes it easy to interface to microcontrollers and PCs, without having to
implement a packet-based communications protocol. Simplified serial is a one-direction only
interface. The transmit line from the host is connected to S1. The hostís receive line is not
connected to the Sabertooth. Because of this, multiple drivers can be connected to the same serial
transmitter. If using a true RS-232 device like a PCís serial port, it is necessary to use a level
converter to shift the Ė10V to 10V rs-232 levels to the 0v-5v TTL levels the Sabertooth is
expecting. This is usually done with a Max232 type chip. If using a TTL serial device like a
microcontroller, the TX line of the microcontroller may be connected directly to S1.
Because Sabertooth controls two motors with one 8 byte character, when operating in Simplified
Serial mode, each motor has 7 bits of resolution. Sending a character between 1 and 127 will
control motor 1. 1 is full reverse, 64 is stop and 127 is full forward. Sending a character between
128 and 255 will control motor 2. 128 is full reverse, 192 is stop and 255 is full forward.
Character 0 (hex 0x00) is a special case. Sending this character will shut down both motors.


Which is easier?  I would like to use choice #2 but I am not sure how to get the basic stamp to output numbers to control the motors?

As for the first way I dont even know where to start

Thanks-John
 
   

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,660
  • Helpful? 169
    • Society of Robots
Re: programing in basic for an Sabertooth dual 25A motor driver
« Reply #1 on: April 24, 2008, 06:44:33 PM »
It also has an RC mode, which personally I think is the easiest.

Just send it a signal as if it was a servo, and you're done! The parallax should already come with servo code, and you plug the motor driver in the same way.

(the sabertooth manual will explain how to set it into RC mode)

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: programing in basic for an Sabertooth dual 25A motor driver
« Reply #2 on: April 28, 2008, 09:04:11 AM »
the serial command in basic is SEROUT  look it up online , there are plenty of examples
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline epicjr77Topic starter

  • Jr. Member
  • **
  • Posts: 15
  • Helpful? 0
Re: programing in basic for an Sabertooth dual 25A motor driver
« Reply #3 on: April 28, 2008, 09:23:35 PM »
I have tried it in Rc mode and it seams like the sabertooth does what it wants, I have written a simple pulsout code just to send the wheels forward, and they will go forward stop reverse and keep changing speeds, almost like a RC car would when it runs out of range,  but this is weird becuase when I put it in rc mode and use a remote controll it runs fine?  any ideas?

Offline epicjr77Topic starter

  • Jr. Member
  • **
  • Posts: 15
  • Helpful? 0
Re: programing in basic for an Sabertooth dual 25A motor driver
« Reply #4 on: April 28, 2008, 09:45:27 PM »
Something else I noticed. Dimension engineering said to send pulses from 1000 micro sec to 2000, I have tried thatas well as between 650 to 850, and both do the same thing

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,660
  • Helpful? 169
    • Society of Robots
Re: programing in basic for an Sabertooth dual 25A motor driver
« Reply #5 on: April 28, 2008, 09:56:22 PM »
Just to make sure . . . are your grounds common between your microcontroller and the sabertooth?

Offline epicjr77Topic starter

  • Jr. Member
  • **
  • Posts: 15
  • Helpful? 0
Re: programing in basic for an Sabertooth dual 25A motor driver
« Reply #6 on: April 28, 2008, 09:58:54 PM »
I am not sure, I am new at this, how would I do that?  are you saying I should have a wire going from my 0v on my saber to my Vss on the BS2?
« Last Edit: April 28, 2008, 10:01:07 PM by epicjr77 »

Offline epicjr77Topic starter

  • Jr. Member
  • **
  • Posts: 15
  • Helpful? 0
Re: programing in basic for an Sabertooth dual 25A motor driver
« Reply #7 on: April 28, 2008, 10:43:03 PM »
ok I figured it out, I ran a ground wire from the saber to the BS2, and then I ran it in normal servo pulse width 650 to 850, thanks for all your help

 


Get Your Ad Here