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

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

  1. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    15,901Coins
    Ratings:
    +1,016 / 10 / -1
    Set the Max limits to zero.
  2. Gadget999

    Gadget999 Well-Known Member

    Joined:
    Dec 27, 2015
    Messages:
    1,935
    Location:
    London
    Balance:
    11,838Coins
    Ratings:
    +473 / 9 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, 6DOF
    Hi Rufusdufus - thanks for the reply

    do i do that in the arduino code or in the util program
  3. Pit

    Pit - - - - - - - - - - - - - - - - Gold Contributor

    Joined:
    Oct 2, 2013
    Messages:
    3,012
    Location:
    Switzerland
    Balance:
    30,439Coins
    Ratings:
    +3,089 / 31 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    SMC3 utility
  4. Gadget999

    Gadget999 Well-Known Member

    Joined:
    Dec 27, 2015
    Messages:
    1,935
    Location:
    London
    Balance:
    11,838Coins
    Ratings:
    +473 / 9 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, 6DOF
    took the sim for a drive today - hitting the curbs at high speed caused the sim to stop moving

    is there something causing a shutdown based on the values in the sim program (Rfactor) being too big ?
  5. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,048
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    147,986Coins
    Ratings:
    +10,884 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Likely your settings are too aggressive and create an overload spike in big hits, post all of your settings on your own build thread and members can advise on what to try.
    • Agree Agree x 2
  6. Gadget999

    Gadget999 Well-Known Member

    Joined:
    Dec 27, 2015
    Messages:
    1,935
    Location:
    London
    Balance:
    11,838Coins
    Ratings:
    +473 / 9 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, 6DOF
    hi noorbeast - i will post the links on my build thread - unfortunately i don't seem to get replies when i post there
    • Like Like x 1
  7. Andrea 1968

    Andrea 1968 Member

    Joined:
    Jul 1, 2015
    Messages:
    65
    Location:
    italia
    Balance:
    193Coins
    Ratings:
    +40 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Maybe most people did not understand that modifying the values on smc3 utility with arduino connected you go to changing the parameters of the software inside arduino i think that in this case if you set max limits to zero (Advice of RUFUS)
    you should solve !!!
  8. Gadget999

    Gadget999 Well-Known Member

    Joined:
    Dec 27, 2015
    Messages:
    1,935
    Location:
    London
    Balance:
    11,838Coins
    Ratings:
    +473 / 9 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, 6DOF
    i watched the sim when it shut down - the motors did not move to max limits
  9. Andrea 1968

    Andrea 1968 Member

    Joined:
    Jul 1, 2015
    Messages:
    65
    Location:
    italia
    Balance:
    193Coins
    Ratings:
    +40 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    I also had this problem with motor 2 then setting max limit to zero and clip input close to zero (braking zone before max limit) consequently PWM rev = 0 I solved, motor 2 stopped locking in random way too If it did not seem to exceed the limits
  10. Andrea 1968

    Andrea 1968 Member

    Joined:
    Jul 1, 2015
    Messages:
    65
    Location:
    italia
    Balance:
    193Coins
    Ratings:
    +40 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Then I did some tests for a fine adjustment, in my picture my settings:
    setting (FILEminimizer).jpg
    Motore 2=Motore 1
  11. Gadget999

    Gadget999 Well-Known Member

    Joined:
    Dec 27, 2015
    Messages:
    1,935
    Location:
    London
    Balance:
    11,838Coins
    Ratings:
    +473 / 9 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, 6DOF
    Thank you for the assistance. I will try a change to the settings. I am using the igt-2 so i wonder if i may have tripped something in the hbridge.

    I will try and get some time on the project tomorrow.

    I see you p setting is quite big 400 mine is only 4 !
  12. Gadget999

    Gadget999 Well-Known Member

    Joined:
    Dec 27, 2015
    Messages:
    1,935
    Location:
    London
    Balance:
    11,838Coins
    Ratings:
    +473 / 9 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, 6DOF
    did some testing today - the I number in the pid was causing the trouble

    settings are

    P=40
    I=1
    D=0
    S=1

    is the arduino code actually shutting the motors down if we request too much movement ?

    i tried rebooting only the motor h bridge and was unable to get motion back

    where in the code does the motor shutdown ?
    Last edited: Aug 27, 2017
  13. speedy

    speedy Well-Known Member

    Joined:
    Feb 1, 2012
    Messages:
    1,193
    Location:
    Alexandria , Egypt
    Balance:
    7,931Coins
    Ratings:
    +1,287 / 10 / -0
    My Motion Simulator:
    3DOF, AC motor, Arduino, Motion platform
    I've been working with SMC for a while now and can tell that both aggressive and mild settings are both bad and normally causing shutdown to the code " you can't beat physics where motors can't keep up with motion " ...

    So, the best solution I found is ..... >> by using aggressive enough settings in the SMC Util. for each motor to barely keep tracking with the sign and triangle motion test + double the lowest DOF values in the tuning center in SimTools for the selected game ... by that you may get 90% smaller overall movements but still perfectly accurate with no shutdown for the code .
    • Informative Informative x 1
  14. CaptBluescreen

    CaptBluescreen New Member

    Joined:
    Aug 31, 2017
    Messages:
    5
    Location:
    Germany
    Balance:
    131Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Hi together,

    before I can starting with my problem -> I am using an Arduino Mega board! Is that a problem?

    I have a problem with the BT-2 Setup, because my motor doesn't move. I have wiring up my BT-2 and Arduino like on the first page.

    I have set the Mode to Mode2 and uploaded it to my arduino.

    When I start the SMC3 Utility, I can see the PWM output, but nothing happens.

    For testing, I have only one H-Bridge, Motor and Pot connected to my Arduino - hope that this is ok.
    I did tested the H-Bridge, Arduino and Motor with another script, where I can control the motor with the pot and that's works - So, I have no idea what's the problem.

    Can anyone help me? Would be great, because we finished the chair - only the electronic is missing.

    Thanks and Cheers
    Jochen

    Attached Files:

  15. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    15,901Coins
    Ratings:
    +1,016 / 10 / -1
    Make sure MODE2 is written in capitals...

    #define MODE2
  16. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    15,901Coins
    Ratings:
    +1,016 / 10 / -1
    The SMC3 code ONLY shuts down the motors if the POT feedback signal goes beyond the Max Limits setting. If the POT feedback is not going outside these limits it's not the software - probably the H-Bridge drivers going into thermal shutdown or overcurrent shutdown.

    Note if the SMC3 is shutting down the motors (you see the button in the top left of the SMC3Utils program say OFF) but you don't think the feedback is going out of range then you probably have noise in the system somewhere. A very short spike is enough for SMC3 to shut the motors down if the spike goes beyond the Max Limits but it might not display on the graph because its so short.

    If the motors shutdown but SMC3Utils still says ON in the top left of screen then it is the H-Bridges shutting down or PSU or other hardware issue.
    • Like Like x 1
    • Informative Informative x 1
  17. CaptBluescreen

    CaptBluescreen New Member

    Joined:
    Aug 31, 2017
    Messages:
    5
    Location:
    Germany
    Balance:
    131Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Yes, MODE2 is written in capitals. I think, that it is a MegaBoard problem. I found something about PORTD = portstatus; and that it will not work on a MegaBoard - so I have to wait for my Uno to arrive.
  18. Gadget999

    Gadget999 Well-Known Member

    Joined:
    Dec 27, 2015
    Messages:
    1,935
    Location:
    London
    Balance:
    11,838Coins
    Ratings:
    +473 / 9 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, 6DOF
    Hi @RufusDufus ,

    thanks for the reply - i rebooted the ibt-2 driver and the movement did not come back

    can you show me the line of code that shuts down the motors - i will get it to flash an led if the limits have been exceeded

    (i have set the limits to zero using the smc3 interface)

    should i shield the cables to the potentiometers to prevent noise ? can a high and low pass filter be implemented ?

    regards
  19. CaptBluescreen

    CaptBluescreen New Member

    Joined:
    Aug 31, 2017
    Messages:
    5
    Location:
    Germany
    Balance:
    131Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Hi at all,

    so i tested a little bit around and searched for the problem with the PORTD mapping on an Arduino MEGA2560 and I found out, that I had to remap the PORTD.

    So, I added this into the setup() function:
    DDRD = 0B11111111;
    PORTD = 0B11111111;
    OutputPort =PORTD;

    I set the digital pins 0-7 as output and as high. (Not sure if it is correct)

    Then I have tested it again with the wiring diagramm from the first page.

    The motor doesn't moved. So, I connected R_EN and L_EN to 5v. The motor moved, but only in clockwise. When I switched the RPWM and LPWM, the direction changed.

    I would be interested in how you wired the h-bridge. I have a BTS7960 H-Bridge. I get only On or Off signal on the PWM Pin 9 - I can disconnect the Digital Pin 2, it makes no difference...
  20. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    15,901Coins
    Ratings:
    +1,016 / 10 / -1
    The code to switch the motors off is (duplicated for each motor):
    Code:
    if ((Feedback1 > CutoffLimitMax1) || (Feedback1 < CutoffLimitMin1)) { DisableMotor1(); } 
    As you can see if the Max Limit is set to zero as you have done it will never switch the motor off (CutoffLimitMax = 1023-Max Limits setting). Unless of course the 10bit ADC can return a value greater than 1023 - haven't looked into that?

    If you want to flash the LED add it to the if test immediately following the above code.
    Yes shielded cables and/or capacitor on the input pin to GND may help depending on the source of your problem.
    • Like Like x 2
    • Informative Informative x 1