Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.

Get Started
United Kingdom
Asked — Edited

Sabertooth 2X25 And Ez-B V4 Simply Serial Connection

I have received my very first Sabertooth 2x25 motor controller today, and looking to hook it up over the weekend. I've spent the afternoon looking through the forum finding all of the necessary information, as well as the Sabertooth Serial tutorial to find out what I need for a successful connection. I've combined all of the essential information and laid it out below like a basic tutorial for others to follow should anyone need it. But I'd be grateful for some help as I do have a couple of questions at the end of the this post, and would like conformation that I have the tutorial part correct.

This is for a two drive wheeled robot with differential (tank style) steering.

Connecting the Sabertooth to the EZ-Bv4.
NOTE: This example will use EZ-B v4 Port "DO", but any EZ-B digital port will work.

User-inserted image


The "S1" terminal on the sabertooth, connects to the D0 Signal (white) pin on the EZ-B.

The "0V" terminal is "Ground" on the sabertooth, and connects to the D0 ground (black) pin on the EZ-B.

Connecting Motors.

User-inserted image


One DC motor connects to M1A and M1B terminals on he sabertooth.

Second DC motor connects to M2A and M2B terminals on he sabertooth.

Connecting Motor Battery.
NOTE: Wiring has to be correct, as the sabertooth does not have reverse polarity protection.

DC motors positive (red) battery cable connects to "B+".

DC motors negative (black) battery cable connects to "B-".

[u]Dip Switch Setting for "Simplified Serial at 38400 baud rate.[u]

User-inserted image


Switch 1 Up,
Switch 2 Down,
Switch 3 Up,
Switch 4 Down,
Switch 5 Down,
Switch 6 Up.

I have also read that some members had trouble with the 38400 baud rate, and used 9600 baud rate with the fallowing dip switch settings...

Simplified Serial at 9600 Baud Rate.

Switch 1 Up,
Switch 2 Down,
Switch 3 Up,
Switch 4 Down,
Switch 5 Up,
Switch 6 Up.

Connection initialisation script.

Place the following code in the EZ-B "Connection Control" script editor, or "Init" script that connects to the EZ-B connection control.

Code:

#Connection INIT command to put motors in a "Stopped" state.

#NOTE: If using 9600 baud rate, edit the following script from "38400" to "9600".

SendSerial(D0,38400,0)



Setting Up Custom Movement Panel.

The following scripts are added in to the custom movement panels script editor...

Code:

#NOTE: If using 9600 baud rate, edit the following script from "38400" to "9600".

# Forward
# Motor 1, 127 is full speed forward.
SendSerial(D0,38400,127)

# Motor 2, 255 is full speed forward.
SendSerial(D0,38400,255)


Code:

#Reverse
# Motor 1, 1 is full speed reverse.
SendSerial(D0,38400,1)

# Motor 2, 128 is full speed reverse.
SendSerial(D0,38400,128)


Code:

# Differential Turn Right
SendSerial(D0,38400,255)
SendSerial(D0,38400,1)


Code:

# Differential Turn Left
SendSerial(D0,38400,127)
SendSerial(D0,38400,128)


Code:

# Stop
SendSerial(D0,38400,0)


I believe I have the above information correct, but I do have a couple of things I am unsure of.

1.) If the EZ-B has its own battery, and the Sabertooth has its own battery, does there need to be a common ground between the Sabertooths battery ground (B-) terminal, and an EZ-B ground port or EZ-B battery ground... or is this not necessary as the Sabertooths "B-" and "0v" share a ground circuit?

2.) If using a two drive motor setup with independent "differential" steering, is the Sabertooth to EZ-B connection just "S1" to "D0 signal" and "0v" to "D0 Ground" as mentioned above... or is the "S2" terminal used (S1 = left motor, S2 = right motor, and connects to another signal port (D1 for example)? The only reason I ask this, is what I've seen in other threads, it looks like members use just the S1 terminal for two motors, but the sabertooth documentation says S1 and S2 are for separate motors.

Thanks.

AI Support Bot
Related Content
Synthiam
Based on your post activity, we found some content that may be interesting to you. Explore these other tutorials and community conversations.
#1  
1, the ground to the ezb from the 5v side or communication side is sufficient. There is no need to connect the negative on the batteries.

[Edit] you will have to have a common ground between 2 batteries if using one battery for the motors and a different battery for the ezb. [/edit]

2. the S2 is normally used for sending data out of the sabertooth. You can chain multiple sabertooth controllers together by taking S2 to S1 on the next one. It is also possible to get data back from the kangaroo if you used that in the scenario but it looks like this isnt what you are doing. It also depends on what mode you are using as to how these connections work. Simplified Serial is the easiest.
Simplified serial uses one command to determine which wheel to move and how fast. A single byte is used to do this. 0-255...

0-127 is for one wheel with 64 being stop. 128 to 255 is the other wheel with (191?) being stop.
#2  
1) Yes, they must have a common ground or the signal will not work.

2) Just one digital port can drive both motors. I believe if you were to try R/C mode (or any of the other non-serial modes) you would need two connections, one for each channel.

Alan
#3  
The communications side of the sabertooth would have the ground to the v4, along with the send signal from the v4 to the receive signal (s1) to allow simplified serial to work. The ground wire would serve as your reference.
United Kingdom
#4  
Thanks for the input guys.

I figured there would have to be a common ground like other motor controllers do with separate power supplies. I did see you (Alan) mention about using a common ground in one of the threads I looked at, but just wanted to make sure.

That's good to know about the S2 terminal as well, and nice to get clarification of that. I guess the rest of what I wrote was correct.

Thanks again.:)
#5  
I assume you have also read about the power sink? The Sabertooth will try to send power back to the battery if you move the wheels (regenerative braking), so if you turn it off by disconnecting it from the battery, there is nowhere for that power to go and it can damage the sabertooth.

Dave C had some good information about having a switch and a diode so when you flip the switch no power goes from the battery to the sabertooth, but power can still flow back to it in case you are pushing your robot around.

Alan
United Kingdom
#6  
@Alan.

No, I didn't see that. I was aware about the power regeneration thing, but didn't know about what you mentioned. To be honest, for what I'm using it for, if I need to move the robot with no power, I just lift it rather than pushing it around (although I do have another robot, K9, which I do push around if needed, and may upgrade his motor controller to a Sabertooth one day, so this info is very helpful).

Thanks Alan.
United Kingdom
#9  
Thanks for the link Alan.
#10  
The sabertooth is my baby...LOL... The best motor controller in the world....:) Wouldn't build a robot without one.....
United Kingdom
#11  
@Richard.

Quote:

The sabertooth is my baby...LOL...


Really? I would never had guessed, lol. Seriously though, I said to you I would get one... eventually, so I figured it was about time to step up. It is an expensive bit of kit, but I've only seen good things said about it from yourself and pretty much everyone else who uses one, so I don't mind paying out for quality and reliability. 2x25 maybe bit of overkill for what I need it for, but better safe than sorry.:)
#12  
@Steve... they are rock solid... although they don't have reverse polarity protection (don't ask me how I know that... think magical blue smoke) they will simply shut down if the motors attempt to draw too much current, which is an awesome feature.... They are expensive as you mentioned, but I really like them.... I think that they are very versatile and only take up one port (or uart) on the ezb.... And as a bonus you can use a kangaroo for feedback if need be... I actually haven't used the kangaroo (even though I have 2) yet but one day, especially if David gets his LIDAR plugin complete I will be definitely using them....
United Kingdom
#13  
Yeah, that's a great point. The one v4 port thing really is a bonus too.
#14  
Steve, I did some testing this morning and found out that a previous statement from me was wrong. You will need to have the grounds from the two batteries connected. Sorry about the misinformation earlier. Alan is correct in this.
United Kingdom
#15  
Not to worry David. Thanks all the same.:)