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. Attyla.pl

    Attyla.pl Member

    Joined:
    Oct 1, 2023
    Messages:
    130
    Location:
    Polska
    Balance:
    527Coins
    Ratings:
    +31 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino
    AS5600 has an operating voltage of 3.3V and from the arduino you get 5V it has no right to work.
    MT6701 has an operating voltage of 3.3-5V so theoretically it should work , but first of all it requires some kind of magnet mounted on the pinion whose field is to measure , in addition it has a number of inputs I do not know if the analog output is active standard or it requires some programming of the sensor .
    https://www.skytech.ir/DownLoad/File/4471_5001592712907.pdf

    In general, at the beginning you can safely use ordinary potentiometers 10KOhm
    https://www.youtube.com/@DMAX_DIY
  2. Gefahren

    Gefahren Member

    Joined:
    Mar 9, 2024
    Messages:
    55
    Occupation:
    Electronics Engineer
    Location:
    Central Mississippi, USA
    Balance:
    395Coins
    Ratings:
    +66 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino, Motion platform
    ordanssela I use the AS5600 chips. All the ones I've seen on Amazon and such are configured for I2C and not analog out. For most of them it is resistor R4 that needs to be removed to enable the analog output. The ones like what I have will work off of either 3.3V or 5V without any modification, but will need to be powered off of 5V to give the correct analog output for the Arduino.
    Screenshot 2024-07-29 205151.png

    Attyla.pl there is no real problem with the SMC3 code, it does a lot of good things. If your motion simulator motors only need a Proportional control, then everything is good. If your motors need all the extra control that a full PID loop will give, then look at one of the other versions of SMC3 that people have done since several seem to have 'fixed' the code errors.
    If your motors have lots of natural dampening (from driving a high ratio gearbox for example) then just a proportional control should be fine. If they tend to overshoot or can be back driven easily then you probably want the better control.
  3. Attyla.pl

    Attyla.pl Member

    Joined:
    Oct 1, 2023
    Messages:
    130
    Location:
    Polska
    Balance:
    527Coins
    Ratings:
    +31 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino
    Gefahren, thank you for your reply which I think explains a bit my problems with controlling the motor with the IBT-2 bridge , when moving fast the motor overshoot of position. Interestingly this problem disappeared after replacing the controller with 100A motor controllers.
    As for changing the SMC3 code I will try but it will be hard since I am completely unfamiliar with it :).
  4. Gefahren

    Gefahren Member

    Joined:
    Mar 9, 2024
    Messages:
    55
    Occupation:
    Electronics Engineer
    Location:
    Central Mississippi, USA
    Balance:
    395Coins
    Ratings:
    +66 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino, Motion platform
    • Like Like x 1
    • Useful Useful x 1
  5. ordanssela

    ordanssela New Member

    Joined:
    Jul 17, 2023
    Messages:
    3
    Balance:
    - 24Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, SimforceGT, Motion platform
    Gefahren, Attyla.pl Thanks for responding, I'm dying to test the magnetic sensors, you guys are awesome.
  6. Gefahren

    Gefahren Member

    Joined:
    Mar 9, 2024
    Messages:
    55
    Occupation:
    Electronics Engineer
    Location:
    Central Mississippi, USA
    Balance:
    395Coins
    Ratings:
    +66 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino, Motion platform
    Wow, I feel like a complete idiot right now, but I will publicly admit that I was wrong.

    I completely missed that inside the PID calculations of SMC3 the variables are declared 'static' which means they retain their value between function calls and do not get reset every time. That means what I said was wrong with The CalcMotor1PID function is untrue. It is working as it should.

    CalcMotor2PID and CalcMotor3PID still have those two extra lines that mess up the derivative calculation to always be zero. Also, CalcMotor3PID still has the bit shifts that reduces the effect of the Integral Term and would increase the effect of the Derivative Term if it wasn't always zero.

    So, I feel that my foot has been inserted as far in my mouth as I can get it, and I apologize for being even partially wrong.
    • Informative Informative x 2
    • Like Like x 1
    • Friendly Friendly x 1
  7. lihao

    lihao New Member

    Joined:
    Jul 30, 2024
    Messages:
    4
    Balance:
    - 42Coins
    Ratings:
    +2 / 0 / -0
    My Motion Simulator:
    3DOF
    Hello, I had a strange problem when I was making it. My smc3 until and simtools initial positions are not the same. My build uses two motors that extend about 30 degrees out in the starting position. The picture is of my smc3 until the initial position, then when I open simtools, both motors will automatically deflect about 30 degrees, and there will be this mutation every time when running through 0 and 1 of the axis.
    Due to forum rules I can't send pictures, so I can only describe my problem in as much detail as possible.
    In the smc3until program, both of my motors run normally and smoothly, but when the axis of simtools passes through 0 and 1, there will always be a sudden change, automatically rotating through a range of 30 degrees.
    I can't send pictures due to forum rules, so I'll just try to describe my problem in as much detail as possible.
    In the smc3until program, both of my motors ran normally and smoothly, but there was always a sudden change when the axis of simtools passed 0 and 1, automatically turning the range of 30 degrees.
    Last edited by a moderator: Aug 23, 2024
  8. lihao

    lihao New Member

    Joined:
    Jul 30, 2024
    Messages:
    4
    Balance:
    - 42Coins
    Ratings:
    +2 / 0 / -0
    My Motion Simulator:
    3DOF
    Oh, it looks like I can send pictures, the first is my smc3until initial position and the second is my simtools initial position.

    Attached Files:

    Last edited by a moderator: Aug 23, 2024
  9. lihao

    lihao New Member

    Joined:
    Jul 30, 2024
    Messages:
    4
    Balance:
    - 42Coins
    Ratings:
    +2 / 0 / -0
    My Motion Simulator:
    3DOF
    Presumably due to some problems with Google Translate, I have to re-send the translated text。
    Hello, I had a strange problem during production, my smc3 was not in the same initial position as simtools. My fabrication used two motors that were extended about 30 degrees from the starting position. The picture is my smc3 up to the initial position, and then when I turn on simtools, both motors automatically deflect by about 30 degrees, with this mutation every time they pass the 0 and 1 of the axis while running.

    In the smc3until program, both of my motors ran normally and smoothly, but there was always a sudden change when the axis of simtools passed 0 and 1, automatically turning the range of 30 degrees.
  10. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,868
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    146,930Coins
    Ratings:
    +10,847 / 53 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Can you please post pictures of all your SMC3 settings, and your SimTools settings.

    Does SMC3 work as expected? Could you please post a picture of the SMC3 Sine Wave test running.
  11. lihao

    lihao New Member

    Joined:
    Jul 30, 2024
    Messages:
    4
    Balance:
    - 42Coins
    Ratings:
    +2 / 0 / -0
    My Motion Simulator:
    3DOF
    Hello, my problem has been solved today. I have done two things, one is to update the simtools software and plug the interface tightly. After that, the initial position of simtools and smc3until is the same. Because I did both things at the same time and then tested them, I don't know what the problem is, but it has been solved.:grin
    • Winner Winner x 2