1. 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!
  2. 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
  3. 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. Renan Piva Pinheiro

    Renan Piva Pinheiro New Member

    Joined:
    Nov 15, 2021
    Messages:
    1
    Balance:
    - 1Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF
    Hi,
    I would like to thank you for all the knowledge shared.

    I'm trying to make my first 2DOF.
    I am using bts7960 43a h-bridge and Bosch F006.B20.360 engines.

    This motor already has (built-in) the hall position sensor. "magnetic sensor in a 5V circuit that detects the variation of the magnetic flux according to the rotor displacement. The resolution of this sensor is 256 pulses per rotation or precision of 1.4º"

    After assembling and inserting the program into the arduino, the motor remains in rotation but does not stop, as the "feedback" (green line) does not move to the "target" (blue line).
    It seems that the arduino is not able to read the position.

    I noticed that the tutorials deal with position sensors with potentiometers.
    I know that potentiometers provide voltage output signal. It seems to me that the hall sensor provides the signal in PWM.

    Is it possible to use the same program, or would I have to make changes to the arduino code?

    Has anyone had this problem?
    I would be very grateful if someone could help me.

    (Sorry for my English.)
  2. Krzysztof Dej

    Krzysztof Dej Active Member

    Joined:
    Jun 3, 2020
    Messages:
    252
    Location:
    Poland
    Balance:
    776Coins
    Ratings:
    +59 / 0 / -0
    My Motion Simulator:
    2DOF
    I checked the circuit. Because that's what I can do. And I saw that when I check gnd to gnd there is a circuit. But when I check the voltage output there is a circuit but when I give a circuit to the gnd and voltage I get a reading of 400. So it's like something is connecting. Is it good or not the red wire and black wire from pic. All my photos and The description of my problem is a few posts above

    Attached Files:

  3. Krzysztof Dej

    Krzysztof Dej Active Member

    Joined:
    Jun 3, 2020
    Messages:
    252
    Location:
    Poland
    Balance:
    776Coins
    Ratings:
    +59 / 0 / -0
    My Motion Simulator:
    2DOF
    Ok I find what is the problem. I do not know what and how, but when I connect the tensioner to the metal frame of the seat. You can see something happening AND the motor shuts down. Now I am at the stage of waiting for a printed isolator
  4. yura999

    yura999 New Member

    Joined:
    Aug 6, 2017
    Messages:
    8
    Balance:
    223Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF
    udp simhub and simtools.JPG 94326 94326 94326 94326
    Hello friends. I can't figure out the udp ports sim hub and simtools in the LFS game. I try to get telemetry on the sale of applications, but nothing works neither simhab nor simtuls. In the Simhub app, I chose port 63392 in the running game and also redirected udp to port 4123. My computer uses one, I chose an IP address: 127.0.0.1 While playing simhub works correctly, but simtools sends data incorrectly. (playground twitches, shakes). What's my mistake? What am I doing wrong?
    Last edited by a moderator: Nov 10, 2022
  5. yura999

    yura999 New Member

    Joined:
    Aug 6, 2017
    Messages:
    8
    Balance:
    223Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF
    Friends, please tell me so what am I doing wrong? Or is everything working properly for everyone?! After all, maybe someone will have the same situation as me, but there will already be a solution to such a problem.
  6. motiondynamics

    motiondynamics Member Gold Contributor

    Joined:
    Apr 12, 2019
    Messages:
    102
    Balance:
    638Coins
    Ratings:
    +3 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, AC motor, SimAxe, Arduino, Motion platform, 6DOF
    Hi everyone, I'm a simulation enthusiast and a few months ago I bought the Simtools license.
    I have a big problem with my simulator (electric linear actuators with Arduino) and I ask your technical support to solve it, I'll explain what happens.

    I had downloaded the SMC3 V1.0 version, but I had a problem: as soon as I inserted the USB cable, the actuators went to the central position very quickly. Then I tried to use version 1.7a with "Soft Start", but even with this I am having problems, the movement starts slow but when it reaches the central position the actuators make 5 violent clicks (up and down).
    In Game Engine> Interface Settings, I have selected 10 ms in Output Rate.

    What I ask is: I want to use SMC3 V1.0 version. Is it possible to prevent the actuators from snapping in the center when I plug in the USB cable? That is to make the actuators move only when I start Simtools using the Game Engine functions "Startup & Resume" and "Shutdown & Centering"?

    Another question: in Game Engine I set 500000 BitsPerSec, in the Windows COM port I set 115200 BitsPerSec.
    What are the correct values that I need to set in the Windows COM port?

    Tell me if there is any remedy, I hope you give me some answers, I am confident of your kindness and your professionalism.
    A thousand thanks
    Last edited: Nov 14, 2022
  7. Pierre Lalancette

    Pierre Lalancette Sir Lalancelot Gold Contributor

    Joined:
    Dec 11, 2016
    Messages:
    896
    Occupation:
    3D teacher
    Location:
    Quebec, Canada
    Balance:
    7,212Coins
    Ratings:
    +824 / 6 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    I might be totally wrong as my rig has been down for a long time, but I think this is controlled by the program inside the Arduino. As soon as it has power, it brings the motor to the center. SMC3 is more like an interface to bring value to that program, but I don't think there is control for the start setup. But it's been so long, I could be wrong.
  8. motiondynamics

    motiondynamics Member Gold Contributor

    Joined:
    Apr 12, 2019
    Messages:
    102
    Balance:
    638Coins
    Ratings:
    +3 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, AC motor, SimAxe, Arduino, Motion platform, 6DOF
    Hi Pierre and thank you for speaking to my request for help.
    Yes, that's it: as soon as the computer restarts or when the USB cable is connected, power arrives to the Arduino, the motors move to the central position, this is managed precisely by the SMC3 code, in fact this behavior arises even without starting the Game Engine or Game Manager.
    The problem is that it goes to the center in a nervous way, with a violent click that makes the whole simulation station vibrate.
    It would be a very good thing if this start was not there, that it is only Simtools, at its start, that brings the engines to the center.
    Is there any way I can do this? I address this question especially to Rufus Dufus who wrote the code.
    Hope to get your help.
    Thank you very much indeed.
  9. Pierre Lalancette

    Pierre Lalancette Sir Lalancelot Gold Contributor

    Joined:
    Dec 11, 2016
    Messages:
    896
    Occupation:
    3D teacher
    Location:
    Quebec, Canada
    Balance:
    7,212Coins
    Ratings:
    +824 / 6 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
  10. motiondynamics

    motiondynamics Member Gold Contributor

    Joined:
    Apr 12, 2019
    Messages:
    102
    Balance:
    638Coins
    Ratings:
    +3 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, AC motor, SimAxe, Arduino, Motion platform, 6DOF
    Hi Pierre and thanks for the links and your advice.
    I looked at the links but couldn't find the solution I need.
    I have two big problems to solve, I explain step by step what I do (with version V1.0):

    1) I power up the motors, plug the USB cable into the computer, the cylinders move violently towards

    2) When the cylinders have reached the center, they go up and down by about 1cm, constantly, without ever stopping.

    Is there a way or a solution to solve these problems?
  11. Pierre Lalancette

    Pierre Lalancette Sir Lalancelot Gold Contributor

    Joined:
    Dec 11, 2016
    Messages:
    896
    Occupation:
    3D teacher
    Location:
    Quebec, Canada
    Balance:
    7,212Coins
    Ratings:
    +824 / 6 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    If you look here, the most important values for stabilization are: Fpid, Kp, Fpwm. They are the ones controlling the loop of retro action. Telling the actuator: No you are too far, come back. Too far in the opposite direction, come back. This is probably what is happening with your rig. You could try to reduce PWMmax to see if it's not that your motor is moving too fast, making too big of an adjustment.
    6 DOF from scratch
    Pierre
  12. motiondynamics

    motiondynamics Member Gold Contributor

    Joined:
    Apr 12, 2019
    Messages:
    102
    Balance:
    638Coins
    Ratings:
    +3 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, AC motor, SimAxe, Arduino, Motion platform, 6DOF
    Thanks Pierre, ok for the oscillation problem I will try to change these values.
    On the other hand, for the problem of violent shooting when I insert the USB cable, how could I solve it?
  13. Pierre Lalancette

    Pierre Lalancette Sir Lalancelot Gold Contributor

    Joined:
    Dec 11, 2016
    Messages:
    896
    Occupation:
    3D teacher
    Location:
    Quebec, Canada
    Balance:
    7,212Coins
    Ratings:
    +824 / 6 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    No idea. My rig was always going to the center at full speed.
  14. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    18,635
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    133,282Coins
    Ratings:
    +10,263 / 48 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Have you tried the SMC3 Soft Start version with some dead zone allocated in the settings, if the actuators continue to move you also likely need to check/refine the rest of the SMC3 settings, and possibly the pot mount and cabling: https://www.xsimulator.net/community/threads/smc3-arduino-3dof-motor-driver-with-softstart.9479/
  15. motiondynamics

    motiondynamics Member Gold Contributor

    Joined:
    Apr 12, 2019
    Messages:
    102
    Balance:
    638Coins
    Ratings:
    +3 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, AC motor, SimAxe, Arduino, Motion platform, 6DOF
    Hi noorbeast, the values I entered through the use of SMC3utils are the ones I attached in the photo.
    They are correct?
    What values should I correct?

    NOTE: I know very well that the PID values strictly depend on the type of motor being used

    Attached Files:

  16. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    18,635
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    133,282Coins
    Ratings:
    +10,263 / 48 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    These are the SMC3 instructions for initial configuration:
    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
    And the explanation for each of the settings are here: https://www.xsimulator.net/communit...driver-and-windows-utilities.4957/#post-48121

    You are correct that settings are somewhat hardware dependent, but if you are following the instructions I would expect Kp to be higher, Max Limits would not be 0, and I would expect Fpwm to be 25.
  17. Pierre Lalancette

    Pierre Lalancette Sir Lalancelot Gold Contributor

    Joined:
    Dec 11, 2016
    Messages:
    896
    Occupation:
    3D teacher
    Location:
    Quebec, Canada
    Balance:
    7,212Coins
    Ratings:
    +824 / 6 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    Fpid was the value that has de most smoothing value on my rig. Mine was at 4.