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

    doctorxeno Member

    Joined:
    Nov 10, 2013
    Messages:
    33
    Balance:
    607Coins
    Ratings:
    +19 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    [​IMG]
    I would use SMC3 in MODE1 which can drive the Pololu board in its "Sign-magnitude (drive-brake)" mode

    Connections would be:

    SMC3 <----> Pololu Board
    GND <----> GND
    PWM ----> PWM_H
    ENA ----> DIR
    ENB ----> not connected
    not connected ----> PWM_L

    Thanks for the connections.

    Jeroen
    • Like Like x 2
  2. doctorxeno

    doctorxeno Member

    Joined:
    Nov 10, 2013
    Messages:
    33
    Balance:
    607Coins
    Ratings:
    +19 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Hit there again,

    Can you explain why you recommend the pololu 20A motor controller and the arduino with youre code work in mode1?

    I thought that mode1 is for h-bridges with the 3 pin configuration : 1 pin for pwm and 2 pins for direction.
    mode2 with 2 pin configuration : 1 pin for pwm and 1 pin for direction

    The pololu 20A is a 2 pin h-bridge if I am not mistaken, so I thought it would run in mode2

    My previous setup was 2 double wipermotors with arduino and pololu 14a... That worked fine but the wormwheels weren't strong enough.
    I was using SIMCTRL.

    Now I have mounted 2 big wormgear motors. The ZYT-155-12. These are 23a peak. Really strong, but the pololu 14a
    can't handle them.

    So thats why I want to switch to the 20a version and youre software.

    Will they do the job? I think the pololu 20a is a good solution.

    greets Jeroen
    • Like Like x 1
  3. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    15,602Coins
    Ratings:
    +1,008 / 8 / -1
    Hi Jeroen, in MODE1 the controller outputs a PWM duty cycle that sets the speed of the motor, and the ENA and ENB pins are used as direction outputs (one is just the invert of the other as some controllers require this) If you only need one Dir pin for your H-Bridge you just use either one of the ENA/ENB pins.

    MODE2 actually inverts the PWM Duty cycle when the motor reverses. This is a special for the Chinese 43A H-Bridges - I actually haven't found any others at this stage that work this way, although I haven't been searching for them. ;)

    As I've mentioned before if you have a toy motor and 9V battery that is always a good way to get confidence in the setup.
    • Like Like x 2
    • Informative Informative x 2
    • Agree Agree x 1
  4. doctorxeno

    doctorxeno Member

    Joined:
    Nov 10, 2013
    Messages:
    33
    Balance:
    607Coins
    Ratings:
    +19 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Ok thanks for the quick reply and thanks for the great work. I will order 2 pololu's then.

    For now I have one more question about galvanic isolation. I am using a usb-isolator now, but I have seen these...

    http://www.robotshop.com/eu/en/opto-isolator-breakout.html

    I know they must be connected between interface and h-bridge. But don't know the connections.

    I would like to ask for a schematic.

    greets Jeroen
    • Like Like x 1
  5. ericRacer

    ericRacer You get old because you stop playing ! Gold Contributor

    Joined:
    Jun 11, 2009
    Messages:
    251
    Occupation:
    Pilot
    Location:
    Canada, Quebec
    Balance:
    989Coins
    Ratings:
    +147 / 2 / -0
    My Motion Simulator:
    3DOF, Arduino, Motion platform
    Hi there,
    i tried SMC3 utility and i have problem with it. It open but it close after 2-3seconds. I don't know if it is because of Arduino nano or Arduino Duemilanove 328 ?
    thanks
    Eric
    • Like Like x 1
  6. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    15,602Coins
    Ratings:
    +1,008 / 8 / -1
    Hi @ericRacer, I am not sure why the Windows SMC3 utility would shutdown. The SMC3.ino was specifically designed for the Arduino Uno so I can't confirm if it will work on any other Arduino - but I wouldn't think that would cause the windows program to shut down anyway.

    There is a bug in the current version of Windows SMC3 utils as posted - the keyboard input doesn't require the program to be the active window to receive input - that is if you say switch to notepad and start typing text, the Windows SMC3 utils will still register those keypresses (and ESC key will close Windows SMC3 utils).

    I am planning to post a new version soon with that fixed and a few other enhancements.

    If you could post some more details or even a video of what is happening that may help me find the problem. :think
    • Like Like x 2
  7. ericRacer

    ericRacer You get old because you stop playing ! Gold Contributor

    Joined:
    Jun 11, 2009
    Messages:
    251
    Occupation:
    Pilot
    Location:
    Canada, Quebec
    Balance:
    989Coins
    Ratings:
    +147 / 2 / -0
    My Motion Simulator:
    3DOF, Arduino, Motion platform
    @RufusDufus
    I am happy ! :D i found the problem ! :cool: it was my AV (avast, deepscreen function ).
    Thanks

    Works with Nano too !


    i see the button <save> that save the numbers in the memery but what is the function of "->B" and " ->C" exactly ?
    • Like Like x 1
    Last edited: Dec 23, 2013
  8. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    15,602Coins
    Ratings:
    +1,008 / 8 / -1
    Good to hear it is working now.

    The Save will actually be save/load parameters to file in the next version. The parameters automatically save to the SMC3 after 1 second of being changed.

    The ->B and ->C are used to copy all current motor parameters to motor B or motor C (these will change depending on which motor is selected)
    • Like Like x 2
  9. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    15,602Coins
    Ratings:
    +1,008 / 8 / -1
    I have added a new BETA version of SMC3.ino and associated windows SMC3Utils program. (Both ver 0.6) If anyone is interested in testing I would appreciate some feedback.

    Note you can test just the Windows SMC3 Utils without the Arduino if you don't want to change your setup... To do this create a new interface output in simtools using a new interface tab and:
    • Set it up to use NET output with UDP Port 20017
    • In the Output String put [A<Axis1>][B<Axis2>][C<Axis3>] with a 10ms delay
    • In the IP Address put the address of the computer you are running Windows SMC3Utils.
    Now when you are using Simtools if you run SMCUtils on the other computer and select "UDP pass through" you should see a light blue line on the chart which is the position data being sent by Simtools. (If you are not using SMC3 Arduino then all the other coloured lines won't be updated - If you are then you should also see lines for the Feedback position and PWM and a few others)

    To Install SMC3Utils simply unzip the file in a directory somewhere and run (you can change a couple of settings in the ini file but not required.) Note you will need to let it through your firewall to use the UDP network feature.
    • Like Like x 5
  10. ericRacer

    ericRacer You get old because you stop playing ! Gold Contributor

    Joined:
    Jun 11, 2009
    Messages:
    251
    Occupation:
    Pilot
    Location:
    Canada, Quebec
    Balance:
    989Coins
    Ratings:
    +147 / 2 / -0
    My Motion Simulator:
    3DOF, Arduino, Motion platform
    Good ! :thumbs

    Surely,I am going to test it soon, but busy days at this time
    • Like Like x 1
  11. merlin salazar

    merlin salazar New Member

    Joined:
    Dec 1, 2013
    Messages:
    5
    Balance:
    296Coins
    Ratings:
    +2 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    fantastico tutorial grasias RufusDufus
    • Like Like x 1
  12. rafael_design

    rafael_design Member

    Joined:
    Feb 17, 2011
    Messages:
    202
    Occupation:
    CGI Architectural Visualizations with Blender 3D
    Location:
    Brasil
    Balance:
    328Coins
    Ratings:
    +19 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, Motion platform
    I am facing this problem that the pots interfere on each other. Very annoying. Has someone else seen this happening? I recently discovered that my uno is Clone and i am afraid that this could be the problem.

    I spend some time on arduino forums and read something about pots <10k are optimal because of impedance...

    10k pot could help on accuracy but I am not sure if this would be related to interference on each other anyway :C
    • Like Like x 1
    • Informative Informative x 1
    Last edited: Dec 30, 2013
  13. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    15,602Coins
    Ratings:
    +1,008 / 8 / -1
    Hi rafael_design, I wouldn't expect the pots to interfere with each other. 10K should be fine. some questions:

    What are you seeing that makes you suggest they are interfering with each other?
    Can you post some closeup photos of your pot and motor wiring so we can see if anything doesn't look right?
    Are you using Arduino and SMC3 or some other controller?
    If you disconnect power to one motor does the other work as expected?
    • Like Like x 2
  14. rafael_design

    rafael_design Member

    Joined:
    Feb 17, 2011
    Messages:
    202
    Occupation:
    CGI Architectural Visualizations with Blender 3D
    Location:
    Brasil
    Balance:
    328Coins
    Ratings:
    +19 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, Motion platform
    Thanks for replying!

    Leds representing the motor pwms. It is way better now with 22k pots. Much lower noise spikes in the graph. But as you can see in the video below there is remaining interference. But I am not sure if it is a big deal or I am being too perfectionist.

    http://www.xsimulator.net/community...9/?temp_hash=3b57fa65ef76266cd0fd0d980bd35029
    Unfortunaly at this moment I am using Arduino and another software. I tried SMC3Utils this afternoon but, as I am not with the pots attached to the motor I think I would not be able to follow the Utility intructions:
    " 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. "
    At this moment I am using only one motor and I think it is working fine.



    Wish you all the best new year,
    Rafael.

    Attached Files:

    • Like Like x 1
  15. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    15,602Coins
    Ratings:
    +1,008 / 8 / -1
    @rafael_design, OK so very much at prototype stage, good to see you testing your design first... I am surprised that you get interference from one pot to another? Do you have pots connected to all the analogue inputs or just the one you are adjusting? If the input pin is unconnected it will definitely be influenced by other inputs. It is difficult to see in the photo - I wasn't expecting to see a proto board layout :grin Do you have the pots connected to the Arduino +5V and GND with the wiper pin connected to the Arduino Analogue input?

    No need to use SMC3 if you have something else working... however if you want to it doesn't have to have the pots mechanically connected to the motor. SMC3 Utils will show you the current pot position and target position - if you manually turn the pot the motor should slow down as the position gets closer to the target position. It may help to see what is happening with the analogue inputs?
    • Like Like x 1
  16. ericRacer

    ericRacer You get old because you stop playing ! Gold Contributor

    Joined:
    Jun 11, 2009
    Messages:
    251
    Occupation:
    Pilot
    Location:
    Canada, Quebec
    Balance:
    989Coins
    Ratings:
    +147 / 2 / -0
    My Motion Simulator:
    3DOF, Arduino, Motion platform
    Hi,
    Doesn't works this time with Demilanove (SMC3) :(,
    The code seems to work, I can control the motor.

    With former SMC3Utils I could select the ComPort (5) but not with this one. It does not seem to communicate with the arduino.
    How do you select the communication port with this new version?
    Thanks :cool:
    • Like Like x 1
    • Winner Winner x 1
  17. rafael_design

    rafael_design Member

    Joined:
    Feb 17, 2011
    Messages:
    202
    Occupation:
    CGI Architectural Visualizations with Blender 3D
    Location:
    Brasil
    Balance:
    328Coins
    Ratings:
    +19 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, Motion platform
    Yes I have two analog inputs connected to two pots (you can see the two pots in my last post picture). I already noticed that if one pot is unconnected then this input is influenced by the other pot. Both pots to 5v, gnd and analogue input of arduino.
    I will give SMC3 Utils another try today.

    Remember I said that with lower ohm pots I noticed very big difference in noise in the software reading interface AND I am biased to think we cant get rid of this little interference (which seem to be smaller with lower ohm pots too). And probably it will not have big influence in the final product (I hope so :D)

    I designed this new h-bridge and will test it now. I will post the results.

    Fingers crossed please! :D

    Attached Files:

    • Like Like x 1
  18. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    15,602Coins
    Ratings:
    +1,008 / 8 / -1
    Sorry, should have explained that... the comm port # is now setup in the SMCUtils.ini file - Just edit it with notepad or any other text editor.
    Also note when you setup Simtools the baud rate has changed to 500K baud.
    • Like Like x 2
  19. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    15,602Coins
    Ratings:
    +1,008 / 8 / -1
    OK, sounds like you have things under control for now. I am still a bit surprised with analogue inputs but hopefully not enough to influence the control. It may be that there is some ground noise from the motor drive circuits causing problems. Given it is all on breadboards the ground may not be as solid as the final layout. Lets see how your H-Bridge goes. Good luck and have fun! :cheers
    • Like Like x 1
  20. ericRacer

    ericRacer You get old because you stop playing ! Gold Contributor

    Joined:
    Jun 11, 2009
    Messages:
    251
    Occupation:
    Pilot
    Location:
    Canada, Quebec
    Balance:
    989Coins
    Ratings:
    +147 / 2 / -0
    My Motion Simulator:
    3DOF, Arduino, Motion platform
    @RufusDufus Thank you very much !:thumbs
    I tried it with Arduino Nano 500kbauds and it works fine ! i am impressed !:D

    The first test I was disappointed when I saw only 400 calc / sec (pid) but after adjusting the divider PID, I found the 4000 calc / sec / Engines -> fantastic! :cheers

    Several improvements and more convenient added,
    Frankly, nice work. :rolleyes:

    One problem I have is with simtool when I test the engine in manual mode and I drag the slider, I have to move from + or -20% before the engine moves and it does not occur with SMC3Utls in manual mode. I checked the filters and limits and everything is normal.
    Is this the new version of simtool makes it o_O
    Thanks
    Eric
    • Like Like x 1