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. Murray Bester

    Murray Bester New Member

    Joined:
    Sep 4, 2023
    Messages:
    14
    Balance:
    84Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    I am trying to run the SMC3Utils application but keep running into the same error.
    upload_2023-10-12_12-6-13.png
    As you can see in the bottom right my commport is set to 3 because that is where my arduino is plugged in.
    upload_2023-10-12_12-7-16.png
    I have changed the comm port settings in the SMC3Utils configuration file and saved it. I have successfully compiled and uploaded the SMC3.ino file onto my arduino but when I try open the SMC3Utils app it just never established a connection with my arduino. Has anyone experienced this before? What can I do to fix this issue?
    Just for reference I extracted the utils out of the zip folder (downloaded from the top of this thread) onto my local C disk. Not sure if there is a specific location that it needs to be in.
    Any help would be much appreciated, thanks!.
  2. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,094
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    148,246Coins
    Ratings:
    +10,892 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Can you please post a picture of Device Manager, verifying the port used by the Arduino.
  3. Murray Bester

    Murray Bester New Member

    Joined:
    Sep 4, 2023
    Messages:
    14
    Balance:
    84Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    upload_2023-10-12_12-32-22.png
  4. Murray Bester

    Murray Bester New Member

    Joined:
    Sep 4, 2023
    Messages:
    14
    Balance:
    84Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    After wiping and reinstalling all SMC3 software I have managed to get the utils application to connect to my arduino board after loading it with the standard SMC3.ino code. My issue now is that I have to modify the SMC3 code because I am only using 1 motor and the encoder I am using is a rotary step encoder. I have had to connect my encoder to the Arduino as follows:
    upload_2023-10-12_12-38-44.png
    I have connected the CLK and DT to digital pins 4 and 5, respectively, since pins 2 and 3 are used for the enable A and B for my motor. However obviously pins 4 and 5 are used for enable A and B for motor 2.
    I have written the following code that reads my encoder, scales it, and writes it to analog pin A0 (where the feedback pin should be according to SMC3.ino)

    int pinA = 4; // Connected to CLK on KY-040
    int pinB = 5; // Connected to DT on KY-040
    int encoderPosCount = 10;
    int pinALast;
    int aVal;
    int analogOutputPin = A0; // Use a PWM-capable pin, e.g., pin 3

    void setup() {
    pinMode(pinA, INPUT);
    pinMode(pinB, INPUT);
    pinMode(analogOutputPin, OUTPUT); // Set the PWM pin as an output
    /* Read Pin A
    Whatever state it's in will reflect the last position
    */
    pinALast = digitalRead(pinA);
    Serial.begin(9600);
    }

    void loop() {
    aVal = digitalRead(pinA);
    if (aVal != pinALast) { // Means the knob is rotating
    // if the knob is rotating, we need to determine direction
    // We do that by reading pin B.
    if (digitalRead(pinB) != aVal) { // Means pin A Changed first - We're Rotating Clockwise.
    encoderPosCount++;
    } else { // Otherwise B changed first, and we're moving CCW
    encoderPosCount--;
    }

    // Map encoder position to the analogWrite range (512-1023)
    int analogValue = map(encoderPosCount, 0, 20, 0, 1023);

    // Constrain the value to the valid range
    analogValue = constrain(analogValue, 0, 1023);

    // Write the analog value to the PWM pin (e.g., pin 3)
    analogWrite(analogOutputPin, map(analogValue, 512, 1023, 0, 255));

    Serial.print("Encoder Position: ");
    Serial.println(encoderPosCount);
    Serial.print("Analog Output Value: ");
    Serial.println(analogValue);
    }
    pinALast = aVal;
    }

    My question is how can I modify the SMC3.ino code to accommodate my encoder and only use motor 1 but still correctly activate the SMC3Utils application? I have tried just commenting out any code from the .ino file that is related to motor 2 and 3 but when trying to connect the utils application I get the following error.
    upload_2023-10-12_12-44-29.png
    This is obviously due to the fact that I have commented out any code for motor 2 and 3. I am wondering if this is possible to do using my encoder. Or do I need to have an absolute encoder that only outputs an analog signal on pin A0?
  5. Robert Hill

    Robert Hill New Member

    Joined:
    Feb 12, 2019
    Messages:
    2
    Balance:
    12Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor
    My Arduino rev 3 is working well to drive the Transecto motors with the 43A motor drivers. Ideally, I would like to run two motors with independent sine waves by modifying Windows SMC3 Utility to independently run them, with a phase factor offset between sine waves. Since it looks like the code is not available for public modification, have people found the C# SRS API easy to learn or am I better off with Python and a C# wrapper?
    I have experience with Python, but none with Unity or C#.
  6. Robert Hill

    Robert Hill New Member

    Joined:
    Feb 12, 2019
    Messages:
    2
    Balance:
    12Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor
    Ps. I found this and the comments from "David" to be helpful at clearing up confusion on the 43A. http://www.hessmer.org/blog/2013/12/28/ibt-2-h-bridge-with-arduino/
  7. Attyla.pl

    Attyla.pl Active Member

    Joined:
    Oct 1, 2023
    Messages:
    163
    Location:
    Polska
    Balance:
    660Coins
    Ratings:
    +46 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino
    I'm testing the motors before assembling the motion sim and I'm having trouble understanding the graph in SMC3, the blue line is the target but what does the light blue line mean and why in my case it doesn't go together with the blue like the pictures and videos of other users ?

    Attached Files:

  8. Murray Bester

    Murray Bester New Member

    Joined:
    Sep 4, 2023
    Messages:
    14
    Balance:
    84Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Not exactly sure what the light blue line is but if you want your feedback line to follow your target line more closely I'd recommend upping the PWM signal. For my sim I only get near perfect feedback when my PWM is above 200 under full load conditions. Alternatively since your rise time seems to be delayed a bit you can try playing around with the PID parameters. Increasing Kp might solve your rise time issue but could introduce overshoot (which you can dampen by increasing Ki, although take care when increasing Ki and use steps of 1).
  9. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,094
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    148,246Coins
    Ratings:
    +10,892 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Toggling the Display check on and off shows you what each does.
  10. Attyla.pl

    Attyla.pl Active Member

    Joined:
    Oct 1, 2023
    Messages:
    163
    Location:
    Polska
    Balance:
    660Coins
    Ratings:
    +46 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino
    Sorry everyone, I am completely blind only now I noticed Chart Colors on the first page of this thread.
    Ok, correct me if I write something wrong
    - the light blue line means target (sent) which is, as I understand it, what operating parameters the arduino sends to the ibt2 controller
    - the blue line target (recv) is what operating parameters are reached by the ibt2 controller
    With proper operation, the two lines should coincide, which means I need to find the reason for the difference.
    Do you have any hint where to look ?

    (My setup, two wchelchair motors
    My equipment is two wheelchair motors 24V 250W from GEBY , IBT2 motor controllers and arduino uno, so far I have broken 2 pieces of ibt2 I think that for this motor they are a bit too weak.)
  11. Attyla.pl

    Attyla.pl Active Member

    Joined:
    Oct 1, 2023
    Messages:
    163
    Location:
    Polska
    Balance:
    660Coins
    Ratings:
    +46 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino
    view of engine operation

    Attached Files:

  12. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,094
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    148,246Coins
    Ratings:
    +10,892 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Perhaps review your Max Limits: https://www.xsimulator.net/communit...driver-and-windows-utilities.4957/#post-48121

    Clip Input Used to create a band at either limit of the target range beyond which any values sent to the SMC3 are clipped. In addition to this clipping, if the motor feedback does move beyond this range (typically through inertia), the SMC3 will attempt to brake the motors hard by driving them in reverse until they are back out of this limit zone. The value can be anything from 0-255 (however can’t be less than the current limit setting). Reverse braking is applied in the band between the Clip Input and the Max Limit settings. Reverse braking can be disabled - refer to PWMrev.

    Max Limits Used to create a band at either limit of the feedback range beyond which if the motors move (typically through inertia) the SMC3 will automatically shutdown the drivers and keep them disabled until reset. This is essentially a safety mechanism if something goes wrong. The value can be between 0-255 (however can’t be greater than the current clip setting).

    [​IMG]
  13. Attyla.pl

    Attyla.pl Active Member

    Joined:
    Oct 1, 2023
    Messages:
    163
    Location:
    Polska
    Balance:
    660Coins
    Ratings:
    +46 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino
    Introducing MAXlimits did not change the readings, I suspect the Arduino board maybe it is faulty? Tomorrow I will buy another copy and check. I have another question since the whole thing seems to be working correctly maybe don't bother with the Target(sent) reading and just keep building 2DOF :)

    Attached Files:

  14. Carl

    Carl New Member Gold Contributor

    Joined:
    Oct 29, 2023
    Messages:
    23
    Location:
    Paris 75018
    Balance:
    79Coins
    Ratings:
    +12 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Hello everyone, first of all I would like to thank the creator(s) for this tutorial which I find brilliant :)
    I followed the information to the letter for mode2 with the arduino uno R3 board and the two 43A IBT-2 controllers and I found myself facing a problem with motor 2 because it does not want to work.
    In SMC3 motor 1 has no problems and when I start motor 2 on ON, it runs for 1 second and then switches to OFF.
    I tested the IBT-2 controllers, the motors and the wiring, everything is ok but I always arrive at the same point, motor 1 ON and motor 2 off. have you ever faced this problem?
    Last edited by a moderator: Oct 29, 2023
  15. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,094
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    148,246Coins
    Ratings:
    +10,892 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Just checking, are you using a genuine Uno or clone?

    I am presuming the code was set to Mode 2, but just want to be sure: https://www.xsimulator.net/community/threads/problems-with-my-simulator.15382/#post-207320
  16. Attyla.pl

    Attyla.pl Active Member

    Joined:
    Oct 1, 2023
    Messages:
    163
    Location:
    Polska
    Balance:
    660Coins
    Ratings:
    +46 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino
    Turn on SMC3 Utils switch to motor 2 turn on manual mode and gently move the slider on the right side, show a screenshot of what the graph looks like.
    • Agree Agree x 1
  17. Carl

    Carl New Member Gold Contributor

    Joined:
    Oct 29, 2023
    Messages:
    23
    Location:
    Paris 75018
    Balance:
    79Coins
    Ratings:
    +12 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Last edited by a moderator: Oct 30, 2023
  18. deeph46

    deeph46 Member

    Joined:
    Mar 17, 2023
    Messages:
    109
    Balance:
    612Coins
    Ratings:
    +15 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF
    I have discovered motors became hot to touch after run Dirt Rally 2.0 for about 15 minutes with these settings. Yes, I mean hot to touch is I can't hold the motors for couple of seconds.
    I'm using IBT-2 (BTS7960) for all motors. As you all familiar with IBT-2 rated 43A 45v max. I'm running 40W 24V motors. The IBT-2 heatsink more hotter than the motors.
    What causing these motors became hot? Do I max out the motors power?
    I haven't yet measure the max torque of the actuator though.

    Attached Files:

  19. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,094
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    148,246Coins
    Ratings:
    +10,892 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Motors and controllers getting hot tends to be about how suitable they are for a given design, and how hard they are pushed to drive that design, which is reflected in settings.
  20. Carl

    Carl New Member Gold Contributor

    Joined:
    Oct 29, 2023
    Messages:
    23
    Location:
    Paris 75018
    Balance:
    79Coins
    Ratings:
    +12 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    • Agree Agree x 1
    Last edited: Nov 4, 2023