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 SMC3 Arduino 3DOF Motor Driver and Windows Utilities

Discussion in 'SimTools compatible interfaces' started by RufusDufus, Dec 1, 2013.

  1. xytras

    xytras Member Gold Contributor

    Joined:
    May 28, 2015
    Messages:
    92
    Location:
    germany
    Balance:
    587Coins
    Ratings:
    +22 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Well, I assume the warranty fails if you go beyond the limits. Anyway I just ordered two .. 1x 2x60 and 1x 2x25. Nevertheless I´ll try to get this chinese thing working, maybe I can use it for some third or fourth motor then.
    • Winner Winner x 2
  2. xytras

    xytras Member Gold Contributor

    Joined:
    May 28, 2015
    Messages:
    92
    Location:
    germany
    Balance:
    587Coins
    Ratings:
    +22 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Okay in mode1 the green chinese thing works in neutral, haven´t checked under load yet though.
  3. volmab

    volmab New Member

    Joined:
    Sep 19, 2014
    Messages:
    1
    Balance:
    257Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    3DOF
    Hi to all. Pls help) I`m use arduino uno r3+ibt-2+wiper motor for my project and need to rotate motors to different angle with different speed. Command analogWrite(LPWM_Output, 250) rotate motor with speed 250, for examle how to rotate to 50 degress with speed 250? sorry for my english
  4. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    13,983Coins
    Ratings:
    +962 / 7 / -1
    Hi volmab, If you are using the SMC3 code there should be no need to change any code to get positioning to work but you will need to have a POT feedback connected as per the diagrams in the first post.

    EDIT: You will need to edit the line at top of code to be #define MODE2 with the IBT-2 H-bridges.
  5. Andrew M

    Andrew M P_H_O_3_N_I_X Gold Contributor

    Joined:
    May 11, 2017
    Messages:
    105
    Occupation:
    IT Chief Programmer / CTO
    Location:
    Warsaw, Poland
    Balance:
    543Coins
    Ratings:
    +96 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, Arduino
    Hi, @RufusDufus at first I want to THANK YOU for an efford and time you invested in programming the SMC3 S/W and WTools ! It is just GREAT ! and also perfectly optimised ! :cheers
    I am using your code in MODE2 but still learning and experimenting on its configuration. Recently I manage to built my first 2DOF [ is based on: Arduino Nano / IBT-43A H-bridges / Bi HALL 180 / 200W motors 12V ]
    It is not as easy to tweak all the options you programmed in the alghoritm - there is plenty of settings, so I still get lost a bit :) After reading this thread I definitelly need to try some changes on my RIG [ it moves accordingly on STools and even works a little on LifeForSpeed - but not very smooth. It still shakes, I fixed the main shafts to not have losseness and in config - should I lower the KI, KD and KS to near 0 from 40, and lower the minPWN from 100, to 10-20 not to overshot ? I already learned that too high limit shuts down the motors - so already lowered it and now don`t need to manually set them back on during tests ]
  6. evolaco

    evolaco Member

    Joined:
    Sep 27, 2015
    Messages:
    241
    Location:
    Spain
    Balance:
    1,193Coins
    Ratings:
    +24 / 0 / -0
    My Motion Simulator:
    2DOF
    Have you checked the voltage of the power supply while the motors are running? Do you have voltage surges?
  7. Andrew M

    Andrew M P_H_O_3_N_I_X Gold Contributor

    Joined:
    May 11, 2017
    Messages:
    105
    Occupation:
    IT Chief Programmer / CTO
    Location:
    Warsaw, Poland
    Balance:
    543Coins
    Ratings:
    +96 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, Arduino
    I was thinking about this, and actually could be - because I have 2 PSU of 350W [ first 2 motors are connected to first, since I planned in future to add a third motor to second PSU - planned as I had at first 2 * 40W windshield motors and during the project upgraded to more powerfill 200W motors - which actually needs a full 400W PSU at least = and could be insufficient -> I will first reconnect my 2`nd motor to it, to have 1 motor per each PSU and check the difference ]
  8. evolaco

    evolaco Member

    Joined:
    Sep 27, 2015
    Messages:
    241
    Location:
    Spain
    Balance:
    1,193Coins
    Ratings:
    +24 / 0 / -0
    My Motion Simulator:
    2DOF
    Could you watch the voltage while the motors are moving energetically? To me I raise the voltage of the power supply and I do not know why, you use the wiring of smc3 without any modification?
  9. Andrew M

    Andrew M P_H_O_3_N_I_X Gold Contributor

    Joined:
    May 11, 2017
    Messages:
    105
    Occupation:
    IT Chief Programmer / CTO
    Location:
    Warsaw, Poland
    Balance:
    543Coins
    Ratings:
    +96 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, Arduino
    I changed hardware like each IBT [ with 200W motor ] has a PSU unit [ 350W ], so 2 x 2 and voltage seems not to be a problem; set the KI/KP to 0 - and is really better ,more smooth on SMC3Utils.
    Now read the posts and found information of this "EN" date format settings issue [ regional in OS ] casusing similar effects to mine - also on axis testing movement is not smooth, but more like 20-40-60-80 and sometimes strange reverse move [ since my RIG seems to work OK in SMC3Utils - smooth in all tests even with load ] but in SimTools cannot maintain a neutral position... [ in LFS going straight is shaking terribly, when sway on hard turns left/right seems have better moves and not shaking ] - maybe PWN [ 200 ] and KP [ 400 ] is overshoting [ set my PWMmin to low - around 10 ], will now check those regional settings just in case. @evolaco - "you use the wiring of smc3 without any modification?" - can you also please explain why should I modify ?
  10. evolaco

    evolaco Member

    Joined:
    Sep 27, 2015
    Messages:
    241
    Location:
    Spain
    Balance:
    1,193Coins
    Ratings:
    +24 / 0 / -0
    My Motion Simulator:
    2DOF
    I have told you about the installation in case you had a battery or diodes, I have problems with the ibt2 because the voltage rises and not the problem, you have checked the voltage of the source while using the motors?
  11. Andrew M

    Andrew M P_H_O_3_N_I_X Gold Contributor

    Joined:
    May 11, 2017
    Messages:
    105
    Occupation:
    IT Chief Programmer / CTO
    Location:
    Warsaw, Poland
    Balance:
    543Coins
    Ratings:
    +96 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, Arduino
    Actually I checked and it wasn`t a voltage issue in my case - but finally found a solution to the uncontrolled "shakes" I had... it was all caused by a Windows OS - its Regional settings [ just need to change to English / and localisation to USA ] and i all begin instantly work as should from the beginning [ just took a lot of time for debugging and looking for all potential settings - untill I finally found this / or actually read on page 38 about a "datetime" bug in SMC3; also my localisation is not very popular - not many people had such problems - so was a little hard to find, but finally - my DOF is working better, much better :) ].
    • Informative Informative x 1
  12. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    13,983Coins
    Ratings:
    +962 / 7 / -1
    The bug is not in SMC3 or SMC3Utils....
  13. Andrew M

    Andrew M P_H_O_3_N_I_X Gold Contributor

    Joined:
    May 11, 2017
    Messages:
    105
    Occupation:
    IT Chief Programmer / CTO
    Location:
    Warsaw, Poland
    Balance:
    543Coins
    Ratings:
    +96 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, Arduino
    @RufusDufus - OK, You are right since SMC3 may be only affected by this OS functionality [ you mentioned some time ago about a fix that could be implemented - probably a workaround ] and THANK YOU ! [ you know... Your S/W brings to life many DOF`s in the world including mine...:thumbs [ so I trully hope you din`t feel offended by this small "bug" thing I mentioned... :sos ]
  14. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    13,983Coins
    Ratings:
    +962 / 7 / -1
    No offense taken, just trying to help people understand they don't need to try to start modifying SMC3 as that is not the problem.
  15. gigi

    gigi Active Member

    Joined:
    Nov 16, 2013
    Messages:
    436
    Balance:
    1,241Coins
    Ratings:
    +132 / 1 / -0
    My Motion Simulator:
    2DOF, JRK, 4DOF
    Hallo,
    In my Arduino I read as follow:
    // Softstart by BlazinH
    //****************************************************************************************************************
    //****************************************************************************************************************
    //SET SOFTSTART SPEED
    const int SSloop = 30;
    //****************************************************************************************************************

    // Set to MODE1 for use with a typical H-Bride that requires PWM and 1 or 2 direction inputs
    // Set to MODE2 for a 43A "Chinese" IBT-2 H-Bridge from e-bay or equiv
    // Set to MODE3 for a Sabretooth setup in simple serial mode

    #define MODE3

    // Uncomment the following line to reverse the direction of Motor 1.
    // #define REVERSE_MOTOR1

    // Uncomment ONE of the following lines to enable analogue input AN5 as a scaler for the motion values.
    // #define ENABLE_POT_SCALING
    // #define ENABLE_NON_LINEAR_POT_SCALING


    // Uncomment the following line to enable the second software serial port.
    // NOTE: This is currently not working - leave commented out until fixed!!!
    // #define SECOND_SERIAL

    // COMMAND SET:
    //

    My pots are TT Electronics 6127V1A180L.5FS .
    It's compatible with SMC3?
    Do I change something in Arduino string? this one:
    // Uncomment ONE of the following lines to enable analogue input AN5 as a scaler for the motion values.
    // #define ENABLE_POT_SCALING
    // #define ENABLE_NON_LINEAR_POT_SCALING

    Thanks
  16. gigi

    gigi Active Member

    Joined:
    Nov 16, 2013
    Messages:
    436
    Balance:
    1,241Coins
    Ratings:
    +132 / 1 / -0
    My Motion Simulator:
    2DOF, JRK, 4DOF
    Hallo
    I use this PSU PSU AWF-11DC-1400 1400W https://www.xsimulator.net/community/threads/how-to-mod-a-12v-90a-psu.6650/#post-130442, one PSU for one sabertooth 2x32.
    For testing I connect only one motor zyt90 23A - 40Apeak. The PSU should support 90A.
    As You can seein the video with only 90 PWmax the psu shutting down, probabbly in peak protection.
    which is your opinion aboutthis problem?
    1)a psu problem
    2)bad configuration of my smc3
    3) bad configurationof my sabertooth 2x32 in describe software. In describe software I change only 115200 baud and 0,01 s (100m/s) serial timeout (like Rufus suggest)
    Any idea to fix my problem?
    thanks
    gigi
    Last edited: Jul 13, 2017
  17. Gadget999

    Gadget999 Well-Known Member

    Joined:
    Dec 27, 2015
    Messages:
    1,062
    Location:
    London
    Balance:
    7,665Coins
    Ratings:
    +240 / 6 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, 6DOF
    i have a couple of questions

    i have a 2dof with rear mounted motors

    1. is it possible to use the util program and drive 2 motors together so they both follow the same pattern

    2.The second motor is 180 degrees out of phase - i am using a hall sensor type pot that does not allow me to reverse the voltage - is there a simple way to make up read down and vice versa (or do i need to do it in the arduino code)

    3. I can see the codes to set the pid setting -

    // [Dxx],[Exx],[Fxx] Send the Kp parameter for motor 1,2,3 where xx is the Kp value multiplied by 100
    // [Gxx],[Hxx],[Ixx] Send the Ki parameter for motor 1,2,3 where xx is the Ki value multiplied by 100
    // [Jxx],[Kxx],[Lxx] Send the Kd parameter for motor 1,2,3 where xx is the Kd value multiplied by 100
    // [Mxx],[Nxx],[Oxx] Send the Ks parameter for motor 1,2,3 where xx is the Ks value

    Does simtools set these values or do we have to hardcode them in the arduino code ?


    thanks for a great product - do you work with control systems for a living ?
    Last edited: Jul 13, 2017
  18. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    13,983Coins
    Ratings:
    +962 / 7 / -1
    Since you are using sabretooth, the PWM has no effect, it is being driven with serial data. I think you need to configure the sabretooth with their software but I don't have one so not 100% sure.

    Try posting in the SMC3 Sabretooth thread where you downloaded the software as you might get more responses.
  19. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    13,983Coins
    Ratings:
    +962 / 7 / -1
    The easiest way is to just reverse the motor (in relation to POT) instead, by swapping the two wires to the motor. If you really want to change the POT you will have to edit arduino code.
    • Agree Agree x 1
  20. Gadget999

    Gadget999 Well-Known Member

    Joined:
    Dec 27, 2015
    Messages:
    1,062
    Location:
    London
    Balance:
    7,665Coins
    Ratings:
    +240 / 6 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, 6DOF
    Hi Rufus - thanks for the quick reply !!

    i have another question

    3. I can see the codes to set the pid setting -

    // [Dxx],[Exx],[Fxx] Send the Kp parameter for motor 1,2,3 where xx is the Kp value multiplied by 100
    // [Gxx],[Hxx],[Ixx] Send the Ki parameter for motor 1,2,3 where xx is the Ki value multiplied by 100
    // [Jxx],[Kxx],[Lxx] Send the Kd parameter for motor 1,2,3 where xx is the Kd value multiplied by 100
    // [Mxx],[Nxx],[Oxx] Send the Ks parameter for motor 1,2,3 where xx is the Ks value

    Does simtools set these values or do we have to hardcode them in the arduino code ?