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

Tutorial SPS - Sabertooth Packet Serial PID motor driver sketch w/SoftStart

Discussion in 'SimTools compatible interfaces' started by BlazinH, Nov 10, 2016.

  1. Patte83

    Patte83 Member

    Joined:
    Nov 20, 2018
    Messages:
    55
    Balance:
    24Coins
    Ratings:
    +6 / 0 / -0
    My Motion Simulator:
    3DOF
    Will this work with Arduino sensor shield v5 ? Or wire straight to uno? Need help
  2. Mike Stuart

    Mike Stuart Member

    Joined:
    Jan 30, 2019
    Messages:
    51
    Location:
    Washington State
    Balance:
    383Coins
    Ratings:
    +26 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, Motion platform
    I have to say thank you and this is awesome stuff. I have tried to search this entire thread for my question but couldn't find an answer. I've got my motors working and tuned in the SMC3, however I'm confused as to if we are supposed to run the SMC3 program while we run Simtools game engine? I have my motors tuned and running in SMC3, but I am getting nothing from Simtools and am trying to diagnose...something simple im sure.
  3. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,460
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    144,596Coins
    Ratings:
    +10,741 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Don't run the SMC3 utility and SimTools at the same time, as it would set up a port conflict.
    • Like Like x 1
  4. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,145
    Location:
    Oklahoma City, USA
    Balance:
    16,568Coins
    Ratings:
    +1,831 / 32 / -1
    This is correct when using serial output from Simtools and is normal operation. However you can run both at the same time by using UDP mode instead.

    Connecting to Simtools via UDP

    Simtools has the great ability to output the motion data over your network via UDP instead of (or as well as) sending data via a serial port. The Windows SMC3 Utility software now has the ability to receive this network UDP motion data from Simtools and pass it onto the Arduino SMC3. So why setup such a complicated arrangement? Well it’s not actually that complicated and it allows you to perform real time monitoring and setup of the controller while Simtools is running without the need for the second serial port hardware mentioned above. If this approach is used it is still recommended that a second computer be used to run the Windows SMC3 Utility software (especially if you are just starting out with Sim software).

    SMC3 Arduino 3DOF Motor Driver and Windows Utilities
    • Like Like x 1
    • Agree Agree x 1
  5. Arazok

    Arazok Member

    Joined:
    Mar 26, 2018
    Messages:
    161
    Occupation:
    Computer scientist
    Location:
    Germany
    Balance:
    951Coins
    Ratings:
    +30 / 0 / -0
    My Motion Simulator:
    2DOF
    Hi, as I just ordered the 2x32 Sabertooth, I read this whole thread. But I am still confused with the right baud rate.
    On the first page the Simtools settings say 500000 baud, while it is also said to set the 2x32 motordriver to 115200 baud with the DEscribe tool.
    Shouldn‘t be the same speed used ?
  6. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,145
    Location:
    Oklahoma City, USA
    Balance:
    16,568Coins
    Ratings:
    +1,831 / 32 / -1
    Simtools to Arduino @ 500000. Arduino to Sabertooth @ 115200 on second serial port.
    • Informative Informative x 1
    • Useful Useful x 1
  7. Arazok

    Arazok Member

    Joined:
    Mar 26, 2018
    Messages:
    161
    Occupation:
    Computer scientist
    Location:
    Germany
    Balance:
    951Coins
    Ratings:
    +30 / 0 / -0
    My Motion Simulator:
    2DOF
    ah, ok thanks.
    But the usb port of the sabertooth is not used, right ? only the connection from arduino to S1 and ground ?
  8. Arazok

    Arazok Member

    Joined:
    Mar 26, 2018
    Messages:
    161
    Occupation:
    Computer scientist
    Location:
    Germany
    Balance:
    951Coins
    Ratings:
    +30 / 0 / -0
    My Motion Simulator:
    2DOF
    Ah, I saw it in the code:

    SoftwareSerial mySerial(12, 13);

    But Pin12 is not used, so no receiving of data from ST to Arduino.
  9. pimpi84

    pimpi84 New Member Gold Contributor

    Joined:
    Jun 29, 2017
    Messages:
    17
    Location:
    Italia
    Balance:
    - 117Coins
    Ratings:
    +7 / 0 / -0
    Hello.
    Back in Jan 2019 I purchased a sabertooth 2x60 on RoboShop (please see email below).
    The target was to drive two 500w dc motors through arduino for a motion simulator.
    I am using a 1200W dc power source in parallel with a 12V battery.
    Everything run perfectly fine until 2 days ago. I switched off the pc and the motors started for some seconds and smashed to mechanical stop.
    The day after, after resetting the position, The motors started oscillating until hitting the mechanical stop.
    I am using SMC3 windows tool to setup the motors and I am using the sketch shared in the link below.
    Please see also a couple of vids showing the reproduced issue. I used to have 300Kp and pwm max set at 200. Now at Kp 100 and pwm max 60 it starts to oscillate.
    It seems like the motors are driven with some delay with respect to arduino command.
    https://drive.google.com/folderview?id=1eddFnKkVWk30mpkYob-QXNhIqhcFq3wa
    My setup is exactly as shown in this tutorial.


    Using SPS mode with dip switches set to 001111.
    I already tried to change usb port and change Arduino board without any success.
    Could it be some issues rwlated to Sabertooth?
    One additional note:I have a kill switch that "opens" S1 cable. If I push it during oscillation, the motors keep moving until mechanical stop (... And on...).
    The sketch should automatically enable serial timeout on Sabertooth, am I right?
    It should stop the sabertooth as soon as it does not receive any commands for 100ms. I wonder why it's not working when I detach S1.

    I read the whole thread. Somehow it seems my issue is similar to what @Deane was experiencing...

    I have absolutely no clue how to move on.
    Already wrote to DE, and waiting for a response, but I am not even sure that it is a Sabertooth-related issue...

    Do you have some hints/clues?

    Thanks guys, ciao,

    Paolo
  10. Mike Stuart

    Mike Stuart Member

    Joined:
    Jan 30, 2019
    Messages:
    51
    Location:
    Washington State
    Balance:
    383Coins
    Ratings:
    +26 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, Motion platform
    Im just a rookie, but perhaps check your wiring and pin connections to your arduino, and the usb cable. Mine has gotten strange like that twice now because of a bad connection from my pots and sabertooth to the arduino (cheap wiring from the arduino kit). It worked fine in SMC3, but went wonky in simttools just because of the added movement causing a brief connection loss. Might also be worth it to check your settings in the DEscribe software to make sure all is as it should be.
  11. Arazok

    Arazok Member

    Joined:
    Mar 26, 2018
    Messages:
    161
    Occupation:
    Computer scientist
    Location:
    Germany
    Balance:
    951Coins
    Ratings:
    +30 / 0 / -0
    My Motion Simulator:
    2DOF
    strange thing !
    Have you checked the hall sensors ? Maybe exchange one and check if the problem still occurs...
  12. Arazok

    Arazok Member

    Joined:
    Mar 26, 2018
    Messages:
    161
    Occupation:
    Computer scientist
    Location:
    Germany
    Balance:
    951Coins
    Ratings:
    +30 / 0 / -0
    My Motion Simulator:
    2DOF
    The Sabertooth doc says:
    Remember that when connected using USB, the get commands are always available, even ifyou are using R/C or analog mode. This can be helpful for debugging.

    So, idea could be to use the sabertooth usb port for "live debugging" (get commandos) while arduino sends commands to sabertooth as well.
  13. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,145
    Location:
    Oklahoma City, USA
    Balance:
    16,568Coins
    Ratings:
    +1,831 / 32 / -1
    Just so people aren't confused you mean the 2x32 manual since each sabertooth model has its own doc and "get" commands only work with the 2x32. But if you're going to write a PC program to monitor the 2x32 might as well take it all the way and use it for control too. It has the advantage of 12bit motor control increasing motor resolution 16 times. Then all you will need an arduino or other microcontroller for is to input pot or encoder values into the program. And since that's all its need for it shouldn't be to difficult to upgrade to 12bit pot resolution also or to use encoders.
    • Like Like x 1
    Last edited: May 18, 2019
  14. pimpi84

    pimpi84 New Member Gold Contributor

    Joined:
    Jun 29, 2017
    Messages:
    17
    Location:
    Italia
    Balance:
    - 117Coins
    Ratings:
    +7 / 0 / -0
    Hi guys.
    Thanks for all the advices.
    In the end it seems that my sabertooth got damaged and I returned it to DE. (it is now on its way back to me).
    DE told me that the eeprom got somehow corrupted, probably by the "too-much" small capacity battery that I put in parallel (7.2Ah).
    DE suggests to use at least a 25Ah battery in parallel to the PSU, in order to avoid any potential damage.
    I just suggested them to state it clearly in their website, because as of today it is not very clear.

    Hope it can help others....
    • Informative Informative x 2
  15. Lord_Shelter

    Lord_Shelter New Member Gold Contributor

    Joined:
    Sep 28, 2019
    Messages:
    5
    Balance:
    40Coins
    Ratings:
    +2 / 0 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 4DOF
    Hi guys,
    sorry for my english at first, so I had some questions. I want to build a 4DOF with 2 Sabertooth 2x60 and 2 Arduino Mega and would use SMC3. So have I change any settings in the sketch for the second Arduino or has it being equal on booth arduino? At the moment I can´t test anything, because I am only in the planingphase.
    And another question:
    Is it possible to use a switch which, when actuated, drives the motors to the 0 position? Like a safety switch? So I mean, the motor is overexcited, close (or open) the switch, the arduino noted that and send the command to the motors that they have to drive at the middle point (in case at 512 analog)
  16. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,460
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    144,596Coins
    Ratings:
    +10,741 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
  17. Lord_Shelter

    Lord_Shelter New Member Gold Contributor

    Joined:
    Sep 28, 2019
    Messages:
    5
    Balance:
    40Coins
    Ratings:
    +2 / 0 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 4DOF
  18. Mike Stuart

    Mike Stuart Member

    Joined:
    Jan 30, 2019
    Messages:
    51
    Location:
    Washington State
    Balance:
    383Coins
    Ratings:
    +26 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, Motion platform
    • Informative Informative x 1
  19. TSHracing

    TSHracing New Member

    Joined:
    Dec 14, 2017
    Messages:
    26
    Location:
    Canada
    Balance:
    329Coins
    Ratings:
    +5 / 0 / -0
    Hello, I have some sort of general silly question but I have to ask it since it is not clearly mentioned in one single statement, I kind of collected it from at least three individual posts:
    If I'm to use the SMC3-SPS sketch to drive my motors I only need SMC3-Windows utility in the initial stage for PID tuning, on the other hand SMC3-Windows Utililty is only meant to manually help find the values, and once these are figured we have to manually modify the the sketch to have the new tuned values then upload the modified sketch to arduino.
    Is this the right approach? or SMC3-Windows utility will actually re-write the tuned values to the arduino sketch?
    Everywhere I read here on this forum it says that win-util is used for tuning but it does mention clearly how.
  20. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,145
    Location:
    Oklahoma City, USA
    Balance:
    16,568Coins
    Ratings:
    +1,831 / 32 / -1
    Correct

    Correct. To its EEPROM actually.