Connecting MRL to Sabertooth


I'd like to connect my laptop with MRL to a Sabertooth 2x25 Motorcontroller and controll it with MRL. But i dont know how to do it exactly. 
(Furthermore is it possible to send Wii nunchuck extracted Data from an arduino to MRL? In From of an array.)

Thx for your help. =)

GroG's picture

Hello Kakadu31 and

Hello Kakadu31 and Welcome.

My first suggestion is - You don't need the Arduino.
Go from Computer USB port --->  USB FTDI cable --> Sabertooth input

Otherwise Serial info needs to be "relayed" through the Arduino 
Computer USB port ---> USB  --> Arduino --> Sabertooth

Serial "relay" through Arduino has been on the list for a while - but its not been implemented yet...

as for question #2 :

Yes .. Probably...   Its software right?  Given enough time & energy Anything can be done ! ;)
Your using the Nunchuck Arduino library ? 

Can elobrate about your project more?

Kakadu31's picture

Thanks for you fast answer

Thanks for you fast answer =)

Well so i'll connect it with an FTDI-Cable. I saw about the Sabertooth service but the documentation site wont load for me. I guess the service will deal with the different "commands" of the serial connection and replaces them with simple commands like. ST.motor(x, speed) or something?
I'm relatively new to serial connections, can you tell me how to set up the connection and which methods are built in the sabertooth service? 

Well about my project: I have the bottom part of an eletric wheelchair with 2 12/24V motors with a sabertooth 2x25. I connected a 25A fuse  to protect my sabertooth just in case, and i use a 12V lead-acid-battery. My plan is to build a multifonctional robot on top of this setup. I managed to drive it with an arduino and a wii nunchuck now and wanted to connect it now to my old laptop with MRL to step by step add functionalitys. My first will probably be OpenCV with Facefollowing or something. (It will be a project on the long run so i dont know what i will eventually add =))

But to do this I need to get my Laptop to "talk" with the motordriver =)

I've done serverall Arduino programming and im new in python. In this semester i'll do a java-lesson so i hope it'll be easier for me to understand most things in MRL.

Thanks for all the support i get in here! ;).

GroG's picture

Change your avatar ! - you

Change your avatar ! - you obviously are not a scared gopher if you are working on getting a wheelchair moving ! :)

Excellent idea having the fuse.

When initially experimenting with a new control system I would strongly recommend putting the wheelchair on blocks (even without blocks I remember blowing fuses going full speed one direction then accidently going full speed reverse)

After connecting (and grounding) the FDTI Cable - I would grab the latest build of MRL 
Here - latest build (its a link above the shoutbox) and start it in a new directory.  

You might have some conflict depending on if you installed a previous version of MRL.  MRL installs its own .repo in your user directory for service dependencies.  The latest build and 1.0.119 differences are huge, but you can solve this simply by deleting the .repo directory - install the latest myrobotlab.jar build in a directory - then install all services (runtime -> system -> install all).  When services and their dependencies install it takes a while (this is when the .repo directory fills up with jars again)

At some point you should be able to do the command java -jar myrobotlab.jar  and the new version should come up ready to serve you.  Let me know when you get this far, or have trouble on the way.  From there we can get the Sabertooth going.

Welcome Aboard ! :)


Kakadu31's picture

Step I: Changing Avatar: done ;)

First of all: Thanks for your great support =).

About my build: I want to use the old laptop of my sister do do my project. I installed ubuntu on it and now i installed the myrobotlab version 1.0.97 (gui775). Is it the right one? =) All of my services are marked green with the "latest" lable and i already tried to start some and it works. (Atleast on manuell)

My FDTI-Cable will arrive in 2-4 days depending on my luck =).


GroG's picture

Cool .. yes your on the right

Cool .. yes your on the right track ...

Your looking at  the Swing gui (its rather load) - one of the nice things about MRL - is that its a framework .. and the GUI is just another service in that framework ....

I'm telling you this because we are moving to the WebGui ...  -> There's an online demo of it - link above the shoutbox - or you can start your own by starting a WebGui instance.. 

Its good if you push buttons and pull levers to try to get familiar with it ..  not everything works, but we are just a few elves working with our spare time...

Kakadu31's picture

I opened the WebGui Service

I opened the WebGui Service over the usual GUI and tested around. Some of the Services i created doesn't work like you said, but i tested around with the Arduino Service and it worked everything fine. Oh and the release button didnt work fine in my WebGui.

Kakadu31's picture

I got my FDTI cable and

I got my FDTI cable and switchet the DIP-switches of the Sabertooth to packetized Serial, sonnectet the TX cable to S1 and GND to GND the only port showed for me and disappearing if the cable is unplug was /dev/tyyUSB0 so i used it.

I tried it with code like:

Sabertooth.RuntimeCreateAndStart("Sabertooth", "Sabertooth")


but noithing happened, so i guess i first have to really know if my FDTI-cable works for me? but i dont have a clue how i should test it. (I dont have an oscilloscope).

GroG's picture

Ahahah :)  ... You've gone a

Ahahah :)  ... You've gone a bit far .. 
I got to catchup 

You got the right idea - and I tried it too ... but I had never tested my Sabertooth (ever) ..

So this is great to be able to work together ...

Anyway, like most things I wanted to test the very basics before I started debugging MRL code ..

IT WORKED !   Albiet its not what we want.  This is connected to an Arduino, using a serial line, with the packet protocol.  But, like I said, I wanted to make sure the hardware worked before I started debugging the MRL code ...

Here's my test...

I think I might have the auto-baud rate not correctly set - I should be able to see what is being sent by the working Arduino program and adjust MRL accordingly.

Thats my next step.

Kakadu31's picture


Well it looks nice already and in the worst case i can use this setup for my project, i have some arduino bootloaded chips around ;)

For my part i managed to test my Ftdi-cable with cutecom and connected the Tx an RX wires with a resistor and it worked! I got the same characters back which I sent. Then i hooked the sabertooth in simple serial mode to the cable and tried to send an few numbers to see what happens. One of the motors just started turning no matter what i sent

I guess both of my tests showed that my drivers are installed correctly and my cable is able to send the serial commands. I think its at least a mini achievement..^^

What do you suggest me to do next? I
'd happy if i could help you to get the service running and maybe writing a simple tutorial when everything works like expected, so It will be as easy to use a Sabertooth with MRL like a servo and arduino =)

GroG's picture

Nice ! ..   Tutorials are

Nice ! ..  
Tutorials are always welcome.
As for the debugging - I just found something ....

They send a sort of CRC check as the last byte - they add the address + command + data and bitwise it with a constant ... I was just adding the address plus some contstants :P

I'll fix and test ...


GroG's picture



Motor Moves    MRL ---FTDI ---> Sabertooth !

I'll clean it up, check it in and post a quick Python sample tonight.

WoooHoo !

GroG's picture

Gui's can be a PITA

I didn't get as far as I hoped with the GUI .. but its starting to come together...

A Motor gui will need a list of MotorControllers which can support it.
Then it gets a little more tricky, where depending on "type" of motor controler determines what the user needs to configure.

For Arduino and a simple (safe/no-smoke) H-Bridge there is a direction pin and a power pin.
For Adafruit Motor Shield - it selecting 1 of 4 ports.
For Sabertooth its select 1 or 2 ports...

Still have some work to do...

GroG's picture

Just so I won't hold you up,

Just so I won't hold you up, I've tested a new Python script I tested...  it works.. 

You should be able to make it work, running the Python (the GUI will take a while)...

The script is at the bottom of the service page.

You will need the 'latest build' - this link can always be found at the top of the shoutbox.

Change the port accordingly, it should slowly ramp up and ramp back down then stop.. let me know if you have any problems.


Kakadu31's picture

Awesome! I''ve tried it and

I''ve tried it and it runs exactly how it should for me =). I'll test the other features like max, min voltage at the given time. But now i've got the Problem, tht in the latest build my opencv doesnt start correctly but in the version 1.0.99 it does? can i cross use both versions?

GroG's picture

Cool..  The "latest" has the


The "latest" has the latest OpenCV 3.0 + JavaCV 1.1 ...  we've noticed some problems...

One big problem you might have is the (.repo) ... the dot repo directory is in your user home (with the /dev/tyyUSB0 reference, I'm assuming your on Linux?) 

To get thing in sync (not necessarily working) - I would recommend that you :

  • don't mess with anything but the "latest" - if you find problem in older versions we are not going to fix it .. there are only so many elves, and they are all busy on the latest
  • delete or move the .repo - this is a cache of mrl's repository - it might be a 1.0.99 version it might be latest version ... we don't want to take chances ... rm -rf it (no survirors)
  • from the directory your running the "latest" remove the (.myrobotlab)  dot myrobotlab directory - then start the latest jar again - it should think it has no dependencies installed (use the old swing gui) - runtime -> system -> install all   ... this will download all the "latest" dependencies from the develop repo (and populate your local .repo cache)
  • try OpenCV again now .. it may still not work, but at least you guaranteed to be using all the latest parts, and if it doesnt work, we'll send some good elves to check it out..

Good Luck !

Kakadu31's picture

A few more steps...!

Thx for your tipp, i dont know where the problem was exactly but i build everything new  from scratch and now the sabertooth and opencv services are working with the latest build! You Sir definitely know what to do..!

I got a last problem. My tracking service dont work properly anymore. If I start it with this script for example:

The tracker doesnt connect to my arduino and the tracker.opencv service doesnt show an image.

But when i connect to the arduino via my  skript (at the end of the post) it works properly and i can even move my servos flawless. Furthermore my opencv service strts correctly and i can add a filter... But!:    As soon as i start the filter Facedetect or Detector (LKtracking is working correctly) my active camera stream freezes or will not start atl if the filter is started directly.
So i guess that may be the problem for the tracking service.


Tested Skript:

arduino = Runtime.createAndStart("arduino","Arduino")
opencv = Runtime.createAndStart("opencv","OpenCV")

servoXPin = 9
servoYPin = 3

servoX = Runtime.createAndStart("servoX","Servo")
servoY = Runtime.createAndStart("servoY","Servo")
servoX.attach(arduino.getName(), servoXPin)
servoY.attach(arduino.getName(), servoYPin)



GroG's picture

The issue is the cascaade

The issue is the cascaade data ... for some reason OpenCV3.0 does not work with the cascade xml data they packaged with it - it works with 2.4.10 ... I'll bundle it and send you a link shortly..

OpenCV Worky !  Yay ..  its often a big pain jumping versions of OpenCV..

So for verification.. what platform is all this goodness running on Linux 64 bit Ubuntu ?


Kakadu31's picture

Its running on Ubuntu 14.04

Its running on Ubuntu 14.04 LTS 64-bit on an old vaio with AMD Hardware, anything more to add?

So i just delete and replace the file ? sounds pretty easy cmparing to the previous problems. Atleast for me if you've already done the work.. ;)

Is it also normal, that the tracker doesnt even connect to the arduino if the OpenCV error occurs? Is there any literature you can suggest me to learn about all the mrl like stuff? I mean where did you guys learn all this things? Would be great if i wouldnt rely as much on you and could help out a bit.

GroG's picture

remove haarcascades from the

remove haarcascades from the myrobotlab.jar directory

replace with this -

should help with the "freezing frame" of Tracking...

Kakadu31's picture

And another think worky. The

And another think worky. The facedetect filter is now running quite fluently but the tracker service is still buggy. It starts all services needed but doesnt connect to the arduino and doesnt show a videostream neither. And i cant manualy in the GUI correct it. The arduino port select is not working and the capture button of Opencv doesnt respond neither. 

GroG's picture

Ok ... this is the plan I

Ok ... this is the plan I have so far..

  • I'll need to replace the non workin haar (3.0) with the working haar (2.4.10) data in the repo - so others won't experience the (freezing face detect)
  • I'll look into debugging the Tracker

It will take me a little while to get to it... still have quite a few small projects and house-cleaning to take care of...   

After Tracker is worky again... what say you make a fresh defacto Tutorial video ... hint hint wink wink nudge nudge...


Kakadu31's picture

Well so i think i might just

Well so i think i might just start the project with raw opencv data instead of servo data, shouldnt be too hard to switch it afterwards i guess...
Take your time man i know how much time and effort you put in the entire MRL, thats more than enough ;)

Well about the tutorial i can give it a try!
When it's time just tell me what to get in, but atm i dont have any video programm or experience with video tutorials yet.