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

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    15,952Coins
    Ratings:
    +1,016 / 10 / -1
    If you mean that pin 9 is either always on or always off then that is not correct - it should be PWM unless the motor feedback is exactly in the correct target position.

    I use the BTS7960 and the wiring in the first post. It's been a long time since I was in the details but I'm pretty sure I wanted it to run in drive/brake (or maybe it was drive/coast) mode hence the wiring config and the special code for MODE2. In whichever mode it was I was trying to achieve, only one H-Bridge PWM signal is driven with PWM output as noted by the wiring diagram.

    If you are happy to run the motor in drive/coast mode then you could use MODE1 and connect the PWM signal to both H-Bridge EN pins and connect the ENA and ENB to each of the H-Bridge PWM pins. Although if it's not working I would say something else is wrong as there are others using these h-bridges with SMC3.
    • Informative Informative x 1
  2. Gadget999

    Gadget999 Well-Known Member

    Joined:
    Dec 27, 2015
    Messages:
    1,936
    Location:
    London
    Balance:
    11,844Coins
    Ratings:
    +474 / 9 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, 6DOF

    thank you :)
  3. CaptBluescreen

    CaptBluescreen New Member

    Joined:
    Aug 31, 2017
    Messages:
    5
    Location:
    Germany
    Balance:
    131Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Hi at all,

    first of all: @RufusDufus awesome work!!!

    I got it to working with my Arduino Mega2560. I have tested around with my own code to understand the BTS7960. Then, I have modified the SMC3 v1.

    In the SetOutputsMotor1() from Mode2, I had to replaced

    OutputPort &= ~(1 << ENApin1); // Unset Motor2 In 1

    throw

    digitalWrite(ENApin1, LOW); for unset or digitalWrite(ENApin1, HIGH); for set

    and removed the PORTD = OutputPort;

    because the pin mapping PORTD will not work on an Arduino Mega, so I did it manually with digitalWrite();

    I did also a change in the MyPWMWrite() function. We use the MyPWMWrite in the SetOutputMotor1-3 to send the PWM signals to the motors, but I found in this function the if else statement:

    if (val == 0)
    digitalWrite(pin, LOW);
    else if (val == 255)
    digitalWrite(pin, HIGH);
    else
    {
    uint16_t regLoc16 = 0;
    uint16_t top;

    switch(pin)
    {
    case 9:
    sbi(TCCR1A, COM1A1);
    regLoc16 = OCR1A_MEM;
    top = ICR1; //Timer1_GetTop();
    break;
    case 10:
    sbi(TCCR1A, COM1B1);
    regLoc16 = OCR1B_MEM;
    top = ICR1; //Timer1_GetTop();
    break;
    }
    tmp=(tmp*top)/255;
    _SFR_MEM16(regLoc16) = tmp; //(tmp*top)/255;
    }

    I didn't really understand this one - I got only a on or of signal - if val==0 or if val==255. But I thought, that I get the val from the PID controller...
    I added a new state,

    else if (val > 0 && val < 255)
    analogWrite(pin, val);

    and after that, it works. With MODE2, EN_R&EN_L are always activated (which is needed for the BTS7960), on PWM i get the PWM signal and on ENApin1 i got on or off for the direction.

    I will test it this evening with our chair...
    • Like Like x 1
  4. Gadget999

    Gadget999 Well-Known Member

    Joined:
    Dec 27, 2015
    Messages:
    1,936
    Location:
    London
    Balance:
    11,844Coins
    Ratings:
    +474 / 9 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, 6DOF
    • Like Like x 1
  5. Michael Paleo

    Michael Paleo New Member

    Joined:
    Oct 17, 2017
    Messages:
    1
    Location:
    Uruguay
    Balance:
    96Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino
  6. Gadget999

    Gadget999 Well-Known Member

    Joined:
    Dec 27, 2015
    Messages:
    1,936
    Location:
    London
    Balance:
    11,844Coins
    Ratings:
    +474 / 9 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, 6DOF
    The ibt-4 works by powering itself from the 12v supply and 2 pins for direction pwm.

    I was unable to use it because i am running 24v.

    I tried it on a different project and it seems to work fine :)
    • Like Like x 1
    Last edited: Oct 23, 2017
  7. George Dobransky

    George Dobransky Active Member

    Joined:
    Sep 29, 2016
    Messages:
    222
    Location:
    Hungary
    Balance:
    - 13Coins
    Ratings:
    +130 / 4 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 6DOF
    Hi There,

    I have already built my 3dof, 2 x 12v motor system with smc3, with 12v mmShield.
    Now I'm planning to change to 3 x 24v motor system to simnulate heave also.
    Can anybody help me with a tutorial link about the motor controllers and the
    wiring of 24v motors to arduino?

    Thanx,
    George, Hungary
  8. Gadget999

    Gadget999 Well-Known Member

    Joined:
    Dec 27, 2015
    Messages:
    1,936
    Location:
    London
    Balance:
    11,844Coins
    Ratings:
    +474 / 9 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, 6DOF
    Hi George - how is your 3dof wired up ?
    which motor drivers did you use ?
  9. George Dobransky

    George Dobransky Active Member

    Joined:
    Sep 29, 2016
    Messages:
    222
    Location:
    Hungary
    Balance:
    - 13Coins
    Ratings:
    +130 / 4 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 6DOF
    Gadget999,

    It's a classic, mode1 wiring and setup, means I'm using MonsterMoto shield:

    [​IMG]

    This shield is only for 12V motors.
    The mode 1 wiring is also on the first page of this tutorial.


    Thanx for help,
    George
  10. George Dobransky

    George Dobransky Active Member

    Joined:
    Sep 29, 2016
    Messages:
    222
    Location:
    Hungary
    Balance:
    - 13Coins
    Ratings:
    +130 / 4 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 6DOF
    Hi Guys,

    If I wire the two Monster Moto output drivers together to drive a single motor using SMC3, as @Pit's wiring, like this:

    [​IMG]

    If I short c. B1-A2, will I get 24v 15A from A1-B2?

    Cheers,
    George
  11. Pit

    Pit - - - - - - - - - - - - - - - - Gold Contributor

    Joined:
    Oct 2, 2013
    Messages:
    3,012
    Location:
    Switzerland
    Balance:
    30,451Coins
    Ratings:
    +3,091 / 31 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    no, you will damage the MM....the MM doesn't support 24V.
    • Agree Agree x 1
  12. George Dobransky

    George Dobransky Active Member

    Joined:
    Sep 29, 2016
    Messages:
    222
    Location:
    Hungary
    Balance:
    - 13Coins
    Ratings:
    +130 / 4 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 6DOF
    Pit,

    So, that is not the same as you connect 2 same batteries in line resulting the volts added?

    George
  13. Pit

    Pit - - - - - - - - - - - - - - - - Gold Contributor

    Joined:
    Oct 2, 2013
    Messages:
    3,012
    Location:
    Switzerland
    Balance:
    30,451Coins
    Ratings:
    +3,091 / 31 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    no
  14. shresans

    shresans New Member

    Joined:
    Oct 18, 2017
    Messages:
    2
    Location:
    USA
    Balance:
    9Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    3DOF
    Hello @RufusDufus, I recently bought a commercially available 3DOF motion simulator. upload_2017-10-27_10-8-28.png

    I will be using it for research and was wondering if there was a way to control the RPM of the motors using the SMC3.io arduino code. I tried adjusting the value of Ki hoping that would reduce the RPM but it makes the motion jerky. My intent is to use the output testing in simtools to adjust the Roll, Pitch and Yaw and I would like to know if there is a way to adjust the speed of the motors. I won't be using the simulator with a game at all.

    Appreciate any help on this from the members. I have read through the entire thread and couldn't find any information for this particular adjustment.
  15. Edson Lourenço Bezerra

    Edson Lourenço Bezerra Edson Bezerra - Desenvolvedor Open Source

    Joined:
    May 14, 2014
    Messages:
    67
    Occupation:
    Analista de Sistema
    Location:
    Jundiaí
    Balance:
    147Coins
    Ratings:
    +24 / 2 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, Arduino, Motion platform, 4DOF
    I connected the HBridge driver to a single motor, but it is returning peaks in the power supply.
    Has anyone gone through the same thing?
    When using the SMC3 in sinusozo movement, it does not read the last 10% upwards
  16. terry wells

    terry wells Active Member

    Joined:
    Jan 19, 2014
    Messages:
    250
    Occupation:
    retired military
    Location:
    minnesota USA
    Balance:
    716Coins
    Ratings:
    +59 / 1 / -0
    My Motion Simulator:
    3DOF, Arduino
    Is there a wiring diagram on connecting the IBT-4 controller board to the arduino? I am currently using the IBT-2 and I think one is bad.

    Thanks
    Terry.
  17. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,147
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    148,577Coins
    Ratings:
    +10,902 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    I can't recall anyone having reported testing it yet.
  18. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,147
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    148,577Coins
    Ratings:
    +10,902 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
  19. Martin.Berger

    Martin.Berger Member

    Joined:
    May 6, 2014
    Messages:
    71
    Balance:
    214Coins
    Ratings:
    +3 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Hi,
    i wahr to use SMC3 on my 2dof Seatmover. Unfortunatly ScUtil says"connection error abort or ignor".
    com ports are set correct.
    Any ideas?
    Martin
  20. Juandi

    Juandi Member

    Joined:
    Nov 9, 2007
    Messages:
    34
    Occupation:
    Engineer
    Location:
    Mexico
    Balance:
    202Coins
    Ratings:
    +34 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, Arduino, JRK, Motion platform
    Hi everyone,

    After roasting a couple of chinesse MM boards I have tried these H-bridges from POLOLU:

    0J7119.600x480.jpg

    https://www.pololu.com/product/2994

    They are able to handle 25Amps in continuous mode and 60 amps peaks no heat sink needed, I have play them quite hard this weekend and they are still alive. I will post more details on my building thread, but if some one is looking for MM alternatives using SMC3, this ones worked for me.

    MM are cheap and work good, but the delivery time and the faulty rates made me consider some other options. Pololu customer support is great and they recomended me these boards.
    As far as I notice seems that no one have tried them before, so here is my little aportation.

    Juan
    • Useful Useful x 1