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

    RacinFool New Member

    Joined:
    Thursday
    Messages:
    6
    Balance:
    36Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, 4DOF

    Attached is my screenshot from my attempt at sim tools motor testing (again, works in smc3 utils motor test- both my motors). Tried the baud rate as pictured (500000 as well as at 115200). My hardware did not work connecting pin 8 to ground and things stopped working properly when testing in SMC3 utils. Without pin 8 to ground, it still worked in smc3 utils. I never tried grounding pin 8 during sim tools testing though because things didn't work in smc3 utils.

    Also, I tried my hand at the IBT 2 & arduino with SMC3 sketch as well because I'll eventually add a traction loss and surge axis eventually. I was able to get my sabertooth and ardiuno communicating with SMC3 utils, but couldn't get the SMC3 sketch for arduino and IBT2 to communicat with SMC3 utils. Main problem is the motors don't get recognized and I can't turn them "on" to test with the PWM slider. I tried multiple versions of the SMC3 sketches for the IBT2 set up with no luck with any version. Wiring seems correct and my rotary sensors get picked up when testing (rotating them when in SMC3 utils), just no motor movement or voltage output in motor pins on the IBT2. I confirmed voltage from power source was working. Thanks for the help, I'm excited to get things moving. Just not sure what i'm missing at this stage.

    Attached Files:

  2. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,882
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    Tasmania, Australia
    Balance:
    152,923Coins
    Ratings:
    +11,114 / 56 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    That looks right, which suggests a port or communications issue.

    To narrow that down can you please post a picture of SMC3 running the Sine test.

    If that confirms the same port please try temporarily disabling your firewall and antivirus, reinstall SimTools with them off, then test again while they are off. If that works you may need to whitelist SimTools.
  3. RacinFool

    RacinFool New Member

    Joined:
    Thursday
    Messages:
    6
    Balance:
    36Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, 4DOF

    here are the screenshots of the sine test with SMC3utils. performed with sabertooth and IBT2 set ups.

    I did not have any luck with reinstallling with the firewall/antivirus off.

    I am also now having the same problem that i did with the IBT2 set up. my rotary sensors are still identified, but motors can't be turned "on" in SMC3 utils to test them, still not seeing any voltage across the +/- motor pins and the motors are working even in SMC3 now.

    Attached Files:

  4. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,882
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    Tasmania, Australia
    Balance:
    152,923Coins
    Ratings:
    +11,114 / 56 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    You keep mentioning both sabertooth and IBT2, and it is just confusing.

    For Sabertooth what steps in the official setup have or have not been done: https://xsimulator.net/community/th...ial-pid-motor-driver-sketch-w-softstart.9277/


    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
    If you wish to use serial timeouts on a 2x32 you must set them to 100ms using DEscribe also.
    Wire up your Arduino to your Sabertooth as shown above in the wiring diagram
    Connect your Arduino to your computer via USB.
    If not already done download and install the Arduino programming software
    Download and run SabertoothArduinoLibrary.exe attached below
    If not already done apply power to your Sabertooths motor inputs.
    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.
    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)
    Set Fpid to / 1. (If you experience motor twitching or other issues then try increasing it)
    Set Step to 100 and then set Kp, Ki, Kd, PWMmin, PWMmax, PWMrev to 0 (This will make sure the motors don’t move)
    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)
    Now click the -> M2 button to apply the same settings to motor 2 also
    Change Kp for motor 1 from 0 to about 400
    Set step back to 1
    Click the ON/OFF button for motor 1 to ON
    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.
    Set Step back to 100 and repeat steps #13, #14, #15, and #16 above for motor 2
    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
    Now start Simtools Game Engine (see image below)
    Open Interface Settings
    Now set up Interface1 as shown in the image below but substitute your arduino’s ComPort number if it is not on Com1.
    Click the SAVE button
    Simtools Game Engine Interface is now correctly configured to send data to the SPS motor driver sketch
    That’s all. You can now start testing your setup with Simtools.
  5. RacinFool

    RacinFool New Member

    Joined:
    Thursday
    Messages:
    6
    Balance:
    36Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, 4DOF
    My apologies. I will focus on the sabertooth set up. I have followed the steps listed in the official sabertooth set up you posted. I have been successful testing with SMC3 utilities. After entering and saving the settings in sim tools game engine, I do not get motion.
  6. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,882
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    Tasmania, Australia
    Balance:
    152,923Coins
    Ratings:
    +11,114 / 56 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Can you please post pictures of your SMC3 settings running the Sine test, and your SimTools Interface and Axis Assignment settings.
  7. RacinFool

    RacinFool New Member

    Joined:
    Thursday
    Messages:
    6
    Balance:
    36Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, 4DOF
    I have attached my sine test for both motors as well as my interface set up. I was able to get the motors running in sim tools, however I had to leave the PWMmax at a value that that generated motion when closing the SMC3 program. Previously I was setting it back to zero when exiting. When doing so, sim tools generated no motion. I do not have my rotary sensors stabilized while testing the motors so if in the wrong place or accidently moved, the motors would just keep rotating and wind all my wires and damage my connections. Now that I have the motors moving in simi tools interface set up, should I set and leave the PWMmax at 255 now once I get my actual rig set up and the motors/sensors fixed?

    Attached Files:

  8. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,882
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    Tasmania, Australia
    Balance:
    152,923Coins
    Ratings:
    +11,114 / 56 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Could you try PWMmax at 200 and PWMrev at 120, then rerun and post the Sine test.
  9. RacinFool

    RacinFool New Member

    Joined:
    Thursday
    Messages:
    6
    Balance:
    36Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, 4DOF
    Here are the tests.

    Attached Files: