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

SMC3 Arduino 3DOF Motor Driver version 2.10 with soft start/stop and support for DOFReality H6 and P

Discussion in 'SimTools compatible interfaces' started by Klaus Schmidinger, Jan 27, 2023.

  1. Klaus Schmidinger

    Klaus Schmidinger Member

    Joined:
    Oct 3, 2022
    Messages:
    49
    Balance:
    370Coins
    Ratings:
    +16 / 0 / -0
    My Motion Simulator:
    AC motor, Motion platform, 6DOF
    In https://www.xsimulator.net/communit...-3dof-motor-driver-and-windows-utilities.4957
    @RufusDufus published the SMC3.ino sketch for the Arduino Uno R3. The DOFReality P6 control boxes contain Arduino Uno R3 boards and my guess is that they derived their firmware from the original SMC3.ino.

    In order to have a controlled shutdown (see http://www.tvdr.de/flightsim/poweroff.htm) I wanted to replace the original firmware with an open source version. To do so I first took the original SMC3.ino and widely refurbished the code to make it more readable and easier to extend. Then I implemented the code necessary to make it compatible with the DOFReality Tool, so that I could always go back to the original firmware. Finally, I added the soft start/stop feature. I tested it on an actual P6 platform, using the SMC3Utils-v1.01.exe program, FlyPT Mover and Sim Racing Studio (SRS).

    Only tested MODE1. MODE2 compiles, but is yet untested.

    If compiled "as is", this version should behave much like the original SMC3.ino. Only if the DOFR_BOX macro is defined will it include special functionality for DOFReality hardware.

    If you have an existing system on which you want to try this version, you may want to save your setup parameters before loading the new version, because the layout of the EEPROM content has changed.

    I would appreciate if some of you could test this version and/or look through the source to see if I broke anything. If you want to see the intermediate steps I took while refurbishing the code, you can find them at http://git.tvdr.de/?p=smc3.git.

    The latest version of my modified SMC3.ino is available here.

    See also http://www.tvdr.de/flightsim/firmware.htm on how to use this program with a DOFReality platform.

    Attached Files:

  2. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,046
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    147,974Coins
    Ratings:
    +10,884 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    • Like Like x 1
  3. Kaje

    Kaje New Member

    Joined:
    Mar 17, 2023
    Messages:
    2
    Balance:
    - 78Coins
    Ratings:
    +1 / 0 / -0
    I have been playing around with this, as love the soft start/stop options. My rig is a 3DOF siting on 4 rotating motors.
    The current code, when it goes to idle is crashes down hard, it doesn't seem to move slow, like it does during the start, no matter what setting I change, it doesn't change the speed of the "crash"/return to idle. but I figured out something that does work for me. I have no idea what I am doing, so I will just list the items I changed. maybe if I ever figure out what I am doing I will release a version.
    Line 1047
    case ToIdle:
    return AdaptedTarget(m.feedback, m.idle);
    change to
    case ToIdle:
    return AdaptedTarget(NEUTRAL_POS, m.idle);

    Its a not buttery smooth as it lowers my chair down. but its not bad. I like an adaption time of 4000.

    the other problem I had was in idle position the motors worked hard to maintain idle. I think it might be some backlash between the motors and the POTS, and they couldn't return to where it thought it should.
    To get around this I disabled the motors when it was in idle state, then enable them when in any other state. I do need to make a better work around, because this would enable the motors if they ever moved too far past the clip point, and the system would fight itself, but thought I would share anyway.
    Line 1316
    if (State == Idle)
    {
    PowerScale = 9;
    DisableMotor(Motor1);
    DisableMotor(Motor2);
    DisableMotor(Motor3);
    }
    else
    {
    PowerScale = 7;
    Motor1.disabled = false;
    Motor2.disabled = false;
    Motor3.disabled = false;
    }

    now I just need to figure out how to not blow up driver boards and I will be doing great!
    • Informative Informative x 1
  4. Ronan Design

    Ronan Design Roman Design - Custom MSFS Scenery

    Joined:
    Jun 4, 2021
    Messages:
    184
    Occupation:
    Web Designer, MSFS Scenery Designer
    Location:
    Toronto, Canada
    Balance:
    1,257Coins
    Ratings:
    +66 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Did anyone test it with MODE 2?
  5. Ronan Design

    Ronan Design Roman Design - Custom MSFS Scenery

    Joined:
    Jun 4, 2021
    Messages:
    184
    Occupation:
    Web Designer, MSFS Scenery Designer
    Location:
    Toronto, Canada
    Balance:
    1,257Coins
    Ratings:
    +66 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    It the default Motor3 glitch fixed in this modded version? Can I use 2 Arduinos for 6 motors instead of 3 (to avoid using Motor3 that apparently had some issues)?
  6. Attyla.pl

    Attyla.pl Active Member

    Joined:
    Oct 1, 2023
    Messages:
    154
    Location:
    Polska
    Balance:
    634Coins
    Ratings:
    +41 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino
    Do not use MOTOR3 with arduino has only two positions of frequencies 4 and 31 khz , it can cause problems with smooth operation of the motor.
  7. Ronan Design

    Ronan Design Roman Design - Custom MSFS Scenery

    Joined:
    Jun 4, 2021
    Messages:
    184
    Occupation:
    Web Designer, MSFS Scenery Designer
    Location:
    Toronto, Canada
    Balance:
    1,257Coins
    Ratings:
    +66 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Thanks, good to know. I'll just use 3 Arduinos.

    Something just occurred to me: if there's a runaway, SMC will stop the motors, but because 3 independent instances of SMC are not aware of each other, 4 other motors will still be working and powered. Which means the 6DOF platform will try to tear itself off, as 2 stopped motors will go out of the virtual plane that all motors are supposed to stay in. It would be a good solution to add some code that transmits a signal to a pin and stops motors when receiving a signal on a pin. That way all boards could be connected and an emergency stop on one will immediately lead to an emergency stop on all. I'm not sure I'm proficient enough in coding to add that without breaking something else though...
  8. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,046
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    147,974Coins
    Ratings:
    +10,884 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    The FAQs may be of use: https://www.xsimulator.net/community/faq/emergency-stop-switch-wiring.56/