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. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,838
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    Tasmania, Australia
    Balance:
    152,653Coins
    Ratings:
    +11,103 / 56 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    There are 24v batteries available, just do a search, of course geography may be a issue!

    Alternatively, you can use 2 X 12v batteries and there is plenty of online available information, for example: https://powmr.com/blogs/news/12v-batteries-to-24v
    • Like Like x 1
  2. Alvaro George Menendez

    Alvaro George Menendez New Member Gold Contributor

    Joined:
    Aug 7, 2024
    Messages:
    24
    Location:
    Sydney NSW Australia
    Balance:
    99Coins
    Ratings:
    +12 / 0 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 4DOF
    the centre to centre on the motor leaver arm is 92mm

    Attached Files:

  3. Kevinski

    Kevinski If it doesn't fit, hit it until it does.

    Joined:
    Feb 17, 2023
    Messages:
    200
    Occupation:
    Jack of many trades, mastering some.
    Location:
    Australia
    Balance:
    429Coins
    Ratings:
    +127 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino, Motion platform
    @Michail sorry for the late reply. 90mm CTC on surge motor lever.
    • Winner Winner x 1
  4. Kevinski

    Kevinski If it doesn't fit, hit it until it does.

    Joined:
    Feb 17, 2023
    Messages:
    200
    Occupation:
    Jack of many trades, mastering some.
    Location:
    Australia
    Balance:
    429Coins
    Ratings:
    +127 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino, Motion platform
    @204flightsinmotion I use a combo of PSU's in parallel with a 12 volt SLA battery in my simulator build. It is a 12 volt system though. No problems using it like that. As Noorbeast pointed out, it is recommended by dimesion engineering to do it this way. Have a look at this link from this discord channel. https://discordapp.com/channels/1437286798853275742/1439090709196963850/1439094484565758063

    This gentleman from Canada has built a controller for PSU's to use with his sabretooth. He claims it will likely negate the need for a battery. I'm waiting on him to finish his sim build so I can see the results. If this powers his motors without drop outs, I'll more than likely be changing over to this way of powering my rig and doing away with the battery.
  5. 204flightsinmotion

    204flightsinmotion Member

    Joined:
    Aug 28, 2023
    Messages:
    32
    Balance:
    171Coins
    Ratings:
    +3 / 0 / -0
    So I got the sabre tooth 2x60 wired up to my arduino uno r3 that I was previously using with the 100a board that failed me.

    I followed the steps carefully and am getting “
    Compilation error: expected unqualified-id before numeric ”

    any tips on getting this part figured out?
  6. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,838
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    Tasmania, Australia
    Balance:
    152,653Coins
    Ratings:
    +11,103 / 56 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Can you please be more specific about what was done or not done, and which point it fails at following the instructions, and please confirm key steps have been done, such as Step 6:

    Initial Setup

    Make sure Simtools is NOT running.

    1. If you have a new 2x32 or a 2x32 that is not already set to 115200 baud, use DEscribe software to set its baud rate to 115200. (note: setting the baud on a new 2x60 with DEscribe is not necessary) https://www.dimensionengineering.com/info/describe
    2. If you wish to use serial timeouts on a 2x32 you must set them to 100ms using DEscribe also.
    3. Wire up your Arduino to your Sabertooth as shown above in the wiring diagram
    4. Connect your Arduino to your computer via USB.
    5. If not already done download and install the Arduino programming software
    6. Download and run SabertoothArduinoLibrary.exe attached below
    7. If not already done apply power to your Sabertooths motor inputs.
    8. Now use the Arduino programming software to install the SPS sketch attached below on your Arduino. Make sure you choose Uno or Mega and to set the comport number.
    9. Next download and run the Windows SMC3 Utility software attached below and make sure it communicates with your Arduino. Open the accompanying SMC3Utils.ini with notepad to change the comport if needed (see image below)
    10. Set Fpid to / 1. (If you experience motor twitching or other issues then try increasing it)
    11. Set Step to 100 and then set Kp, Ki, Kd, PWMmin, PWMmax, PWMrev to 0 (This will make sure the motors don’t move)
    12. Set Clip to 255 (you need to do this first) and Limit to 255 (This will give you plenty of margin if something goes wrong while setting up)
    13. Now click the -> M2 button to apply the same settings to motor 2 also
    14. Change Kp for motor 1 from 0 to about 400
    15. Set step back to 1
    16. Click the ON/OFF button for motor 1 to ON
    17. Now slowly, increase PWMmax… at some point the motor should start to move. When it does check the “Green” feedback line is moving toward the “Blue” target position.
      • If it is then that motor and feedback is wired correctly - proceed to test other motors.
      • If it is moving away turn off motor power immediately (or quickly reduce PWMmax again). In this case you need to either reverse the wires to the motor being tested –OR– reverse the +5V and GND wires to your feedback pot for the motor being tested (do not do both). Restart the test from the beginning.
      • If you are using a 2x60 and the motor doesn’t move, and assuming its wiring is correct, then its possible that your Sabertooths baud rate did not match what was expected when the sketch was run so it may not have autobauded. See the wiring diagram about setting jumpers to try a different baud rates.
    18. Set Step back to 100 and repeat steps #13, #14, #15, and #16 above for motor 2
    19. Motor driver setup is now complete but the PID controller will still need to be turned to work properly with your particular setup. This will be done later though and is not included in the scope of this tutorial
    20. Now start Simtools Game Engine (see image below)
    21. Open Interface Settings
    22. Now set up Interface1 as shown in the image below but substitute your arduino’s ComPort number if it is not on Com1.
    23. Click the SAVE button
    24. Simtools Game Engine Interface is now correctly configured to send data to the SPS motor driver sketch
    25. That’s all. You can now start testing your setup with Simtools.
  7. Kevinski

    Kevinski If it doesn't fit, hit it until it does.

    Joined:
    Feb 17, 2023
    Messages:
    200
    Occupation:
    Jack of many trades, mastering some.
    Location:
    Australia
    Balance:
    429Coins
    Ratings:
    +127 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino, Motion platform
    @204flightsinmotion did you clean out the code on the Ard that was running this 100amp motor controller before you installed the sabretooth packet serial code running the new 2x60 sabretooth? You might have a corrupted eprom chip if you didn’t delete the existing code.
  8. 204flightsinmotion

    204flightsinmotion Member

    Joined:
    Aug 28, 2023
    Messages:
    32
    Balance:
    171Coins
    Ratings:
    +3 / 0 / -0
    I didn’t wipe it out. Should I buy a fresh one or should I run a blank on this one.
    I followed the steps made sure simtools
    Was closed. Made sure it was wired correctly. And then followed the steps. Installed that software package once then installed again as admin just in case. And restarted before running the arduino code.

    “C:\SPS_8.2_softstart\SPS_8.2_softstart.ino:229:1: error: expected unqualified-id before numeric constant
    11
    ^~
    In file included from C:\SPS_8.2_softstart\SPS_8.2_softstart.ino:232:0:
    C:\Users\Arcade\Documents\Arduino\libraries\Sabertooth/Sabertooth.h:57:28: error: 'SabertoothStream' has not been declared
    Sabertooth(byte address, SabertoothStream& port);
    ^~~~~~~~~~~~~~~~
    C:\Users\Arcade\Documents\Arduino\libraries\Sabertooth/Sabertooth.h:70:10: error: 'SabertoothStream' does not name a type; did you mean 'Sabertooth'?
    inline SabertoothStream& port() const { return _port; }
    ^~~~~~~~~~~~~~~~
    Sabertooth
    C:\Users\Arcade\Documents\Arduino\libraries\Sabertooth/Sabertooth.h:83:24: error: 'SabertoothStream' has not been declared
    static void autobaud(SabertoothStream& port, boolean dontWait = false);
    ^~~~~~~~~~~~~~~~
    In file included from C:\SPS_8.2_softstart\SPS_8.2_softstart.ino:232:0:
    C:\Users\Arcade\Documents\Arduino\libraries\Sabertooth/Sabertooth.h:176:3: error: 'SabertoothStream' does not name a type; did you mean 'Sabertooth'?
    SabertoothStream& _port;
    ^~~~~~~~~~~~~~~~
    Sabertooth
    C:\SPS_8.2_softstart\SPS_8.2_softstart.ino:233:46: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
    Sabertooth ST[2] = { Sabertooth(128, mySerial), Sabertooth(129, mySerial), };
    ^
    In file included from C:\SPS_8.2_softstart\SPS_8.2_softstart.ino:69:0:
    C:\Users\Arcade\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\SoftwareSerial\src/SoftwareSerial.h:106:3: note: after user-defined conversion: SoftwareSerial::eek:perator bool()
    operator bool() { return true; }
    ^~~~~~~~
    In file included from C:\SPS_8.2_softstart\SPS_8.2_softstart.ino:232:0:
    C:\Users\Arcade\Documents\Arduino\libraries\Sabertooth/Sabertooth.h:57:3: note: initializing argument 2 of 'Sabertooth::Sabertooth(byte, int&)'
    Sabertooth(byte address, SabertoothStream& port);
    ^~~~~~~~~~
    C:\SPS_8.2_softstart\SPS_8.2_softstart.ino:233:73: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
    Sabertooth ST[2] = { Sabertooth(128, mySerial), Sabertooth(129, mySerial), };
    ^
    In file included from C:\SPS_8.2_softstart\SPS_8.2_softstart.ino:69:0:
    C:\Users\Arcade\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\SoftwareSerial\src/SoftwareSerial.h:106:3: note: after user-defined conversion: SoftwareSerial::eek:perator bool()
    operator bool() { return true; }
    ^~~~~~~~
    In file included from C:\SPS_8.2_softstart\SPS_8.2_softstart.ino:232:0:
    C:\Users\Arcade\Documents\Arduino\libraries\Sabertooth/Sabertooth.h:57:3: note: initializing argument 2 of 'Sabertooth::Sabertooth(byte, int&)'
    Sabertooth(byte address, SabertoothStream& port);
    ^~~~~~~~~~
    exit status 1

    Compilation error: expected unqualified-id before numeric constant “

    That’s my error
  9. Michail

    Michail Active Member Gold Contributor

    Joined:
    Jan 5, 2022
    Messages:
    176
    Location:
    Germany
    Balance:
    748Coins
    Ratings:
    +32 / 1 / -0
    So with 90mm CTC you get ridiculous long 210mm travel this is insane.
    • Like Like x 1
  10. Alvaro George Menendez

    Alvaro George Menendez New Member Gold Contributor

    Joined:
    Aug 7, 2024
    Messages:
    24
    Location:
    Sydney NSW Australia
    Balance:
    99Coins
    Ratings:
    +12 / 0 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 4DOF
    Just to make sure we are talking about the same thing ... trolley arm lever CTC length is 75mm and 225mm... check out kevinski's server in discord for others results.

    Attached Files:

  11. Kevinski

    Kevinski If it doesn't fit, hit it until it does.

    Joined:
    Feb 17, 2023
    Messages:
    200
    Occupation:
    Jack of many trades, mastering some.
    Location:
    Australia
    Balance:
    429Coins
    Ratings:
    +127 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino, Motion platform
    I’d have to double check, but that’s 210mm in total. 105mm forward and 105mm backwards from the trollies centre position.
    • Like Like x 1
  12. Alvaro George Menendez

    Alvaro George Menendez New Member Gold Contributor

    Joined:
    Aug 7, 2024
    Messages:
    24
    Location:
    Sydney NSW Australia
    Balance:
    99Coins
    Ratings:
    +12 / 0 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 4DOF

    Correct ... mine is about that too
    • Like Like x 1
  13. Kevinski

    Kevinski If it doesn't fit, hit it until it does.

    Joined:
    Feb 17, 2023
    Messages:
    200
    Occupation:
    Jack of many trades, mastering some.
    Location:
    Australia
    Balance:
    429Coins
    Ratings:
    +127 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino, Motion platform
    @Michail yes it is a bit insane building one of these things and taking the time to show others. But hey, others have taken the time to do the same. That measurement for the distance of travel is 210mm in total. 105mm forward travel and 105mm aft travel. And yes, it's enough.
  14. Kevinski

    Kevinski If it doesn't fit, hit it until it does.

    Joined:
    Feb 17, 2023
    Messages:
    200
    Occupation:
    Jack of many trades, mastering some.
    Location:
    Australia
    Balance:
    429Coins
    Ratings:
    +127 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino, Motion platform
    @204flightsinmotion bloody ghosts in the machine. I am by no means an expert on coding micro controllers. Thankfully guys like Blazing H and Rufus Dufus have done the heavy lifting there and made their codes available for us to use. You can buy really cheap uno r3 clones. I've got a couple of them and they cost me like 5 bucks each.

    It might be worth the investment, just so you can try a fresh install on a fresh board. If it works on the fresh board you are set. Only problem with the cheap arduino clones, is the eprom chips on them often corrupts after a short time and won't retain saved profiles.

    But if it works changing over to a new fresh board, you can at least then with confidence purchase a genuine arduino board and install that with the serial packet code. Good luck mate.