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. Chris_Beeves

    Chris_Beeves Active Member Gold Contributor

    Joined:
    May 31, 2019
    Messages:
    349
    Balance:
    2,016Coins
    Ratings:
    +244 / 4 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 4DOF
    A little bit of a lifter here, but I haven't gotten around the encoder issues until very recently.

    In utils you can only set as low as 5kHz, I need the PWM frequency to be 3.9kHz and from what I can see in the arduino sketch that seems doable, I just can't figure out where to put it. And will not Utils change it back when I run it again?`

    Cheers!
  2. Manes

    Manes Member

    Joined:
    Jun 12, 2020
    Messages:
    106
    Balance:
    179Coins
    Ratings:
    +12 / 0 / -0
    Is necessary to put resistors between the motors and Sabertooth??
  3. Pierre Lalancette

    Pierre Lalancette Sir Lalancelot Gold Contributor

    Joined:
    Dec 11, 2016
    Messages:
    960
    Occupation:
    Tech Artist
    Location:
    Quebec, Canada
    Balance:
    7,785Coins
    Ratings:
    +896 / 6 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino, 6DOF
    No, I had only a relay, on or off.
  4. Ronan Design

    Ronan Design Roman Design - Custom MSFS Scenery

    Joined:
    Jun 4, 2021
    Messages:
    218
    Occupation:
    Web Designer, MSFS Scenery Designer
    Location:
    Toronto, Canada
    Balance:
    1,451Coins
    Ratings:
    +88 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Hi, How can I scale the pot input data?
    I'm building my first motion rig. I put everything together (no power to motors yet) and I replaced pots with AH3503 Hall Sensors and magnets attached to motors. Good news is that it works, and I'm getting data. But the range is too narrow. This screenshot capture the entire range of the Hall Sensor output (that is only half of motor axis rotation of course, then it repeats for the second half, but that should be OK, as I don't need the other half anyway)
    upload_2021-9-8_19-16-55.png
    Somehow I need to "stretch" it to fill my entire range, and center it too, so bottom and top ranges are similar. Input Scaling seems to do something else - increase output, not input, correct? So what do I do? Any INO code to modify to translate the range to the one of a typical pot?
  5. hannibal

    hannibal Active Member

    Joined:
    Sep 29, 2018
    Messages:
    677
    Balance:
    4,490Coins
    Ratings:
    +297 / 4 / -0
    My Motion Simulator:
    6DOF
    you put the switch anywhere you can access...i kept my switch near the arduino but accessible so when i need to use SMC3, i disengage the ground.
    once done with SMC3 settings, i then reground the pin by closing the switch
  6. Ronan Design

    Ronan Design Roman Design - Custom MSFS Scenery

    Joined:
    Jun 4, 2021
    Messages:
    218
    Occupation:
    Web Designer, MSFS Scenery Designer
    Location:
    Toronto, Canada
    Balance:
    1,451Coins
    Ratings:
    +88 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Anyone can recommend good settings for PGSaw motors on IBT2 H bridges, for a flight sim? How high should I set PWMMax? Doesn't it make sense to set it to the maximum possible (is it 256?) to use motor's full power when needed? What about everything else? What's a typical PWMMin needed to keep them from moving when idle? PWMRev for effective braking without braking down motors (or me)?

    BTW my DIY Hall sensor based rotation sensors are working, but for now I just modified the code to multiply the analog read. I added something like ...*1.45-350 to get it to the most of the range and centered. But maybe there is a better way? Took a lot of trial and error. I then set Clip and Limit to be inside the sine wave that sensors do on full rotation, so it would never go there, hopefully.
    Last edited: Sep 13, 2021
  7. Ronan Design

    Ronan Design Roman Design - Custom MSFS Scenery

    Joined:
    Jun 4, 2021
    Messages:
    218
    Occupation:
    Web Designer, MSFS Scenery Designer
    Location:
    Toronto, Canada
    Balance:
    1,451Coins
    Ratings:
    +88 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    PSA: I connected the pot for scaling and got a very erratic results. I made it output AnalogRead from AN5 and it really was only changing at the end of rotation and only in 800...1024 range, so I got a sudden and huge bump in response. Trying to troubleshoot I switched input from AN5 to AN4, changing the pin in the code. And suddenly everything worked well. It may be my Arduino R3 clone from Ali Express, but if you see a similar result - just change your pot analog pin.
  8. John Snell

    John Snell Member

    Joined:
    May 31, 2021
    Messages:
    63
    Balance:
    190Coins
    Ratings:
    +59 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Hi all.

    I’m trying to get my motors working correctly with SMC3Utils for my motion rig project. I think I’m nearly there, but I’ve spent many hours trying to figure an issue out and would really appreciate some help.

    I’m sending the PWM signal from the Arduino to the motor driver board, and also the ENA output to control motor direction.

    Running a sinewave (as an example) in SMC3Utils (using mode2 in smc.ino) my motor runs nicely forwards and backwards doing nearly 2 revolutions per sinewave direction (rise/fall), as long as there is no feedback pot attached.



    When I attach the feedback pot it seems like the system is now trying to follow that Target so exactly that the motor is constantly running forwards/backwards or stopping/starting.

    SMC3-Capture-659771.9817948.jpg

    In fact it seems to do a very good job (unless I’ve misunderstood), but I obviously can’t use it like this.



    One thing... they are BLDC motors with BLDC driver boards (rather than an h-bridge type driver for a standard DC motor).

    Lastly, yes the motors themselves have hall sensors so theoretically I can get positional information from them instead of a pot, but right now that’s adding complexity I don’t need.

    So, is there anything obvious I am doing wrong, or misunderstanding? Any ideas greatly appreciated!

    Thanks a lot
    John
    Last edited: Sep 27, 2021
  9. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,153
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    148,604Coins
    Ratings:
    +10,909 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Please post pictures of all of your settings.

    And check the pot is wired the correct way around.
  10. John Snell

    John Snell Member

    Joined:
    May 31, 2021
    Messages:
    63
    Balance:
    190Coins
    Ratings:
    +59 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Thanks for prompt reply @noorbeast. Yes that pot wiring, and settings, can be confusing to me.

    With pot wiring reversed, the target and feedback seem (?) to operate opposite to each other, and the feedback quickly goes out of bounds shutting the motor off.

    I have just reversed the pot wiring. This time I used "Manual" mode, and started with Target and Feedback close together. The result is shown in the screen shot below. This happens as soon as I apply power to the motor (24v to the driver in fact), allowing it to turn. Have I understood what this shows correctly?
    SMC3 reversed pot manual control.jpg

    Below is a screenshot showing settings. Anything obviously wrong?
    smcs settings.JPG

    Also, it's a linear 10k pot. Any issues with value of that?

    Thank you!
    Last edited: Sep 27, 2021
  11. zhai1987

    zhai1987 Member

    Joined:
    Sep 7, 2021
    Messages:
    96
    Balance:
    320Coins
    Ratings:
    +11 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF, AC motor
    Brothers, do you know where Smc3 can modify the exercise schedule?

    Attached Files:

  12. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,153
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    148,604Coins
    Ratings:
    +10,909 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Are you sure the pot is centered in SMC3 prior to being attached and power applied?

    With respect to your settings it would help to know how you came to have the settings you do, as some look to need some refinement: https://www.xsimulator.net/communit...driver-and-windows-utilities.4957/#post-48121

    Such as:

    Clip Input Used to create a band at either limit of the target range beyond which any values sent to the SMC3 are clipped. In addition to this clipping, if the motor feedback does move beyond this range (typically through inertia), the SMC3 will attempt to brake the motors hard by driving them in reverse until they are back out of this limit zone. The value can be anything from 0-255 (however can’t be less than the current limit setting). Reverse braking is applied in the band between the Clip Input and the Max Limit settings. Reverse braking can be disabled - refer to PWMrev.

    Max Limits Used to create a band at either limit of the feedback range beyond which if the motors move (typically through inertia) the SMC3 will automatically shutdown the drivers and keep them disabled until reset. This is essentially a safety mechanism if something goes wrong. The value can be between 0-255 (however can’t be greater than the current clip setting).
  13. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,153
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    148,604Coins
    Ratings:
    +10,909 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Sorry I do not know what you mean, and given you have included a picture from SimTools settings am not even sure your issue is specifically SMC3 related. Can you please start your own build thread, detail all hardware, progress and questions there, so there is some context to better understand what your issue is.
  14. John Snell

    John Snell Member

    Joined:
    May 31, 2021
    Messages:
    63
    Balance:
    190Coins
    Ratings:
    +59 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Is there a way to centre it in SMC3? Or do you mean do I start with the green feedback line in the centre of the display in SMC3 and with the pot at roughly the centre of it rotation (this is what I have been doing)?

    I came to those settings through too much tinkering around. I have just had another go, firstly on my Wiper motor proof-of-concept. Below seems to give the best results for the different waveforms: SMC3 settings on Wiper.JPG

    Now compare that to the BLDC running the same settings (left half of image below). The result is much better with the BLDC :-(

    BUT as you've seen in my video, it is not usable like this due to the motor stuttering badly:
    SMC3 settings on BLDC.JPG

    I couldn't find any SMC3 adjustments/settings that really helped with this issue.
    Last edited: Sep 27, 2021
  15. Pierre Lalancette

    Pierre Lalancette Sir Lalancelot Gold Contributor

    Joined:
    Dec 11, 2016
    Messages:
    960
    Occupation:
    Tech Artist
    Location:
    Quebec, Canada
    Balance:
    7,785Coins
    Ratings:
    +896 / 6 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino, 6DOF
    Max limits = 0. Does that mean that SMC3 does not take it into account? If not, it mean that when ever it goes over that limit, it shut down the motor. Put 250 there.
  16. John Snell

    John Snell Member

    Joined:
    May 31, 2021
    Messages:
    63
    Balance:
    190Coins
    Ratings:
    +59 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Thank you your considering my issue and for your reply @Pierre Lalancette. Yes the motor switches off when it goes outside that limit. It immediately does that if I have the wiring on the pot reversed. I tried it with a setting of 10 and also 250 with pot reversed and it switched off no matter what Max Limits is set to.

    When pot wiring is not reversed (I believe) it stays within the limits and follows the target quite well, but as shown in the video I cannot use it like that.

    I had hoped that I could run my BLDC Driver in a similar way as an H-Bridge driver, by sending a PWM and a direction signal to it from the Arduino, but unfortunately it seems to be more difficult than that. I will now look at other options, such as that shown by pmvcda (aka FlyPT), who has used similar motors but in a different way. It's just going to take me a while to read and understand it enough.
    John
  17. Pierre Lalancette

    Pierre Lalancette Sir Lalancelot Gold Contributor

    Joined:
    Dec 11, 2016
    Messages:
    960
    Occupation:
    Tech Artist
    Location:
    Quebec, Canada
    Balance:
    7,785Coins
    Ratings:
    +896 / 6 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino, 6DOF
    It doesn't make sense that your use the value of 0 there (unless the value of 0 disable it).

    Here is Silentchill values. KP is at 400. I think it is for reducing the number of time it tries to adjust the motor so it does not shake that much. I use a Fpid of 4 to smooth things out too.

    upload_2019-1-21_18-26-39.png
  18. John Snell

    John Snell Member

    Joined:
    May 31, 2021
    Messages:
    63
    Balance:
    190Coins
    Ratings:
    +59 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Hi @Pierre Lalancette
    I have reproduced these values exactly, and also tries putting the FPID up to 10. Unfortunately there is no real difference in the way the motor acts. It is still VERY jerky.
    silentchill values.JPG
    I wonder if there are some smarts in more expensive motor drivers that would resolve this. The only problem is the time it takes for different ones to arrive, so I hope to get some better clarification before placing an order.
    Thanks a lot for your ideas
  19. hannibal

    hannibal Active Member

    Joined:
    Sep 29, 2018
    Messages:
    677
    Balance:
    4,490Coins
    Ratings:
    +297 / 4 / -0
    My Motion Simulator:
    6DOF
    i have this same problem. i set max clip and clip limit to highest value. i would reach about 60 percent of the wave form before i trip the limit switch. i wish i could have been able to get the max limit close to center, but setting it to 255 still isnt close enough.
    at end of day, i just make sure that mover has crop values.

    i just want to share, i am going over to servo motor because of quirky things like this!
    Last edited: Sep 30, 2021
  20. miaziol

    miaziol New Member

    Joined:
    Dec 20, 2020
    Messages:
    29
    Location:
    Poland
    Balance:
    - 77Coins
    Ratings:
    +13 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, Motion platform
    I have a problem with my configuration. :( 24v 350W motors pololu 1455 drivers. 3x 24V 600W power supplies. I set everything in smcutils and it looks ok. During the test the motors start to slow down. Increasing KP causes oscillations on the arms. Increasing RPM max results in either stopping the motors completely or oscillations again. Platform generally it is balanced When I run simtools and check the axes in outup test, e.g. I can lift the platform up, lower it and it will not come back up the engines are blocked only a complete reset of the drivers helps Any suggestions?
    96FA4E44-A528-4629-9359-B8DAD949FE4A.jpeg 3117F4E5-ED3B-4F37-98D6-6F69EBC77BB0.jpeg BADFCF5D-FD45-421A-9FD9-A3795BF33F05.jpeg 22BF53B8-BFAB-4A63-9F74-AB6D789AE031.jpeg