1. 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!
  2. 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
  3. 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 here. Do not following these rules will lead to permanent exclusion from this website: Read the forum rules.
  4. All new posts and threads should be written in English. Please do not create dual posts in other languages. If you are not a master of the English language you can use an external service to create a translation of your words, for instance, Google translate or DeepL.
    Due to low activity, we've also closed the french section.
    Dismiss Notice

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

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

  1. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,112
    Location:
    Oklahoma City, USA
    Balance:
    15,498Coins
    Ratings:
    +1,789 / 31 / -1
    SMC3-SPS Sabertooth Packet Serial PID motor driver w/SoftStart
    • Agree Agree x 1
  2. Gabor Pittner

    Gabor Pittner Active Member Gold Contributor

    Joined:
    Oct 25, 2018
    Messages:
    179
    Location:
    Szekesfehervar Hungary
    Balance:
    1,098Coins
    Ratings:
    +81 / 0 / -0
    My Motion Simulator:
    6DOF
    YEEEEEAAAAAAAHHHHHHH!!!!!!!
    @BlazinH You are the best!!!!!! I would never have got it, I would not have believed thats the problem....CONGRATULATION!!!
    Everything works fine and smooth... When you come to Hungary I give you a barrel of beer :) :) :)
    Thank you so much, now I can get another step to build my 6dof platform...
    Im very happy now :)
    • Like Like x 3
    • Winner Winner x 1
    Last edited: Jan 1, 2019
  3. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,112
    Location:
    Oklahoma City, USA
    Balance:
    15,498Coins
    Ratings:
    +1,789 / 31 / -1
    Happy New Year! :cheers:cheers:cheers:cheers:cheers:cheers:cheers:cheers:cheers:cheers
    • Like Like x 2
    • Friendly Friendly x 2
  4. MyTPioneer

    MyTPioneer New Member Gold Contributor

    Joined:
    Jan 22, 2017
    Messages:
    23
    Occupation:
    Database Developer
    Location:
    United States
    Balance:
    201Coins
    Ratings:
    +6 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    Can someone tell me how to incorporate the settings that I determine work best using the SMC utility, into Simtools? Do I set them in the Arduino sketch somewhere, or are these in the Simtools interface? I've not been able to figure this one out after quite a bit of reading.

    E.g. Kp, Ki, Kd, PWMmin, PWMmax, PWMrev

    Also, I know this is a little off topic for this thread, but while I'm posting, how do you lock in the COM ports to the arduinos? I'll be using two, and when I plug them in, they don't always get assigned to the COM port they were previously assigned to, causing needed changes in the Simtools setup.

    Thank you,
    MyTPioneer
  5. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,112
    Location:
    Oklahoma City, USA
    Balance:
    15,498Coins
    Ratings:
    +1,789 / 31 / -1
    Settings changes are saved to arduino's eeprom as you make them.

    The first time a com port is used its assigned to that device only until you use the advanced option for the devices driver to change it.
    Last edited: Jan 4, 2019
  6. MyTPioneer

    MyTPioneer New Member Gold Contributor

    Joined:
    Jan 22, 2017
    Messages:
    23
    Occupation:
    Database Developer
    Location:
    United States
    Balance:
    201Coins
    Ratings:
    +6 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    Ahh...eeprom. Got it. I thought that might be the case, but couldn't find that explained anywhere.

    Thanks @BlazinH
  7. GTexas

    GTexas New Member

    Joined:
    Mar 14, 2017
    Messages:
    21
    Location:
    Houston, TX
    Balance:
    392Coins
    Ratings:
    +5 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF
    I am trying to understand how serial timout is handled and have reviewed several threads and Dimension Engineering manuals.
    The DEscribe Software sets this timeout feature in seconds, so the right value for 100 ms should be 0.1 and not 0.01 or 0,01 as stated in several other threads.

    There was also information that the setting would not survive a power cycle of the Sabertooth, but I tried it and the setting remains.

    Also, the Arduino sketch by BlazinH includes a command to set the serial timeout:

    if (digitalRead(11) == HIGH){
    ST[0].setTimeout(100);
    }
    if (digitalRead(12) == HIGH){
    ST[1].setTimeout(100);

    which is correctly written in ms as per the Dimension Engineering Arduino Library.

    So DEscribe configures the timeout in seconds, Arduino code in milliseconds, fine.

    The following Dimension Engineering reference:
    https://www.dimensionengineering.co...al_timeout_2_serial_timeout_8ino-example.html

    recommends:
    // So, serial timeout is primarily a safety feature. That being the case,
    // it's best to set the serial timeout in DEScribe if you can -- if the
    // signal line is noisy when the command is sent, it may be lost. DEScribe
    // settings are saved on the motor driver, eliminating that possibility.

    My understanding would be that it is safer to use DEscribe to set this feature, however the code in the Arduino sketch would overwrite the setting if a different value is provided in the sketch. Or the code section could be viewed as belt and suspenders in case someone did not configure the serial timeout via DEscribe.
    Anything wrong with these thoughts?
  8. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,112
    Location:
    Oklahoma City, USA
    Balance:
    15,498Coins
    Ratings:
    +1,789 / 31 / -1
    The are two sabertooth controller types; V2 and V3. All sabertooths are V2 except the 2x32 which you obviously have and have been reading the manual for. The 2x32 retains serial timeout but you can only set it with Describe. V2's can be set either with Describe or remotely but don't retain it. Therefore if you don't do it remotely you would have to use Describe first every time before using a V2 sabertooth. Since there's a chance a remote command could be lost in transmission though DE decided its better to set it with Describe then retain it so your positive its always working since its a safety feature thus the V3 designation. Also the 2x32 has built in USB where V2 controllers don't so you have to use a ttl level converter to use Describe with them making them harder to connect to Describe.

    Btw, when set remotely 100 is 100 ms, in Describe I believe its stated as .1 s.
    • Informative Informative x 1
    Last edited: Jan 8, 2019
  9. GTexas

    GTexas New Member

    Joined:
    Mar 14, 2017
    Messages:
    21
    Location:
    Houston, TX
    Balance:
    392Coins
    Ratings:
    +5 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF
    Thanks for the quick reply BlazinH, makes sense. And yes, I have a 2x32 Sabertooth.
  10. SilentChill

    SilentChill Problem Maker

    Joined:
    Jul 19, 2014
    Messages:
    2,563
    Occupation:
    Railway Maintenance
    Location:
    Morecambe, Lancashire, England
    Balance:
    19,785Coins
    Ratings:
    +3,363 / 33 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 6DOF
    @BlazinH dunno if you will have any suggestions :nerd but after I have upgraded my PC I cannot set the FPID to 1 in the utility, the rig gets real jerky, I can remember it was like that when I first set it up ages ago but I don't have a clue what I did to get it to be smooth. It is as smooth as silk when using the manual slider in the utility but as soon as I hook it up for data from simtools it jerks around like a right mofo :( I set it to FPID 2 and its fine, changing output rate made no difference and my com ports are set to as high as they can be 128000

    Everything is setup exactly how it was before, maybe the upgrade made a mess of something somewhere, its no massive issue just an annoyance more than anything else
  11. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,112
    Location:
    Oklahoma City, USA
    Balance:
    15,498Coins
    Ratings:
    +1,789 / 31 / -1
    You kind of lost me here. If fpid 2 is fine whats the annoyance? Do you believe you can tell a difference in the motion or something? What do you mean by output rate; packet rate or baud rate? I assume you mean the packet rate but when working okay in utilities and not Simtools the first thing to try is using 115200 baud instead of 500000 (gnd pin 8 on your arduinos to automatically set them to 115200). And why did you set your ports to 128000 when nothing uses that rate?
  12. SilentChill

    SilentChill Problem Maker

    Joined:
    Jul 19, 2014
    Messages:
    2,563
    Occupation:
    Railway Maintenance
    Location:
    Morecambe, Lancashire, England
    Balance:
    19,785Coins
    Ratings:
    +3,363 / 33 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 6DOF
    I meant the interface output rate I have tried from 1ms to 10ms. I don't think I can tell any difference but its half as many calculations and I remember you mentioning the lower the fpid the less detail you will feel ? Unless I dreamt that which I quite possibly could of.

    I've always had the com ports set to 128000 , its just what it was at when I got it working good and I never changed anything since then.

    The annoyance is knowing that you that I could run at full power but now I'm at half power even though running at 2 fpid wont make any difference (maybe possibly) , if you don't get what I mean it doesn't matter we will leave it there :D

    I
  13. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,112
    Location:
    Oklahoma City, USA
    Balance:
    15,498Coins
    Ratings:
    +1,789 / 31 / -1
    You meant lower fpid is more detail right? But no I don't think I said that. fpid is the frequency of pid updates so its not going to make much difference in the motion until fpid is set so high its becomes perceivable. It mostly effects the D term so if anything it may need some adjustment if you use much of it.

    Anyway, since this annoys you try this one. :popcorn

    (file deleted)
    • Useful Useful x 1
    Last edited: Jan 11, 2019
  14. SilentChill

    SilentChill Problem Maker

    Joined:
    Jul 19, 2014
    Messages:
    2,563
    Occupation:
    Railway Maintenance
    Location:
    Morecambe, Lancashire, England
    Balance:
    19,785Coins
    Ratings:
    +3,363 / 33 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 6DOF
    Its ok I found the problem my rig usb hub was plugged into a USB 3.1 port :roll:blush put it into a USB 2.0 and everything under control , situation normal :D

    Thanks anyway for uploading the file :cheers


    I hadnt changed the FPID lol , I tried the new sketch it doesn't seem to make much difference, when I move the rig its like some of the actuators are lagging behind the others
  15. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,112
    Location:
    Oklahoma City, USA
    Balance:
    15,498Coins
    Ratings:
    +1,789 / 31 / -1
    It was worth a try. If it worked it would have had less impact than then setting fpid to 2 but it appears its not enough or its causing other issues.

    Edit: Did you try at fpid 1 though @SilentChill ? The whole purpose was so you could run at fpid 1. Still using fpid at 2 is making things worse not better.
  16. SilentChill

    SilentChill Problem Maker

    Joined:
    Jul 19, 2014
    Messages:
    2,563
    Occupation:
    Railway Maintenance
    Location:
    Morecambe, Lancashire, England
    Balance:
    19,785Coins
    Ratings:
    +3,363 / 33 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 6DOF
    Yes I did and with the new sketch. Its not a problem FPID 2 seems absolutley fine, thanks again for having a quick look at it though :)
    • Like Like x 1
  17. ilbiga

    ilbiga Active Member

    Joined:
    Apr 4, 2014
    Messages:
    225
    Occupation:
    Network Engineer
    Location:
    Italy
    Balance:
    298Coins
    Ratings:
    +134 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Ciao @BlazinH .
    I have a Sabertooth 2x25A motor diriver and I wanto to take some tests with SMC3 Utility, but some things are not clear to me.

    I'm sorry for the potential stupid question: can this guide also be used for Sabertooth 2x25A?

    There are interfacing differences between 2x32A and 2x25A to use "Semplified Serial mode"?

    Thank you so much!
  18. Deane

    Deane Old Fart

    Joined:
    Aug 25, 2018
    Messages:
    212
    Occupation:
    Retired
    Location:
    Wirrina Cove, South Australia
    Balance:
    659Coins
    Ratings:
    +89 / 3 / -0
    My Motion Simulator:
    2DOF
    This is all from memory so ?
    For SMC3 Utility to talk to a 2X25A Sabertooth you have to edit the Arduino Sketch baud rate to from 125000 to 500000
    So go edit Search Serial.begin(125000)
    You will find two entries when you hit find next.
    Change those two entries to 500000 and then write that file to the Arduino
    Then the SMC3 Utility should connect
    If it doesn't then I got the numbers arse about, so change it and try again.
    When you are happy with your results you have to change the baud rate back to the original by the above procedure to run the sim as normal.
    If you get into trouble ask BlazinH , he is the expert and he helped me out, lots and lots and ........
  19. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,112
    Location:
    Oklahoma City, USA
    Balance:
    15,498Coins
    Ratings:
    +1,789 / 31 / -1
    Set 2x25 to 38400 baud. Change softwareserial in sketch from 115200 to 38400. Ground pin 8 on arduino. Use 115200 in Simtools instead of 500000.

    Not other than different dip switch settings.
    • Like Like x 1
    • Informative Informative x 1
    Last edited: Mar 19, 2019
  20. Deane

    Deane Old Fart

    Joined:
    Aug 25, 2018
    Messages:
    212
    Occupation:
    Retired
    Location:
    Wirrina Cove, South Australia
    Balance:
    659Coins
    Ratings:
    +89 / 3 / -0
    My Motion Simulator:
    2DOF
    What he said :thumbs
    I had bits correct.

    Still, this is what I edit and the values which work for me ?

    Sketch Edit for Baud rate change

    Serial.begin(500000)

    Serial.begin(125000)