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. Pat Regan

    Pat Regan DIY Fokker D7F Flight Simulator Gold Contributor

    Joined:
    Mar 12, 2021
    Messages:
    18
    Balance:
    195Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    SCN5, Motion platform, 4DOF
    EUREKA! I HAVE FOUND IT!!! :)

    I do believe this thread has the answers to just about every electronics question I have about the rig I'm presently building. Thanks to all for the obviously huge amount of effort that went into making this information available to guys like me. Muchly appreciated.

    VBR,

    Pat
  2. Klaus Schmidinger

    Klaus Schmidinger Member

    Joined:
    Oct 3, 2022
    Messages:
    49
    Balance:
    369Coins
    Ratings:
    +16 / 0 / -0
    My Motion Simulator:
    AC motor, Motion platform, 6DOF
    With my DOFReality P6 with SFU gears I have the following problem: sometimes, when the motor moves down and then up again, it makes a short "dip" at the point where it reverses direction. It's like it loses power for a moment and then has to catch up again. For testing I'm using the SMC3 utility, moving motor R3 in "Motion" mode. The attached image "smc3.png" shows the parameters:
    smc3.png
    The problem happens with all 6 motors, but most prominently with the #3 motors in both control boxes. And it only happens when I sit in the seat, so there is more load on the motors. With an empty seat it does not happen.

    Here's a video that shows this: http://www.tvdr.de/flightsim/power-01.mp4.
    The oscilloscope displays the voltage between the two motor wires. Note how in the beginning the arm moves smoothly and the voltage switches between +/-24V and does PWM. At about 17 seconds the first "dip" occurs, which also can be heard (the motor sounds differently for a moment and the whole platform makes a bang). At this point the voltage shows an odd behavior (play the video in slow motion to see it):
    dip-voltage.png
    It only reaches +8/-6 Volts, and this doesn't seem to be the proper PWM.
    I have superimposed the SMC3 diagrams of the "Motion" with (green) and without (red) me sitting in the seat:
    motion-diff.png
    At the points indicated by the red arrows you can see where the two curves drift apart. The green one shows the "dip" the motor makes.

    I have contacted support@dofreality.com about this, but so far they haven't been able to help me. So I'm hoping that somebody here knows what's causing this, and maybe how to fix it.
    Last edited: Jan 2, 2023
  3. Pierre Lalancette

    Pierre Lalancette Sir Lalancelot Gold Contributor

    Joined:
    Dec 11, 2016
    Messages:
    949
    Occupation:
    Tech Artist
    Location:
    Quebec, Canada
    Balance:
    7,719Coins
    Ratings:
    +892 / 6 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino, 6DOF
    Could it be your power supplies that can't satisfy the demand in current of all the motors changing direction. For me, it is the most likely problem. Possible solution, having a battery paralleled to the power supplies that would give the missing Amps for the motors.
  4. Klaus Schmidinger

    Klaus Schmidinger Member

    Joined:
    Oct 3, 2022
    Messages:
    49
    Balance:
    369Coins
    Ratings:
    +16 / 0 / -0
    My Motion Simulator:
    AC motor, Motion platform, 6DOF
    Looks like you're right. Here's the voltage measured at the connectors of the power supply at the moment of the dip:
    overload.jpg
    There are three power supplies in each DOFReality P6 control box, one for each motor:
    https://www.mouser.de/ProductDetail/MEAN-WELL/LRS-350-24?qs=ah3jBNVE1PT%2BkwLcackrGA==
    Putting batteries in parallel to all six power supplies is obviously not an option, so I guess I need to find power supplies that provide more power (at least 400W) with the same form factor (215mm x 115mm x 30mm).
    • Agree Agree x 1
  5. Klaus Schmidinger

    Klaus Schmidinger Member

    Joined:
    Oct 3, 2022
    Messages:
    49
    Balance:
    369Coins
    Ratings:
    +16 / 0 / -0
    My Motion Simulator:
    AC motor, Motion platform, 6DOF
    The problem was not a lack of power, but rather too much power - in the wrong direction!
    When I read the data sheet of the MD13S motor controller that is used in the DOFReality control boxes, I stumbled upon the "Regenerative Braking" feature. This means that, if the motor is driven by external force, it works as a generator and delivers power back to the power supply. To verify this I inserted a Schottky diode (30A 50V) into the plus line of the power supply and guess what - the problem was gone! Attached the oscilloscope to the diode and it showed
    schottky-diode.png
    At the moment when the motor is at its lower turning point, there are counter voltages of up to 30V at the diode. Apparently the power supply doesn't like this and turns off for a moment. If I bypass the diode, the problem immediately returns. So the bottom line is: I don't need a stronger power supply, just a Schottky diode to prevent counter voltages from entering it.

    You can find a complete description of the fix at http://www.tvdr.de/flightsim/power.htm.
    Last edited: Jan 2, 2023
  6. Pierre Lalancette

    Pierre Lalancette Sir Lalancelot Gold Contributor

    Joined:
    Dec 11, 2016
    Messages:
    949
    Occupation:
    Tech Artist
    Location:
    Quebec, Canada
    Balance:
    7,719Coins
    Ratings:
    +892 / 6 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino, 6DOF
    I did use a diode for that on my rig.
  7. Klaus Schmidinger

    Klaus Schmidinger Member

    Joined:
    Oct 3, 2022
    Messages:
    49
    Balance:
    369Coins
    Ratings:
    +16 / 0 / -0
    My Motion Simulator:
    AC motor, Motion platform, 6DOF
    I was wondering what Arduino software you folks are using for your motion platforms. Do you all use the original, unmodified source from here (SMC3 v1.0.zip), or derivatives thereof, or completely different sources?
    I'm asking because the firmware that DOFReality provides for their P6 platform (which I assume is based on the SMC3 source) has some shortcomings which they apparently are not going to change, and they don't give users access to their source code so they could help themselves. Therefore I'm considering trying to give it a shot myself, but first want to make sure I start with the right version. I'll also need to find a way to upload a modified firmware to the Arduinos in the P6 control boxes, so if anybody has any information on that I'd also be grateful.
  8. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,029
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    147,872Coins
    Ratings:
    +10,878 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    I have no idea what firmware DOFReality provides for their P6 platform, but SMC3 or a variant suitably configured for your control boards would be a good choice. What control boards are DOFReality using with the Arduino(s), as that will make clear what SMC3 code or configuration is required?
  9. Klaus Schmidinger

    Klaus Schmidinger Member

    Joined:
    Oct 3, 2022
    Messages:
    49
    Balance:
    369Coins
    Ratings:
    +16 / 0 / -0
    My Motion Simulator:
    AC motor, Motion platform, 6DOF
    They use the MD13S boards, one for each motor.
    power-02.jpg
    The Arduino board is
    IMG_8484.JPG
  10. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,029
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    147,872Coins
    Ratings:
    +10,878 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
  11. Klaus Schmidinger

    Klaus Schmidinger Member

    Joined:
    Oct 3, 2022
    Messages:
    49
    Balance:
    369Coins
    Ratings:
    +16 / 0 / -0
    My Motion Simulator:
    AC motor, Motion platform, 6DOF
    @noorbeast Thanks for the info.
    What I really wanted to know is whether everybody uses the SMC3.ino from "SMC3 v1.0.zip" (in the #1 post of this thread) "as is", or if there are newer/modified/other versions. I just want to avoid starting with an outdated source (SMC3.ino is dated 2017-05-21).
  12. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,029
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    147,872Coins
    Ratings:
    +10,878 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Yes use the SMC3 from the first post.
  13. Rav3n87

    Rav3n87 Active Member

    Joined:
    Sep 9, 2020
    Messages:
    131
    Balance:
    723Coins
    Ratings:
    +44 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    Hi all,

    I only have basic understanding of arduino code and I'm hoping someone could answer my question regarding the smc3 code in relation to a problem I'm having around the center area on my motors

    I'm using the cytron mdc30s r2 motor drivers and 200w 25:1 motion dynamics motors

    The issue I'm having is best described as a soft centre area, meaning the motors won't hold properly whilst powered on and the sim if nudged will start to oscillate as it bounces from side to side

    Is there a way in the code to up the power around the center area?

    I've attached a photo of the smc3 graph whilst sitting idle showing the bouncing and a video of the issue also, please note no matter what settings I have tried the problem persists on all motors

    https://youtube.com/shorts/koNaWRITtfk?feature=share

    Thanks everyone

    Attached Files:

  14. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,029
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    147,872Coins
    Ratings:
    +10,878 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    In the video is SMC3 or SimTools running, can you move it like that if they are?

    In terms of oscillations have you tried setting DeadZone at 1?
  15. Rav3n87

    Rav3n87 Active Member

    Joined:
    Sep 9, 2020
    Messages:
    131
    Balance:
    723Coins
    Ratings:
    +44 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    That's Just with smc3 utils open, acts the same with sim tools open or none open, I have tried a little deadzone to see if it helps but no luck
  16. TyCrawford

    TyCrawford New Member

    Joined:
    Sep 24, 2015
    Messages:
    20
    Location:
    United States
    Balance:
    - 149Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF
    Gosh I hope I'm not committing a forum sin here, but I'm working on my own rig, starting with 2DOF (one day will be 3DOF, but starting here), BTS7960s, Arduino Uno. SMC3Tool allows me to move motor 1 in one direction, not the other (by moving my manual slider up). Moving the slider beneath the feedback level does nothing and I am able to manually move the motor, so its position is not being held.

    So I hooked up my oscilloscope to see if my cheap BTS7960 boards were the issue. What I've found is that the PWMPin1(Arduino D9) is outputting (to my BTS7960 L_PWM pin) a PWM signal that gets flipped once the motor needs driven in the reverse direction. The ENA1 Pin (Arduino D2) is going from 5V to Ground when it crosses that threshold. The ENA1 Pin goes to the R_PWM pin on the BTS7960.

    All of my wiring appears to be exactly how it is supposed to be as per the initial post on this thread. My 2nd axis has some other issues as well, where the motor output in SMC3Tools will automatically turn off when increasing my PWMMax from 0 to 50 (at 40 the motor stays on), while doing the basic setup from initial post as well. This could be related which is why I'm including it but presuming that it is not.

    My real concern is that everything I've read on the internet about the BTS7960 is that to go in one direction, a PWM duty cycle is applied to the R_PWM pin, and to go in the other direction, R_PWM is ceased and a duty cycle is instead sent to L_PWM, and so I dont understand how the code for Mode2 is geared towards facilitating that.

    Attaching my wiring diagram just in case anyone is curious.

    Thanks in advance.

    Attached Files:

  17. Rav3n87

    Rav3n87 Active Member

    Joined:
    Sep 9, 2020
    Messages:
    131
    Balance:
    723Coins
    Ratings:
    +44 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    @TyCrawford

    Are you using mode 2 or don't think mode will work?
  18. TyCrawford

    TyCrawford New Member

    Joined:
    Sep 24, 2015
    Messages:
    20
    Location:
    United States
    Balance:
    - 149Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF
    Yeah I am in Mode2, as in I've got my code commented to define Mode2 on line 9, and the results listed in my original comment were with that set. I would expect Mode1 to outright fail altogether given both how the code is written and how differently it would be wired compared to Mode1 usage.
  19. Pierre Lalancette

    Pierre Lalancette Sir Lalancelot Gold Contributor

    Joined:
    Dec 11, 2016
    Messages:
    949
    Occupation:
    Tech Artist
    Location:
    Quebec, Canada
    Balance:
    7,719Coins
    Ratings:
    +892 / 6 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino, 6DOF
    Looking at your diagram, it seems you are putting the 24v into your potentiometer and not the 5v from the arduino.
  20. TyCrawford

    TyCrawford New Member

    Joined:
    Sep 24, 2015
    Messages:
    20
    Location:
    United States
    Balance:
    - 149Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF
    The schematic is flawed in this regard, pots and bts7960 circuits are poered via Arduino 5v and ground. Its subtle but I grayed out the area where my Bts7960 power wires cross over the motor supply wires, just never drew where they actually got power from