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

    Doomak New Member

    Joined:
    Aug 28, 2025
    Messages:
    2
    Balance:
    22Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF
    if I press stop in SimHUB and press play again, I make it seem like I'm restarting (without disconnecting the USB), then the engine is working fine. And sometimes the engine freezes out of the central position, the green line is not in the center, if I turn the potentiometer, the lever moves, but the center is not in the zero position... it's not related to electronics, it's something in the firmware or settings, I guess..
  2. Joe Cortexian

    Joe Cortexian Active Member Gold Contributor

    Joined:
    Sep 8, 2021
    Messages:
    228
    Balance:
    1,363Coins
    Ratings:
    +56 / 1 / -0
    My Motion Simulator:
    3DOF
    Generally the Arduino resets when you reconnect the serial port. You might verify by pressing the Arduino reset button to see if that clears the issue.

    Can you reproduce using SMCUtils? There is a check in the codes which trips if it gets a single unexpected encoder reading. This will turn the motor off and you can see that in the SMCUtils screen. I had that problem with a generic Arduino. Noise on the sensor input could also cause this.

    Another possibility is that the ibt-2 or PSU has shut off due to momentary overload or glitch. I have this problem occasionally but it clears when I cut 24v power to the drivers. I have my estop turn off the 24v power so it’s a minor inconvenience. It happens based on how hard I push the limits of the drives. In general reproducing with just SMCUtils makes it easier to debug. I had a similar issue that I could reproduce using the “Motion” pattern even when the drive was disconnected from the rig.
  3. plomo29

    plomo29 New Member

    Joined:
    Jun 18, 2025
    Messages:
    1
    Balance:
    - 14Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, Arduino, Joyrider, SimforceGT, Motion platform, 4DOF, 6DOF
    Hello this works in Arduino Mega?
    Last edited by a moderator: Sep 12, 2025
  4. Joe Cortexian

    Joe Cortexian Active Member Gold Contributor

    Joined:
    Sep 8, 2021
    Messages:
    228
    Balance:
    1,363Coins
    Ratings:
    +56 / 1 / -0
    My Motion Simulator:
    3DOF
    If it builds it should run. If it doesn’t build then you will have to fix it.
  5. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,816
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    Tasmania, Australia
    Balance:
    152,700Coins
    Ratings:
    +11,091 / 56 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    SMC3 was written for the Uno.
  6. Opast

    Opast Member

    Joined:
    Jun 16, 2025
    Messages:
    37
    Location:
    Chicago, USA
    Balance:
    167Coins
    Ratings:
    +7 / 0 / -0
    My Motion Simulator:
    3DOF, Arduino
    Attached easy and simple guide for smc3 PID calibration. Only correction to the guide should be the following:


    • Step 1: Tune Kp (Proportional) FIRST with Ki = 0, Kd = 0

    • Step 2: Tune Kd (Derivative) SECOND with final Kp and Ki = 0

    • Step 3: Tune Ki (Integral) THIRD with final Kp and Kd values

    Attached Files:

    • Like Like x 2
    • Winner Winner x 1
    Last edited: Oct 31, 2025
  7. OrtiMai

    OrtiMai New Member

    Joined:
    Jun 29, 2025
    Messages:
    17
    Balance:
    62Coins
    Ratings:
    +3 / 0 / -0
    My Motion Simulator:
    6DOF
    Does your tutorial refer to clean SMC3 or to the one with @Sebastian2 's I-component fix?
  8. Opast

    Opast Member

    Joined:
    Jun 16, 2025
    Messages:
    37
    Location:
    Chicago, USA
    Balance:
    167Coins
    Ratings:
    +7 / 0 / -0
    My Motion Simulator:
    3DOF, Arduino
    Only use SMC3 to set up PID, and it doesn’t matter which SMC3 variant.
  9. OrtiMai

    OrtiMai New Member

    Joined:
    Jun 29, 2025
    Messages:
    17
    Balance:
    62Coins
    Ratings:
    +3 / 0 / -0
    My Motion Simulator:
    6DOF
    Well, with Sebastians fix, the I-component now gets the deviation of the error as input and not the deviation of position. Thus, the principle in your tutorial stays the same and your tutorial is very helpful. But one have to be carful with the values.
  10. Sebastian2

    Sebastian2 Active Member

    Joined:
    Dec 17, 2023
    Messages:
    108
    Balance:
    460Coins
    Ratings:
    +61 / 1 / -0
    @Opast

    I respectfully disagree.
    The vanilla SMC3 code has a buggy PID implementation. The I and D component are basically broken.

    You can test that by turning off your motors and demanding a motor position in SMC3utils thats different from where they are currently at. With a Ki-value > 0 this should result in a PWM-Output thats growing over time. But that doesn't happen.

    A similar test can be done for the D component by turning your motors off and turning on the sine signal generator in SMC3utils. For Kd-values > 0, the PWM-Output should be max every time the sine singal goes through 0 and PWM-Output shoud be 0 everytime the sine signal reaches it's max and min value. Again, that doesn't happen.

    Without a working I and D component, it doesn't make sense to try a calibration for those components.

    My SMC3-version is the only one I know of that hase a working I and D component. I don't recommend flogging to the version I uploaded in this thread a few pages ago, though. This version wasn't perfect by all means. For example: Back then I wasn't aware of a bug of vanilla SMC3 where it was possible for the I component to move the rig way past Clip Input and Max Limits. This bug never bothered anyone, as the I component was broken anyways. But I came across it after I tested my version with fixed I component.
    I fixed those bugs and now spend many months without issues with my latest version of SMC3. I attached my latest version to this posting. But be warned: I only tested it on my rig. Like vanilla SMC3, the executed code is different depending if you choose Mode 1 or Mode 2. For my rig I added a Sub-Mode for Mode 2, that is using a Cytron MD30C motor driver. I was only able to test that. I also tried to bring regular Mode 2 as well as Mode 1 to the same standard, but I have no way of testing.

    Edit: User @OrtiMai seems to by giving this SMC3 version a try with Cytron MD13S drivers that require Mode 1. He instantly found multiple typos that prevented the code to compile and upload to the arduino. So I guess it's not plug and play for Mode 1 users right now. I'll try to work out the kinks with him and post an update when its done.

    This version also has SoftOff and SoftStart and a working "LiftOffset" to help rigs with a heave axis get smooth motion during slow movements.

    Attached Files:

    Last edited: Nov 8, 2025 at 19:15
  11. Opast

    Opast Member

    Joined:
    Jun 16, 2025
    Messages:
    37
    Location:
    Chicago, USA
    Balance:
    167Coins
    Ratings:
    +7 / 0 / -0
    My Motion Simulator:
    3DOF, Arduino
    I only posted a general guide how to setup PID and numbers just for references from ChatGPT. I'd love to try your firmware and should I use your firmware from page 1 modified by you from 1.0 or Cytron? I'm using IBT_2
  12. Sebastian2

    Sebastian2 Active Member

    Joined:
    Dec 17, 2023
    Messages:
    108
    Balance:
    460Coins
    Ratings:
    +61 / 1 / -0
    I'm not sure what you are asking me about.

    If you want to try my SMC3 version, you should use the latest, so the one I posted today on page 137 of this thread.

    Or are you asking me what Mode you should use in my SMC3 version? The same as in vanilla SMC3. What mode did you previously use on your rig? The vanilla SMC3 documentation says "typical H-Bridge" should use Mode 1 and "Chinese IBT-2 H-Bridge from e-bay or equivalent" should use Mode 2.

    If you happen to use a Cytron MD30C motor driver like I do, you should choose Mode 2 and set cytron = true.

    However, all this is documented in the code. Have a look at it. I'm glad to help with any remaining questions.

    @noorbeast
    Could you please update the link in

    https://www.xsimulator.net/community/faq/arduino-code-for-use-with-various-hardware-and-simtools.31/

    to the version i posted above? Thanks.
    • Useful Useful x 1
  13. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,816
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    Tasmania, Australia
    Balance:
    152,700Coins
    Ratings:
    +11,091 / 56 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
  14. Andrey Av

    Andrey Av New Member

    Joined:
    Oct 10, 2025
    Messages:
    7
    Balance:
    32Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF
    Hello. I'm building 2DOF platform for MSFS mostly but also going to play LFS.
    It is Arduino Uno with SMC3 mode2, 2x IBT-2 drivers, 2x 24V 250w 75rpm 32Nm motors, 2x 24V 21A PSUs.
    Now I'm on the table test stage. When I run SMC3Tools sine I see that the motor reaction is pretty jumping:
    psu24v500w.png
    The yellow pwm line goes up and down and the crank moves by steps when stable rotation of the crank is expected.
    Another problem is that in Motion simulation mode when crank changes its rotation direction the motor consumes huge amount of power and my PSU flashes its led and stops its fan for a moment. I tried to limit pwm change speed in the SCM3 firmware, it works in general but conflicts with PID regulator and doesn't help much.
    Tried to limit voltage (21V is minimum for my PSUs), decrease the pwm frequency to 15kHz - the same.
    Also tried powerful 24V LiFePO4 battery instead of PSUs but sine movement is still jumping.
    Setting Kp to 100 and Kd to 20 helps a bit but PSUs are still experiencing problems on fast rotation direction changes.
  15. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,816
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    Tasmania, Australia
    Balance:
    152,700Coins
    Ratings:
    +11,091 / 56 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Try setting Fpwm to 25.

    Then, as per the SMC3 initial setup steps, at what PWMmax value did the motor start to move?


    1. Disconnect the motor power supply
    2. Make sure Simtools is not running – we’re not ready for that yet!
    3. Wire up the Arduino (with SMC3 installed) to your H-Bridges and connect to your computer via USB
    4. Run the Windows SMC3 Utility software and make sure it communicates with the Arduino (There is no need to set baud rates, they are not configurable)
    5. Set the Kp, Ki, Kd, PWMmin, PWMmax, PWMrev to 0 for ALL motors (This will make sure the motors don’t move)
    6. Set Clip to 255 (you need to do this first) and Limit to 255 (This will give you plenty of margin if something goes wrong while setting up)
    7. Turn on the power to your motors – nothing should move at this stage!
    8. Set Kp to about 400
    9. Now slowly, increase PWMmax… at some point the motor should start to move. When it does check the “Green” feedback line is moving toward the “Blue” target position.
      • If it is then that motor and feedback is wired correctly - proceed to test other motors.
      • If it is moving away turn off motor power immediately (or quickly reduce PWMmax again). In this case you need to either reverse the wires to the motor being tested –OR– reverse the +5V and GND wires to your feedback pot for the motor being tested (do not do both). Restart the test from the beginning.
    10. Do the above for each motor
  16. Andrey Av

    Andrey Av New Member

    Joined:
    Oct 10, 2025
    Messages:
    7
    Balance:
    32Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF
    All Fpwms 15-25 kHz behave the same, below 15 kHz motor starts to produce noise.
    As for pwm - it is starting moving at about pwm 38.