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. 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. 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
    Hi,
    I attempted to wire up and load the software as per your tutorial, but I have done something wrong no doubt.
    For a start I am using a 2X25 Sabertooth v2 and when I tried to change the baud rate it would not allow 115200 and the max was 38400 from memory.
    I loaded the Sabertooth Arduino Libraries but I have no idea what I do with them
    I then loaded the SMC3-SPS sketch file into the Uno and yes I did edit the com port to correct one, and that loaded I think :confused:
    I then ran the SMC3 Utility and followed the steps but when I tried to set Motor 1 I can select it but when I try to do the on/off button it doesn't move it stays OFF
    I also get no movement of any of the motors even if set the PWMmax to it's max setting still nothing
    Motor 2 & 3 in the utility are selectable,and the on/off button is always On
    BTW, the Pots are Hall Effect 180 degree and I am wondering if they might be a problem as the shaft rotates 360 degree with no discernible end points like other normal pots that I have used before with a VFD drive.
    Is there an particular reference point when mounting them ?

    No doubt I have stuffed up somewhere so can you see anything obvious that I might have got wrong ?
    Any help would be appreciated as I am out of my depth here.

    Mess1.JPG Mess2.JPG Mess3.JPG Mess5.JPG
    Last edited: Oct 11, 2018
  2. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,129
    Location:
    Oklahoma City, USA
    Balance:
    15,659Coins
    Ratings:
    +1,802 / 31 / -1
    A safety feature of smc3 is a motor won't turn on unless pot is within the set range. Use utility or a volt meter to check that it is.

    And how are you setting the baud on the 2x25?
    • Informative Informative x 1
  3. 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
    I will have to check the pot voltage. I know 5Volts are in, so can I check the output with a multi-meter or do I need special tools for that.
    These are the specs on the pots-
    6127V1A180L.5FS (Fnl)
    BI TECHNOLOGIES / TT ELECTRONICS SENSOR, HALL, 0.2V, +20V TO -10V, PIN
    Supply Voltage DC Min:4.5V
    Supply Voltage DC Max:5.5V
    Sensor Terminals:pin
    Sensor Housing:Cylinder Rotatable
    Output Configuration:Analogue
    Output Voltage Min:200mV
    Switching Speed:-
    Product Range:6127 Series
    SVHC:No SVHC (20-Jun-2016)


    I am using the Describe Utility with a USB TTL tool and that connects and reads the Sabertooth
    This is my board https://www.dimensionengineering.com/products/sabertooth2x25 and it say V2 on the board
    I am using this user guide for 2X25 V2 https://www.dimensionengineering.com/datasheets/Sabertooth2x25v2.pdf

    When I try to change the Baud rate in the Packet Serial Tab

    15: Baud Rate (decimal 15, binary 0b00001111, hex 0h0f)
    This value remains until it is changed and does persist through a power cycle. The values are:
    1: 2400 baud
    2: 9600 baud (default)
    3: 19200 baud
    4: 38400 baud

    Mode 4: Packetized Serial Mode
    Last edited: Oct 12, 2018
  4. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,129
    Location:
    Oklahoma City, USA
    Balance:
    15,659Coins
    Ratings:
    +1,802 / 31 / -1
    Just to be sure a couple of hours ago I checked my Describe install and I can indeed set the 2x25v2 to 115200. Sounds like you need to update Describe or make sure the 2x25v2 is selected. Also never mind that what you posted shows 38400 max as that is outdated v1 info.
    • Informative Informative x 1
  5. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,129
    Location:
    Oklahoma City, USA
    Balance:
    15,659Coins
    Ratings:
    +1,802 / 31 / -1
    Also a multi-meter works.
  6. 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
    I am using the latest version of Describe V 3.7
    I am using the Packet Serial Tab and yes it has the 115200 baud rate option which I select but then gives me a red error message that this board does not support that rate. :think

    I am pretty sure that I am doing it right as I am setting the dip switches as:-
    For SyRen/Sabertooth, the DIP switch settings are:
    1 and 2 OFF (Packet Serial mode)
    I will start from scratch gain and see if I get a better result
    Thanks for the advice BTW. hug:
  7. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,129
    Location:
    Oklahoma City, USA
    Balance:
    15,659Coins
    Ratings:
    +1,802 / 31 / -1
    I don't have one to test. To be sure about things must ask DE help desk because their posted info can be inacurate. But a v2 controller should be 100% compatible with other v2 controllers imo. Also it shouldn't show 115200 as an option in describe for a 2x25v2 if it isn't.
    • Like Like x 1
  8. 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
    I am just going to start over and see what I get to eliminate any errors that I might have made.
    The Sabertooth definitely has V2.0 written on the board.
    So for the moment that is my best option and as it's my first time installing all of this hardware and software I could easily have made an error some where
    as electronics is not my forte by a long shot.
  9. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,129
    Location:
    Oklahoma City, USA
    Balance:
    15,659Coins
    Ratings:
    +1,802 / 31 / -1
    Oh never mind. I see all you have to do is select 115200 to get the message. :( It appears all v2 controllers aren't compatable after all, sorry. You can run the sketch at 38400 with some modification but one person that tried it on a Syren 50 had jittery motors. But I can help you do it if you want to try.

    ps The Syren 50 said 38400 max too but v2 version will do 115200 so I thought the same would be true for the 2x25.
    • Friendly Friendly x 1
  10. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,129
    Location:
    Oklahoma City, USA
    Balance:
    15,659Coins
    Ratings:
    +1,802 / 31 / -1
    Last edited: Oct 12, 2018
  11. 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
    So which do you recommend the 38400 setting and editing the sketch I presume ? I know you can probably do it in notepad if it is just a simple edit of all the 115200 references to 38400 or does it have to be done some other way ?

    Or should I do the Simple Serial https://www.xsimulator.net/community/threads/smc3-sabretooth-test-version.6236/ in preference ?

    Devil.jpg
  12. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,129
    Location:
    Oklahoma City, USA
    Balance:
    15,659Coins
    Ratings:
    +1,802 / 31 / -1
    For safety purposes I would start out with smc3-sps. Since your 2x25 is already set to 38400 the only mySeial.begin(115200) that needs to be changed to 38400 is the last one, the one before digitalRead(11). You can make the change with the Arduino software before loading it in your Uno. Then if you have motor jitters you can try some things like reducing motor updates and adjusting the pid frequency.

    But once everything is working and proven reliable you could try the test version if you wish for comparison. The only thing is that if motors are moving and there's some kind of issue causing control to cease they will continue running at the last sent speed. So its good to have an easily assessable kill switch in case something goes wrong during operation. But that's never a bad idea anyway.
  13. 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
    Ok. So I used the Arduino editor and searched and found the line and replaced the 115200 with 38400 and saved it I presume that I understood correctly and only that one line in that whole file neede to be edited, correct.
    Cross fingers and see what happens, I will report back when I have news or :(
    Thanks again hug:
  14. 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
    Well I went through the steps as before but the Motor 1 button even when selected and pushed ON does nothing see pic.
    But Motor 2 I got to turn but the more I increased the speed I think it was clipping, like a miss sound if that makes sense. But it moved so whoohoo.
    Then repeated for Motor 3 and nothing, no movement of the motor or the screen trace remembering that I only have two motors !
    Does any of that make sense, as I am more confused :mad::mad:

    SShot1.JPG
  15. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,129
    Location:
    Oklahoma City, USA
    Balance:
    15,659Coins
    Ratings:
    +1,802 / 31 / -1
    Use steps 11, 17 and 18 of the setup guide for motor 1 . ;) But motor 1 pot is still out of range. The green line must be between the red lines first.
    Last edited: Oct 12, 2018
  16. 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
    Ok. When you the pot is out of range should I manually rotate it or is it a software setting that I have to alter.
    I re -did the whole process from step one and got the same result as in the pic I can keep doing it but I just get the same flat line and Motor 1 On/Off button stays off !
  17. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,129
    Location:
    Oklahoma City, USA
    Balance:
    15,659Coins
    Ratings:
    +1,802 / 31 / -1
    With utility running rotate pot either by housing or shaft until green line is in the middle. On 180 degree continuous rotation pot 1/2 of it doesn't do anything. If the green line doesn't move with a full rotation you probably have a wiring issue.
  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
    I will try that now.
    But first I did as you said and ran the test again and Motor 2 moves when I increase the PWMax and the motor starts to rotate but the green line does not move towards the blue Target line ,but the PWM yellow line moves up.
    Back in a bit after I play with the pot.
    Thanks.
  19. 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
    After much f****ng around I think I got it right in that I got the Green line between the limits on M1&M2 and both are no moving.
    I should be pleased but it's 4.25 a.m and my head is about to explode so I think I will retire for some shut eye and have nightmares about Sim settings

    Again, thanks for the advice and help. :):)

    Headache.jpg Adios Amigos
    • Like Like x 1
  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
    I spoke too soon.
    Either I was tired and frustrated or the fairies screwed with my settings but here I am again back to square one.
    Now I have rotated each pot until the green line is in the middle where the blue line and when I try that I get SFA and when you adjust the pot for each motor should the green line be set in the same position, or M1 above the Target and M2 below the target line.
    So I re-do the pot adjustment and keep the green line between the Blue Target line and the red Limit line and give it a go it heads to the blue line and hits a brick wall.
    Is it meant to be able to go past the target line or not.
    Like I said I had one side adjusted fine and both I thought but something has changed for the worse
    Another thing, when I thought I had it working and the motor was moving I then did as the tutorial said and went on to the next motor I noticed that the motor one settings had not been save to the second motor by pressing >M2 , so that is just one more thing.
    I'm sure that I have followed all the steps as listed and advised which still has me thinking it might be the Pots.
    Hopefully this will get resolved soon before Mr. Sim meets Mr. Ruger GP100
    Ok time for bed for a few hours.