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

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:
    436
    Location:
    FRANCE
    Balance:
    5,963Coins
    Ratings:
    +563 / 2 / -0
    My Motion Simulator:
    Arduino, 4DOF
    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:
    436
    Location:
    FRANCE
    Balance:
    5,963Coins
    Ratings:
    +563 / 2 / -0
    My Motion Simulator:
    Arduino, 4DOF
    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:
    - 28Coins
    Ratings:
    +21 / 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:
    436
    Location:
    FRANCE
    Balance:
    5,963Coins
    Ratings:
    +563 / 2 / -0
    My Motion Simulator:
    Arduino, 4DOF
    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:
    176Coins
    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:
    571
    Location:
    Bruxelles
    Balance:
    1,942Coins
    Ratings:
    +296 / 2 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 4DOF
    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:
    176Coins
    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:
    176Coins
    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,323Coins
    Ratings:
    +77 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    ask him for that
  10. Pinello

    Pinello New Member

    Joined:
    Jan 29, 2017
    Messages:
    11
    Location:
    Norway
    Balance:
    206Coins
    Ratings:
    +4 / 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:
    571
    Location:
    Bruxelles
    Balance:
    1,942Coins
    Ratings:
    +296 / 2 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 4DOF
    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 Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,461
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    144,602Coins
    Ratings:
    +10,741 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
  13. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,145
    Location:
    Oklahoma City, USA
    Balance:
    16,568Coins
    Ratings:
    +1,831 / 32 / -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 Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,461
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    144,602Coins
    Ratings:
    +10,741 / 52 / -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,145
    Location:
    Oklahoma City, USA
    Balance:
    16,568Coins
    Ratings:
    +1,831 / 32 / -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 Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,461
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    144,602Coins
    Ratings:
    +10,741 / 52 / -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:
    11
    Location:
    Norway
    Balance:
    206Coins
    Ratings:
    +4 / 0 / -0
    So, 2 Arduinos it is.. :)
  18. Wanegain

    Wanegain Active Member

    Joined:
    Nov 6, 2013
    Messages:
    571
    Location:
    Bruxelles
    Balance:
    1,942Coins
    Ratings:
    +296 / 2 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 4DOF
    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:
    436
    Location:
    FRANCE
    Balance:
    5,963Coins
    Ratings:
    +563 / 2 / -0
    My Motion Simulator:
    Arduino, 4DOF
    • Like Like x 3
    • Winner Winner x 1
  20. Pierre Lalancette

    Pierre Lalancette Sir Lalancelot Gold Contributor

    Joined:
    Dec 11, 2016
    Messages:
    943
    Occupation:
    3D teacher
    Location:
    Quebec, Canada
    Balance:
    7,683Coins
    Ratings:
    +883 / 6 / -0
    My Motion Simulator:
    3DOF, 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?