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

    dahfl New Member

    Joined:
    Feb 21, 2014
    Messages:
    29
    Occupation:
    Administrator
    Location:
    Mülheim Ruhr
    Balance:
    485Coins
    Ratings:
    +37 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino, 6DOF
    you're right. image is changed
    • Like Like x 1
  2. Pit

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

    Joined:
    Oct 2, 2013
    Messages:
    3,012
    Location:
    Switzerland
    Balance:
    30,438Coins
    Ratings:
    +3,089 / 31 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    Yesterday I got the IBT-2 bridges. As I expected theses bridges are the 43A ones and not the 7970B :( . Nevertheless I wired one of them to the Arduino including the two pots. Later I uploaded the SMC3 code to the Arduino (MODE2):

    Code:
    // Set to MODE1 for use with a typical H-Bride that requires PWM and 1 or 2 direction inputs
    // Set to MODE2 for a 43A "Chinese" IBT-2 H-Bridge from e-bay or equiv
    
    #define MODE2  
    
    // #define REVERSE_MOTOR1
    The potentiometers are working fine (SMC3 utility), but there is no output to the motors at all. Remark: I switched a jumper on the pins 3 and 4 and connected it by using a jumper wire to the Arduino. Only one bridge is connected.

    What did I do:

    Bridge to Arduino (Number of the pin):

    RPWM -> 2 (PMW)
    LPWM -> 9 (PMW)
    R_EN + L_EN -> 3 (PMW)
    VCC (5V, checked, all connecnted)
    GND (not all connected together, I used all three pins onto the Arduino)

    Attached Files:

    • Like Like x 1
  3. Pit

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

    Joined:
    Oct 2, 2013
    Messages:
    3,012
    Location:
    Switzerland
    Balance:
    30,438Coins
    Ratings:
    +3,089 / 31 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    • Like Like x 1
  4. Historiker

    Historiker Dramamine Adict Gold Contributor

    Joined:
    Dec 16, 2010
    Messages:
    2,160
    Occupation:
    Retired
    Location:
    Michigan USA
    Balance:
    9,195Coins
    Ratings:
    +2,161 / 19 / -1
    My Motion Simulator:
    3DOF, DC motor, Arduino, Motion platform, 6DOF
    • Like Like x 2
    • Friendly Friendly x 1
  5. Pit

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

    Joined:
    Oct 2, 2013
    Messages:
    3,012
    Location:
    Switzerland
    Balance:
    30,438Coins
    Ratings:
    +3,089 / 31 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    I got it!!!

    RPWM -> 2 (PMW)
    LPWM -> 3 (PMW)
    R_EN + L_EN -> 9 (PMW)
    VCC (5V)
    GND

    @Historiker: you should update the very first page of this thread. :) PS: I mean @RufusDufus as the thread starter.
    • Like Like x 1
    Last edited: May 7, 2014
  6. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    15,896Coins
    Ratings:
    +1,016 / 10 / -1
    Hi Pit, glad to see you got everything going and without assistance! I will investigate this one a bit further as I use these H-Bridges and the details on the first page were taken from that setup - maybe I translated wrong?

    I'm pretty sure the way you have wired though the motors won't change direction correctly while in MODE2 - I believe with this wiring you want to be in MODE1 and it will drive that particular H-Bridge in drive/coast mode instead of drive/brake mode (which is OK).

    Anyway if it is working, that's great, maybe as you say I have translated the pins somewhere in the first post - I'll let you know what I find out when I have a closer look.
    • Like Like x 1
  7. Pit

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

    Joined:
    Oct 2, 2013
    Messages:
    3,012
    Location:
    Switzerland
    Balance:
    30,438Coins
    Ratings:
    +3,089 / 31 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    @RufusDufus: I have to state the "got it" more precisely... yesterday I built only a test unit and connected a power meter to the bridge. I do not know yet if all goes well so perhaps it would be too early to say "I got it". By the way I think I am on the way. Tomorrow the test unit should be ready and I can give you more information.
    • Like Like x 1
    Last edited: May 8, 2014
  8. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    15,896Coins
    Ratings:
    +1,016 / 10 / -1
    I've checked the code and the wiring diagrams in the first post and they appear correct. For clarity here is the correct wiring for MODE2 with the IBT-2 H-Bridge including the pin numbers for both:

    MOTOR1
    Arduino Pin 2 M1 ENA --------> H-Bridge Pin 1 IN1 (sometimes labelled RPWM)
    Arduino Pin 3 M1 ENB --------> H-Bridge Pin 3,4 EN1, EN2 (sometimes labelled R_EN, L_EN)
    Arduino Pin 9 M1 PWM ----------> H-Bridge Pin 2 IN2 (sometimes labelled LPWM)

    MOTOR2
    Arduino Pin 4 M2 ENA --------> H-Bridge Pin 1 IN1 (sometimes labelled RPWM)
    Arduino Pin 5 M2 ENB --------> H-Bridge Pin 3,4 EN1, EN2 (sometimes labelled R_EN, L_EN)
    Arduino Pin 10 M2 PWM ----------> H-Bridge Pin 2 IN2 (sometimes labelled LPWM)

    If it helps here is a basic drawing of how these H-Bridges work.

    SimpleHBridge.jpg
    The L_PWM and R_PWM determine whether +12V or GND will be connected to each of the motor pins. The EN_L and EN_R inputs determine if the motor pin is connected through or left open circuit. So there are various ways to drive the bridge, typically you put a PWM signal on one of the PWM pins and switch the other to ground and then to reverse the motor you swap the signals to these pins. In this case you can just leave the EN pins switched on.

    Because of the way I setup the SMC3 code it wasn’t easy to just swap the PWM signal to another pin so I leave it on one but switch the other between +12V or GND depending on the direction I want. But in doing this you also have to invert the PWM signal as well – which is the same as swapping the duty cycle: INV_PWM% = 100% - PWM%. (MODE2 does this inverting of PWM) Again in this mode you can leave the EN pins always on.

    Another way of driving it is to use the PWM inputs as the direction pins and just switch them to +12V and GND depending on the direction you want. And then you put the PWM signal on the EN pins which effectively switches the power on and off rapidly to the motors. This is normally referred to as drive/coast mode as it doesn’t apply any braking to the motor. If you use the connections you have given above with MODE1 you will be running the H-Bridge like this. The only disadvantage of using this mode with this particular H-Bridge is that the EN pins are also used to reset the protection circuitry so by applying the PWM to these pins effectively resets the protection at the PWM frequency making it ineffective.
    • Informative Informative x 3
    • Like Like x 1
  9. Pit

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

    Joined:
    Oct 2, 2013
    Messages:
    3,012
    Location:
    Switzerland
    Balance:
    30,438Coins
    Ratings:
    +3,089 / 31 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    @RufusDufus thank you so much for sharing your thoughts and information. I have to analyze all for now.
    • Winner Winner x 1
  10. Pit

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

    Joined:
    Oct 2, 2013
    Messages:
    3,012
    Location:
    Switzerland
    Balance:
    30,438Coins
    Ratings:
    +3,089 / 31 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    I am a little unsure, I wired now exactly what you have written but only MODE 1 works for now. No matter why but if it works it works for me :) Certainly I will get things straight later if something was not clear or wrong.
    • Winner Winner x 1
  11. Pit

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

    Joined:
    Oct 2, 2013
    Messages:
    3,012
    Location:
    Switzerland
    Balance:
    30,438Coins
    Ratings:
    +3,089 / 31 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    :sos:mad: First impressions after one day wiring, testing and lost time...

    1. One of the bridges (first one) is not working properly. The fan of the power supply slows down when a motor begins to turn.
    2. After a few rounds of testing a winches stopped abruptly. Then I heard a noise from the other bridge (second one) like a little hiss. Now nothing works.

    An experience more ...the moto monster is not so bad! It shuts down right in time if the load is too much to prevent damaging. IMO the IBT-2 is not worth the few bucks.
    • Friendly Friendly x 1
    Last edited: May 9, 2014
  12. Pit

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

    Joined:
    Oct 2, 2013
    Messages:
    3,012
    Location:
    Switzerland
    Balance:
    30,438Coins
    Ratings:
    +3,089 / 31 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    UPDATE: what a mess, the bridges are different! One is the BTN7960B and the other one ist the BTS7960B...no wonder. Never buy in a shop you don't know.
    • Optimistic Optimistic x 1
  13. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    15,896Coins
    Ratings:
    +1,016 / 10 / -1
    Bad news! :( Sounds like there may have been a manufacturing issue perhaps? The BTN and BTS devices shouldn't be that much different.

    How did you end up driving them MODE1 or MODE2... did you notice my comment above that MODE1 would effectively disable the protection circuit on the IBT-2?

    The Monster Moto's use the same output driver as the JRK12v12 that have proven to be very reliable. So apart from the Arduino having a different PID algorithm to drive them they should be pretty tough boards. If you have them they sound like a good option.
    • Like Like x 1
  14. Pit

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

    Joined:
    Oct 2, 2013
    Messages:
    3,012
    Location:
    Switzerland
    Balance:
    30,438Coins
    Ratings:
    +3,089 / 31 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    MODE1. No problem at all these bridges are limited and no progress in comparison to the monster moto. My experiment was to push the limit of the IBT-2.Finally they are not "better". I will go ahead with the monster moto by using both channels for one winches if possible.
    • Like Like x 1
  15. Pit

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

    Joined:
    Oct 2, 2013
    Messages:
    3,012
    Location:
    Switzerland
    Balance:
    30,438Coins
    Ratings:
    +3,089 / 31 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    @RufusDufus if you are willing to develop the code for sabertooth 2x60 I will spend you all my coins I have :)
    • Like Like x 2
  16. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    15,896Coins
    Ratings:
    +1,016 / 10 / -1
    Don't worry about the coins... I will have a look at the datasheet and see what is required. :thumbs

    You just can't get enough power can you! :grin
    • Like Like x 3
    • Winner Winner x 2
  17. dedas

    dedas Active Member

    Joined:
    Feb 5, 2012
    Messages:
    115
    Occupation:
    IT Manager
    Location:
    Netherlands
    Balance:
    - 26Coins
    Ratings:
    +81 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Hi Guys,
    I'm using 2 x IBT-2 with a arduino mini pro clone with the great software from RufusDufus and for the time being it works without a problem.
    The motors i have are from a old golfcar (350W/24V) and concected them on a 12V powersource.
    I'm now fiddling (struggling) with simtools to get it working with LFS :rolleyes:
    • Like Like x 1
  18. dedas

    dedas Active Member

    Joined:
    Feb 5, 2012
    Messages:
    115
    Occupation:
    IT Manager
    Location:
    Netherlands
    Balance:
    - 26Coins
    Ratings:
    +81 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Looking for some help now :(
    All is running fine now with SMCUtils (hardware is Arduino Mini pro and two IBT-2's), real smooth movement without any problems,
    But when i use Simtools and made a profile like the example (saw & surge) i can move the axis in output testing.
    Then i'm using the game LFS and the default profile then there is no roll or pitch, what did i overlooked???:sos
    • Like Like x 1
  19. Pit

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

    Joined:
    Oct 2, 2013
    Messages:
    3,012
    Location:
    Switzerland
    Balance:
    30,438Coins
    Ratings:
    +3,089 / 31 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    Hi @dedas do you record any data into the tuning center?
    • Winner Winner x 1
    Last edited: May 11, 2014
  20. dedas

    dedas Active Member

    Joined:
    Feb 5, 2012
    Messages:
    115
    Occupation:
    IT Manager
    Location:
    Netherlands
    Balance:
    - 26Coins
    Ratings:
    +81 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Yes i did get al sorts of data in the tuning center, and i can see the virtual axis moving.
    There is data comming out of the game, seems to me that saw & surge is working but i have no roll & pitch some how
    • Like Like x 1