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 Download Package Now!
  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.

New XPID software for Arduino UNO/Mega and Sabertooth (with LCD !!)

Discussion in 'SimTools compatible interfaces' started by vthinsel, Apr 1, 2015.

  1. vthinsel

    vthinsel Well-Known Member

    Joined:
    Feb 20, 2015
    Messages:
    372
    Location:
    FRANCE
    Balance:
    4,843Coins
    Ratings:
    +469 / 1 / -0
    My Motion Simulator:
    3DOF, SCN6
    Yes, it used to work on 2x25 as well. You must indicate in the LCD menu if you have a 2x25 or 2x32. Depending on that the TTL speed will be adjusted.
    This is managed by the piece of code here :
    if (SabertoothType == 2) { //We are managing a sabertooth 2*32 which allows 115200 bps
    SabertoothSerialPort.begin(115200);
    }
    //ST.setBaudRate(115200); //Not needed as should be done using describe software which writes speed in EEPROM of sabertooth module.
    else { //We are managing a sabertooth 2*25 or lower which allows only 38400 bps
    SabertoothSerialPort.begin(38400);
    ST.autobaud(SabertoothSerialPort, true); //Needed so the sabertooth 2*25 is correctly configured
    }

    The SabertoothType is stored in EEPROM and edited as part of the Global Settings LCD menu .
    I realize that with the TFT there is no option to change that.....
  2. vthinsel

    vthinsel Well-Known Member

    Joined:
    Feb 20, 2015
    Messages:
    372
    Location:
    FRANCE
    Balance:
    4,843Coins
    Ratings:
    +469 / 1 / -0
    My Motion Simulator:
    3DOF, SCN6
    I'm using the packet serial protocol also. If I remember correctly you have to setup some jumpers as well for this mode.
  3. graz

    graz New Member Gold Contributor

    Joined:
    Aug 19, 2014
    Messages:
    25
    Occupation:
    mechanic
    Location:
    melbourne australia
    Balance:
    2Coins
    Ratings:
    +15 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, JRK
    awesome...thanks for the quick response. My mistake I thought we were using simplified serial not packet.
    Reset the dip switches, connected to describe with ttl to usb convertor, reset the baud rate in describe and it all works perfectly.
    Again a big thanks and great work.
    Cheers
  4. vthinsel

    vthinsel Well-Known Member

    Joined:
    Feb 20, 2015
    Messages:
    372
    Location:
    FRANCE
    Balance:
    4,843Coins
    Ratings:
    +469 / 1 / -0
    My Motion Simulator:
    3DOF, SCN6
    No problem. Do not hesitate to show your setup in action ;) and give feedback on your testing. My rig is still not live :oops:
  5. MikeTheBike71

    MikeTheBike71 New Member

    Joined:
    Nov 17, 2016
    Messages:
    4
    Location:
    Grenoble
    Balance:
    194Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    Hello,

    Just some informations if someone had the same problem as me. With the 3.13 version, i have had an error


    XPID_SimTools_3.13:134: error: 'menuUseEvent' was not declared in this scope
    MenuBackend menu = MenuBackend(menuUseEvent, menuChangeEvent);
    ^
    XPID_SimTools_3.13:134: error: 'menuChangeEvent' was not declared in this scope
    MenuBackend menu = MenuBackend(menuUseEvent, menuChangeEvent);
    ^
    exit status 1
    'menuUseEvent' was not declared in this scope

    I have the 1.6.12 version of arduino IDE. The solution have been to download the 1.6.5 version and delete the libraries in my document/arduino/libraries except the ones you provided.

    Thank you for this amazing piece of code
  6. Wanegain

    Wanegain Active Member

    Joined:
    Nov 6, 2013
    Messages:
    549
    Location:
    Bruxelles
    Balance:
    1,372Coins
    Ratings:
    +275 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    You need to use a lower version of Arduino, I think at least 1.6.7 or maybe 1.6.4... This issue comes from the library
  7. MikeTheBike71

    MikeTheBike71 New Member

    Joined:
    Nov 17, 2016
    Messages:
    4
    Location:
    Grenoble
    Balance:
    194Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    Yes, that's what i have wrote at the end of my message => The solution have been to download the 1.6.5 version and delete the libraries in my document/arduino/libraries except the ones you provided. ;)
  8. MikeTheBike71

    MikeTheBike71 New Member

    Joined:
    Nov 17, 2016
    Messages:
    4
    Location:
    Grenoble
    Balance:
    194Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    I didn't find the 4DOF version that simon A. show on his youtube channel. Did he share it?
  9. obobo

    obobo Active Member

    Joined:
    Nov 8, 2016
    Messages:
    248
    Location:
    France
    Balance:
    1,262Coins
    Ratings:
    +76 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    ask him for that
  10. Pinello

    Pinello New Member

    Joined:
    Jan 29, 2017
    Messages:
    10
    Location:
    Norway
    Balance:
    125Coins
    Ratings:
    +3 / 0 / -0
    Can someone please tell if this PID-code can be used for 3DOF (Sabertooth 2x25 + 25)? Or is the answer to use 2 Arduinos for 3DOF?

    Regards
  11. Wanegain

    Wanegain Active Member

    Joined:
    Nov 6, 2013
    Messages:
    549
    Location:
    Bruxelles
    Balance:
    1,372Coins
    Ratings:
    +275 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    This code is working only with 2 motors... I have written some codes for 2 to 6 motors using Sabertooth (2x32 and 2x25) I need to share...
    • Agree Agree x 1
  12. noorbeast

    noorbeast VR - The Next Generation Staff Member Moderator

    Joined:
    Jul 13, 2014
    Messages:
    13,561
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    102,310Coins
    Ratings:
    +8,505 / 42 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
  13. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,053
    Location:
    Oklahoma City, USA
    Balance:
    15,029Coins
    Ratings:
    +1,719 / 30 / -1
    In actuality RufusDufus's sabertooth SMC3 code using simple serial and my code using packet serial should be called SMC2 because they can only control two motors, not three. The reason is twofold. While I had originally included a third motor in my code, after some testing with the help of RufusDufus's scope, we determined that using three motors would almost max out the serial communications since packet serial requires 4 bytes per motor update which in turn would slow down the PID also. And simple serial mode, although it could control three motors since it only requires a single byte per motor update, does not include a third motor because a sabertooth is a dual controller. So if adding a third motor why not add a forth so you can use all motor driver channels. But then you would need an SMC4 sketch. It's easier just to use two arduinos especially since they're inexpensive.
  14. noorbeast

    noorbeast VR - The Next Generation Staff Member Moderator

    Joined:
    Jul 13, 2014
    Messages:
    13,561
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    102,310Coins
    Ratings:
    +8,505 / 42 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Thanks for the correction and clarification.

    I have changed the relevant FAQ and called it SMC2, as you suggest, and noted it serves 2 motors: https://www.xsimulator.net/community/faq/arduino-code-for-use-with-various-hardware-and-simtools.31/

    You may want to edit the title and text to keep the SMC2 moniker and save confusion here: https://www.xsimulator.net/communit...ket-serial-pid-motor-driver-w-softstart.9277/
  15. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,053
    Location:
    Oklahoma City, USA
    Balance:
    15,029Coins
    Ratings:
    +1,719 / 30 / -1
    I really wasn't suggesting you call it SMC2 though because its still the SMC3 sketch. Its confusing calling one SMC2 and the other SMC3 because that sounds like SMC3 is an upgrade from SMC2 which is not the case. I know the 3 was included to mean 3 motors which is why I made my comment above but that's not implicitly stated. Therefore imo all sketches that are merely modifications of the SMC3 sketch should still be called SMC3 but with the addition in the title of what the modification(s) added where as they are now.
  16. noorbeast

    noorbeast VR - The Next Generation Staff Member Moderator

    Joined:
    Jul 13, 2014
    Messages:
    13,561
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    102,310Coins
    Ratings:
    +8,505 / 42 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    No problem, I changed the FAQ entry back to SMC3 with the 2 motor clarification :thumbs
    • Like Like x 1
    • Winner Winner x 1
  17. Pinello

    Pinello New Member

    Joined:
    Jan 29, 2017
    Messages:
    10
    Location:
    Norway
    Balance:
    125Coins
    Ratings:
    +3 / 0 / -0
    So, 2 Arduinos it is.. :)
  18. Wanegain

    Wanegain Active Member

    Joined:
    Nov 6, 2013
    Messages:
    549
    Location:
    Bruxelles
    Balance:
    1,372Coins
    Ratings:
    +275 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    I process the data of each motor independently which allows me to be able to manage as many motors as I have of analog inputs.
    With 6 active motors I measured a loop of 1 ms (the pid of all the motors is calculated with each loop).
    It is an approach that allows not to be limited by serial communications :)
    • Informative Informative x 2
  19. vthinsel

    vthinsel Well-Known Member

    Joined:
    Feb 20, 2015
    Messages:
    372
    Location:
    FRANCE
    Balance:
    4,843Coins
    Ratings:
    +469 / 1 / -0
    My Motion Simulator:
    3DOF, SCN6
    • Like Like x 3
    • Winner Winner x 1
  20. Pierre Lalancette

    Pierre Lalancette Sir Lalancelot Gold Contributor

    Joined:
    Dec 11, 2016
    Messages:
    693
    Occupation:
    3D teacher
    Location:
    Quebec, Canada
    Balance:
    5,749Coins
    Ratings:
    +698 / 5 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    Hello vthinsel:
    I have an arduino uno and a sabertooth 2x60. I made a simple potentiometer geared to a little DC motor. I want to drive it simtool, but I did not know what to use to drive the arduino. Your XPID_simtool_3.13.ino seams to be the right choice. I copied the libraries to my Arduino/libraries, and I got this error:

    Arduino: 1.6.14 Hourly Build 2016/12/19 06:33 (Windows 10), Board: "Arduino/Genuino Uno"

    XPID_SimTools_3.13:134: error: 'menuUseEvent' was not declared in this scope

    MenuBackend menu = MenuBackend(menuUseEvent, menuChangeEvent);

    ^
    XPID_SimTools_3.13:134: error: 'menuChangeEvent' was not declared in this scope

    MenuBackend menu = MenuBackend(menuUseEvent, menuChangeEvent);

    exit status 1
    'menuUseEvent' was not declared in this scope


    Then I find a folder arduino-nightly/libraries. I tried to put the libraries over there:

    Arduino: 1.6.14 Hourly Build 2016/12/19 06:33 (Windows 10), Board: "Arduino/Genuino Uno"

    C:\Users\Lalancelot\Documents\Arduino\XPID_SimTools_3.13\XPID_SimTools_3.13.ino:53:25: fatal error: MenuBackend.h: No such file or directory

    #include <MenuBackend.h>
    ^
    compilation terminated.

    exit status 1
    Error compiling for board Arduino/Genuino Uno.


    I guess the MenuBackend libraries was to blame. I tried to find it and install it, but it turn out to be mysteriously complicated.

    Maybe there is update to do to my Arduino, but even that, I did not find out how to do.

    I checked the check list for dummies at page two. I stop a point 2, that is, connect my sabertooth to the PC via USB. There is no USB connector on my sabertooth... what does it means?

    OK, I add the following information for beginners:
    1. The Dip switches have to be set off off on on on on
    2. the Sabertooth has to be connected to the PC (USB)
    3. The software DEscribe" has do be started
    4. the Sabertooth has to be configured showing in the video, then the settings have to be uploaded to the device. If you want, you can save the settings to a file separately on disk.
    5. The Sabertooth must be powered by a PSU for testing the correct outputs using a multimeter.
    6. The Sabertooth has not to be connected to the Ard on the 5V line.
    7. ?
    As you can see, I am getting nowhere pretty fast. I have read your full thread, and now, I am even more confuse. I don't know what to use and how to program my arduino uno to be the interface between my pc and the sabertooth. Can I use you xpid_simtool_3.13?