SaberTooth 2 x 12/BBGW/Motor Bridge Cape

Drive some geared, DC motors via 12vDC lead acid battery w/ the BBGW, Sabertooth 2 x 12, and a Motor Bridge Cape attached!

Categories: Beginner

Hello and Okay,

Seth here. I wanted to use this older model board that I thought could handle some power. It could and it still can. It is the SaberTooth 2 x 12. I linked the SaberTooth 2 x 12 in the beginning if you are interested.

I have a BeagleBone Green Wireless and Motor Bridge Cape attached. I am using UART2 on the BBGW via the Motor Bridge Cape header, i.e. P9_21.

I used this command:

sudo config-pin P9.21 uart


To write a .sh file to /usr/bin/yourfile.sh, use your favorite editor. Then, type this in your .sh file:

#!/bin/bash

sudo config-pin P9.21 uart 


Next…we need to start a service at /etc/systemd/system/yourfile.service.

[Unit]

Description=Starting Config-Pin on Boot

[Service]

ExecStart=/usr/bin/yourfile.sh

[Install]

WantedBy=multi-user.target


This basically opens my UART2 "pins" on the BBGW and b/c those header pins are not used by the Motor Bridge Cape, I was able to use them to make some much needed connections to the SaberTooth 2 x 12 at this example:

BBGW: P9_21 to S1 :SaberTooth

BBGW: P8_02 to OV :SaberTooth 


P8_02 on the BBGW is GND. 0V on the SaberTooth is just that, GND.

Now…I had to install via pip a "special" library from GitHub.com. See below:

sudo pip install pysabertooth


That will build the software on your BBGW so you can use it.

Here is an odd video of the current prototype w/ some way-far-gone music. Enjoy!

The software is complicated to me for some reason. I never said once that I had a Master Degree in Programming. So, besides that one little flaw in me, I tried to program it anyway and see what would happen.

from pysabertooth import Sabertooth

saber = Sabertooth('/dev/tty.usbserial', baudrate=115200, address=128, timeout=0.1)

# drive(number, speed)

# number: 1-2

# speed: -100 - 100

saber.drive(1, 50)

saber.drive(2, -75)

saber.stop()


I am pretty sure that software is the given software from their site which is located at
https://github.com/MomsFriendlyRobotCompany/pysabertooth.

Above, in the software snippet, where it shows on line three that "/dev/tty.usbserial", use your UART combo of pins to communicate instead of USB since you are using the SaberTooth 2 x 12. This board, to my knowledge, does not carry USB tech. on it. At least, my version, V 1.00, did not have a USB attachment to it.

So…

If you are using UART2 like I am right now, the above line three where I was specifically describing in the software should read something like this idea:

saber = Sabertooth("/dev/ttyO2", baudrate=9600, address=128, timeout=0.1)


That should get you going w/ running some motors on the SaberTooth w/ the BBGW. So, after you get the UART2 location on your BBGW situated w/ the above section of software for line two of the example, use this software as another example:

from pysabertooth import Sabertooth

import time

saber = Sabertooth("/dev/ttyO2", baudrate=9600, address=128, timeout=0.1)

saber.drive(1, 85)

saber.drive(2, 85)

time.sleep(15)

saber.stop()

saber.drive(1, -60)

saber.drive(2, -60)

time.sleep(15)

saber.stop()

saber.close()


This will get your motors to work in both directions. Do not forget to use packetized serial for the Sabertooth. It is the number 1 & 2 switch on your switches and both need to go up for the 9600 baudrate!

You can find
BeagleBoard.org/latest-images
to give many examples of OS/images to grab so you can start development.

Seth

P.S. If you want other software, please visit the
github.com
page in the attachments. Thank you for your time. Oh and this is a fact….please disable your service after changing files, reload the daemon, and then enable your service again.

Comments are not currently available for this post.