1. Do not share user accounts! Any account that is shared by another person will be blocked and closed. This means: we will close not only the account that is shared, but also the main account of the user who uses another person's account. We have the ability to detect account sharing, so please do not try to cheat the system. This action will take place on 04/18/2023. Read all forum rules.
    Dismiss Notice
  2. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Now a Download Plan!
  3. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  4. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant. Do not follow these rules can lead to permanent exclusion from this website: Read the forum rules.
    Are you a company? Read our company rules

help I do not know what to do Arduino + sabertooth

Discussion in 'DIY Motion Simulator Projects' started by dualclick76, Jul 12, 2015.

  1. dualclick76

    dualclick76 Active Member

    Joined:
    Mar 23, 2015
    Messages:
    163
    Location:
    italia
    Balance:
    11Coins
    Ratings:
    +40 / 0 / -2
    My Motion Simulator:
    2DOF, DC motor, Arduino
    sorry again if I do not understand at once the language is a problem anyway tomorrow I will do clearer pictures links
    • Useful Useful x 1
  2. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,159
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    148,640Coins
    Ratings:
    +10,909 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Please don't apologize, your English is actually pretty good, just be methodical with troubleshooting and pictures will really help others to formulate things to try and test.
    • Agree Agree x 1
  3. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,145
    Location:
    Oklahoma City, USA
    Balance:
    16,622Coins
    Ratings:
    +1,835 / 32 / -1
    Not to add in confusion, but I have attached another sketch I wrote. It is the easiest way to test your sabertooth. Just move the wire currently on pin 8 to the TX pin on your arduino and run this code. The serial output is set to 115200 baud. After a 2 second delay, it will start motor1 at half speed for .5 seconds, turn it off for .5 seconds, and then run at half speed in the opposite direction for another .5 seconds and then turn off. Then it will do the same to motor2. When motor2 has finished there will be a 5 second delay and then the code repeats. If it doesn't work at 115200 then try changing it to different baud rates and test them. Eventually you should find a working baud rate. Then we can go forward from there.

    ps. Again, change extension .txt to .ino and put dip switch 5 in the off position.

    Attached Files:

    • Useful Useful x 1
    Last edited: Jul 16, 2015
  4. Wanegain

    Wanegain Active Member

    Joined:
    Nov 6, 2013
    Messages:
    564
    Location:
    Bruxelles
    Balance:
    1,980Coins
    Ratings:
    +298 / 2 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 4DOF
    Hi !!

    Sorry for my late reply, I was on vacations...

    Please try the sketch from @BlazinH before testing what I give you.

    So you can connect your Sabertooth using USB to your PC in order to configure it with DEScribe software. You can use the file in attachment (you need to rename the txt in tooth) and load it in the Sabertooth.

    You can use the skecth given by link by @zigzag49. He gave you all configuration needed. The skecth is written especially for 2x32 wich can run 115200 bauds and using proper serial communication with checksum.

    I will read again carefully this subject because I read not all posts, because I don't have enough time...

    Attached Files:

    • Like Like x 1
  5. dualclick76

    dualclick76 Active Member

    Joined:
    Mar 23, 2015
    Messages:
    163
    Location:
    italia
    Balance:
    11Coins
    Ratings:
    +40 / 0 / -2
    My Motion Simulator:
    2DOF, DC motor, Arduino
    to get the situation clearer'll just make the connections and reinstall the drivers will make detailed pictures so you'll have a clear idea thanks for understanding
    • Like Like x 1
  6. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,145
    Location:
    Oklahoma City, USA
    Balance:
    16,622Coins
    Ratings:
    +1,835 / 32 / -1
    So that’s where the link is for the XPID_2x32! I must have overlooked it since it was not included in the English part of zigzag49’s text. If you are going to try that now and switch to packet serial operation it won’t do a lot of good to try my motor test code because the intent of it is to test legacy serial mode and find it’s baud rate.

    However, I usually don’t recommend using packet serial because it is over 4 times slower than legacy (simple) serial mode. However, it does have some advantages.

    If you just want simple motor control only though, there are really only three advantages to using it. The first is if your sabertooth is acting up due to serial communication errors. In legacy serial mode the sabertooth will respond to any error since it responds to single byte commands. In packet serial there is a checksum to test for errors and if there is one the sabertooth will discard it. However, if you are having communication issues you shouldn’t be unless the signal is being corrupted in route. So its better to fix that issue than to have the sabertooth do it by dropping commands. A bigger advantage imo in using pack serial mode is that you can connect an emergency stop switch directly to your sabertooth. This is not possible using legacy mode. And the final possible advantage is that you can use twice as many speeds with packet serial. I say possible advantage because for racing, in my case at least, there is no noticeable difference. However, you may see a noticeable improvement for flight when you are making very slow movements.

    Packet mode is slower because it uses 4byte commands vs. 1byte. It also must calculate a checksum, which takes even more time. One benefit of the 2x32 however is it can do 115200 baud where non-usb sabertooths are only 38400 max. But even considering that it will still be slower in packet serial mode than a non-usb sabertooth in legacy serial. Another issue slowing things down is, unless you use a mega with 4uart’s (hardware serial ports), you must communicate with your sabertooth using software serial from your arduino since it only has one hardware serial (connected to simtools). While an arduino is sending software serial, it ties up the processor until all bytes are sent. So packet serial ties it up four times longer.

    Now I don’t use the 2x32 or run any of these arduino sketches so I can’t say if using packet serial with them slows things down enough to be noticeable. But in theory, it for sure does.
  7. dualclick76

    dualclick76 Active Member

    Joined:
    Mar 23, 2015
    Messages:
    163
    Location:
    italia
    Balance:
    11Coins
    Ratings:
    +40 / 0 / -2
    My Motion Simulator:
    2DOF, DC motor, Arduino
    guys maybe I had missed the install
    these drivers "SyRen / Sabertooth Library for .NET (includes examples)"where should I install them?
    Last edited: Jul 17, 2015
  8. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,145
    Location:
    Oklahoma City, USA
    Balance:
    16,622Coins
    Ratings:
    +1,835 / 32 / -1
    You don't need it, just the arduino library. A sketch requiring a particular library will not successfully compile and download unless it has the require libraries installed already. If the arduino software says "done saving" at the bottom after uploading you have successfully installed the sketch on your arduino.
    • Agree Agree x 1
  9. Wanegain

    Wanegain Active Member

    Joined:
    Nov 6, 2013
    Messages:
    564
    Location:
    Bruxelles
    Balance:
    1,980Coins
    Ratings:
    +298 / 2 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 4DOF
    Use this link for library if needed.

    @BlazinH : very interesting anlysis. I don't understand why you said 4 byte ? Do I miss something in the datasheet ? :oops:
    FYI, at 115200 bauds the main loop takes between 1 and 2 ms for 4 motors (2 Sabertooth 2x32) using Serial communication :thumbs.
    I had some trouble using hardware Serial ports with Mega, it never worked... So I'm using software serial at 115200 and my Ard is communicating at 57600.
  10. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,145
    Location:
    Oklahoma City, USA
    Balance:
    16,622Coins
    Ratings:
    +1,835 / 32 / -1
    It is called packet serial because it sends a packet of bytes instead of just a single byte. It must send an address byte, a command byte, a data byte and a 7bit checksum. Because of the additional bytes packet serial can do a lot more but it takes more time to send them all.

    I use three sabertooth 2x60's with a Mega on uart1,2, and 3 but at 38400 baud and without issues myself.
    • Informative Informative x 2
  11. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,145
    Location:
    Oklahoma City, USA
    Balance:
    16,622Coins
    Ratings:
    +1,835 / 32 / -1
    Btw, I thought of another advantage in using packet serial and that is you can set an input timeout. So if your sabertooth doesn't receive an update within say for example 100ms, it will automatically stop the motors.

    Also, when I say something is slow or slower, that is a relative term. But if your satisfied with the motion you are getting, then its fast enough. For comparison, the SMC3 3dof sketch http://www.xsimulator.net/community/threads/smc3-sabretooth-test-version.6236/ does 4000 pid loops per second. From what you stated @Wanegain the sketch you are running does 1000 or less pid loops per second. Again, how much that matters though depends on your rig and your preferences.
    • Informative Informative x 2
    Last edited: Jul 17, 2015
  12. Wanegain

    Wanegain Active Member

    Joined:
    Nov 6, 2013
    Messages:
    564
    Location:
    Bruxelles
    Balance:
    1,980Coins
    Ratings:
    +298 / 2 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 4DOF
    For me the checksum was something important at this speed, but now I think that serial simplified is a very good solution ! And software serial works fine with my Mega using hardware serial port...
  13. dualclick76

    dualclick76 Active Member

    Joined:
    Mar 23, 2015
    Messages:
    163
    Location:
    italia
    Balance:
    11Coins
    Ratings:
    +40 / 0 / -2
    My Motion Simulator:
    2DOF, DC motor, Arduino
    DSCsetup.jpg I am here again, I ask you humbly apologize but unfortunately I can not get any results, I ask you to follow step by step, I mean from start to finish all the steps from the installation of the driver configuration Arduino Leonardo and sabertooth 2x32, place the photos I made connections thanks again for your trouble
  14. dualclick76

    dualclick76 Active Member

    Joined:
    Mar 23, 2015
    Messages:
    163
    Location:
    italia
    Balance:
    11Coins
    Ratings:
    +40 / 0 / -2
    My Motion Simulator:
    2DOF, DC motor, Arduino
  15. dualclick76

    dualclick76 Active Member

    Joined:
    Mar 23, 2015
    Messages:
    163
    Location:
    italia
    Balance:
    11Coins
    Ratings:
    +40 / 0 / -2
    My Motion Simulator:
    2DOF, DC motor, Arduino
    an information guru for you when I turn simtools Arduino LED lights RX
  16. Wanegain

    Wanegain Active Member

    Joined:
    Nov 6, 2013
    Messages:
    564
    Location:
    Bruxelles
    Balance:
    1,980Coins
    Ratings:
    +298 / 2 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 4DOF
    With the 2x32 you need to set 1,2 and 4 OFF if you use my original sketch (1 and 2 OFF if you use the sketch given by zigzag49) . But before you need to set the speed at 38400 with describe (115200 with the sketch sent by zigzag49).
  17. dualclick76

    dualclick76 Active Member

    Joined:
    Mar 23, 2015
    Messages:
    163
    Location:
    italia
    Balance:
    11Coins
    Ratings:
    +40 / 0 / -2
    My Motion Simulator:
    2DOF, DC motor, Arduino
    I ran to the letter the advice of your settings, but no movement, nothing happens either with your Arduino code is posted with that of zigzag49 - I do not know what is wrong -
    Last edited: Jul 20, 2015
  18. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,145
    Location:
    Oklahoma City, USA
    Balance:
    16,622Coins
    Ratings:
    +1,835 / 32 / -1
    You need dip switches 1 and 2 off and 4, 5, and 6 on to run the sketch from zigzag49 (leave switch 3 on with a psu). After looking at his sketch it has an auto baud feature so your 2x32 should set its baud rate automatically when you run the sketch.

    If you still don't get anywhere after trying that I strongly suggest you familiarize yourself with Describe software and use the "live test" feature to see if you can get your motors to move that way. Then you will at least know whether your issue lies there or elsewhere.
    • Informative Informative x 1
  19. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,145
    Location:
    Oklahoma City, USA
    Balance:
    16,622Coins
    Ratings:
    +1,835 / 32 / -1
    After more research I found the 2x32 won't auto baud so you will have to use Describe like Wanegain stated.
  20. dualclick76

    dualclick76 Active Member

    Joined:
    Mar 23, 2015
    Messages:
    163
    Location:
    italia
    Balance:
    11Coins
    Ratings:
    +40 / 0 / -2
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Immagine1.jpg Immagine2.jpg Immagine2.jpg Immagine2.jpg

    Attached Files: