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. Klaus Schmidinger

    Klaus Schmidinger Member

    Joined:
    Oct 3, 2022
    Messages:
    53
    Balance:
    433Coins
    Ratings:
    +17 / 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
  2. Klaus Schmidinger

    Klaus Schmidinger Member

    Joined:
    Oct 3, 2022
    Messages:
    53
    Balance:
    433Coins
    Ratings:
    +17 / 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
  3. Pierre Lalancette

    Pierre Lalancette Sir Lalancelot Gold Contributor

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

    Klaus Schmidinger Member

    Joined:
    Oct 3, 2022
    Messages:
    53
    Balance:
    433Coins
    Ratings:
    +17 / 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.
  5. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,741
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    Tasmania, Australia
    Balance:
    152,229Coins
    Ratings:
    +11,066 / 56 / -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?
  6. Klaus Schmidinger

    Klaus Schmidinger Member

    Joined:
    Oct 3, 2022
    Messages:
    53
    Balance:
    433Coins
    Ratings:
    +17 / 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
  7. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,741
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    Tasmania, Australia
    Balance:
    152,229Coins
    Ratings:
    +11,066 / 56 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
  8. Klaus Schmidinger

    Klaus Schmidinger Member

    Joined:
    Oct 3, 2022
    Messages:
    53
    Balance:
    433Coins
    Ratings:
    +17 / 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).
  9. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,741
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    Tasmania, Australia
    Balance:
    152,229Coins
    Ratings:
    +11,066 / 56 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Yes use the SMC3 from the first post.
  10. Rav3n87

    Rav3n87 Active Member

    Joined:
    Sep 9, 2020
    Messages:
    131
    Balance:
    723Coins
    Ratings:
    +45 / 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:

  11. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,741
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    Tasmania, Australia
    Balance:
    152,229Coins
    Ratings:
    +11,066 / 56 / -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?
  12. Rav3n87

    Rav3n87 Active Member

    Joined:
    Sep 9, 2020
    Messages:
    131
    Balance:
    723Coins
    Ratings:
    +45 / 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
  13. 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:

  14. Rav3n87

    Rav3n87 Active Member

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

    Are you using mode 2 or don't think mode will work?
  15. 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.
  16. Pierre Lalancette

    Pierre Lalancette Sir Lalancelot Gold Contributor

    Joined:
    Dec 11, 2016
    Messages:
    1,006
    Occupation:
    Tech Artist
    Location:
    Quebec, Canada
    Balance:
    8,044Coins
    Ratings:
    +944 / 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.
  17. 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
  18. TyCrawford

    TyCrawford New Member

    Joined:
    Sep 24, 2015
    Messages:
    20
    Location:
    United States
    Balance:
    - 149Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF
    Updated schematic that shows how my BTS7960 driver circuits and pots are powered

    Attached Files:

  19. Pierre Lalancette

    Pierre Lalancette Sir Lalancelot Gold Contributor

    Joined:
    Dec 11, 2016
    Messages:
    1,006
    Occupation:
    Tech Artist
    Location:
    Quebec, Canada
    Balance:
    8,044Coins
    Ratings:
    +944 / 6 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino, 6DOF
    I think you are at the point of switching part to find defect.
    • Agree Agree x 1
  20. TyCrawford

    TyCrawford New Member

    Joined:
    Sep 24, 2015
    Messages:
    20
    Location:
    United States
    Balance:
    - 149Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF
    I guess I'll work on that today. I have already swapped out an Arduino and saw no change. I know the firmware is flashing and saving becuase that Arduino did not have SMC3 on it when I wired it up. I'm gonna work on a test rig for my BTS7960 units today with a small motor and power supply.

    I guess my confusion is just coming from the fact that no where else on the internet do I see anyone wiring these units up and driving the PWM and EN pins like is being done here. At such a point I can see it work with that wiring and driving code, even on a small scale, I'll put these suspicions to bed