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

Resolved SMC3 Arduino and changing hall sensor direction?

Discussion in 'New users start here - FAQ' started by xytras, Mar 9, 2017.

  1. xytras

    xytras Member Gold Contributor

    Joined:
    May 28, 2015
    Messages:
    92
    Location:
    germany
    Balance:
    587Coins
    Ratings:
    +22 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Currently I am switching to bigger motors for my 2DOF and while doing so I noticed that one POT delivers quite noisy results so I want to switch to hall sensors and got two of these 6127V1A180L.5 from Farnell.
    Ordered yesterday, got them today :)

    Anyway, I just tried one and connected it to the Arduino. Works almost perfect with very exact output and it can turn 360° and doesn´t get killed. However how do I place it on the opposite side?

    I have two ideas in mind and I don´t like one of them but since many of you already use hall sensors maybe I think too complicated.

    My pots/now sensors are directly mounted to the motor shaft so I could either disassemble one of the sensors and turn the sensor in it around or change the code of SMC3 to recalc the values for the second sensor.

    A different approach would be to directly put a
    SS495A
    on the motor mount and a magnet on the lever. That way is nice since there wouldn´t be any mechanical connection between shaft and sensor and the motor could turn 360° but it also means more work and alignment and I already got the rotary sensors ;-)
  2. Ads Master

    Ads Master

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
  3. xytras

    xytras Member Gold Contributor

    Joined:
    May 28, 2015
    Messages:
    92
    Location:
    germany
    Balance:
    587Coins
    Ratings:
    +22 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    I guess I just found out myself...
    //#define REVERSE_MOTOR1

    :D
    • Winner Winner x 1
  4. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    14,044Coins
    Ratings:
    +965 / 7 / -1
    Yes that will work but only for one Motor - you will need to update code to do the other. This was really only testing code and isn't necessary.

    If the POT is turning in the opposite direction to the Motor (ie the PID can't position motor - get runnaway) you are better off just reversing the wires to the motor.

    If the POT AND Motor can be positioned OK with PID but move opposite to what you want then you can reverse them in Simtools with a checkbox in the Axis settings.
    • Informative Informative x 2
  5. speedy

    speedy Well-Known Member

    Joined:
    Feb 1, 2012
    Messages:
    1,194
    Location:
    Alexandria , Egypt
    Balance:
    7,724Coins
    Ratings:
    +1,274 / 9 / -0
    My Motion Simulator:
    3DOF, AC motor, Arduino, Motion platform
    :cheers...
    fireworks-animated-gif-22-2.gif
  6. speedy

    speedy Well-Known Member

    Joined:
    Feb 1, 2012
    Messages:
    1,194
    Location:
    Alexandria , Egypt
    Balance:
    7,724Coins
    Ratings:
    +1,274 / 9 / -0
    My Motion Simulator:
    3DOF, AC motor, Arduino, Motion platform
    For one motor ? ... :sos Does that means if I removed the slashes and used MOTOR2 or 3 instead then uploaded it to Ard. >> will work ?

    #define REVERSE_MOTOR2
    or
    #define REVERSE_MOTOR3
  7. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    14,044Coins
    Ratings:
    +965 / 7 / -1
    Sorry @speedy, no that won't work. The reverse motor was just added ages ago for me to do some experimenting, it was only for one motor I was playing with.

    If you want to do the other motors you need to search through the code and everywhere there is a

    #if def REVERSE_MOTOR1
    ....
    code
    ...
    #end if

    you need to duplicate the block and amend for the other motors.

    Can't you reverse the wires to the motor?
    • Informative Informative x 1
  8. xytras

    xytras Member Gold Contributor

    Joined:
    May 28, 2015
    Messages:
    92
    Location:
    germany
    Balance:
    587Coins
    Ratings:
    +22 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Switching the wires. Looks like my brain had the handbrake on yesterday.
    I was so fixed on the sensors that the simplest thing didn´t came to my mind. motors.gif
    • Winner Winner x 1
  9. Pit

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

    Joined:
    Oct 2, 2013
    Messages:
    3,029
    Location:
    Switzerland
    Balance:
    29,899Coins
    Ratings:
    +3,045 / 30 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    • Like Like x 1
  10. speedy

    speedy Well-Known Member

    Joined:
    Feb 1, 2012
    Messages:
    1,194
    Location:
    Alexandria , Egypt
    Balance:
    7,724Coins
    Ratings:
    +1,274 / 9 / -0
    My Motion Simulator:
    3DOF, AC motor, Arduino, Motion platform
    Yes I can with normal pot and no with hall effect ...
    Actually using a 1:1 gear would do the trick but less is more ... If I can do with the code

    Q2: Can I make 3 copy of those blocks renameing them for each motor ... then use 3 of those define command at the start to activate/deactivate the required motor ?

    I'm sorry it seems like a dum question that I have to try myself ... but I need to know the cons on the whole code performance if there is ?

    Q3: if OK to Q2 :grin ... then for reversing the motor pot ... can this be added to the Util. as a check box for each motor ?

    Thanks
    Gre:Dedy
    Last edited: Mar 10, 2017
  11. xytras

    xytras Member Gold Contributor

    Joined:
    May 28, 2015
    Messages:
    92
    Location:
    germany
    Balance:
    587Coins
    Ratings:
    +22 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Alright, just burned one of the IMS-1. Damn, not my day. Don´t even know why it burned but it obviously didn´t like the flipping of the motor cables :-/
    Gotta order some new IMS-2B and be more careful then.

    Oh no... the 2B is 12V only ... sh...
  12. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    14,044Coins
    Ratings:
    +965 / 7 / -1
    Why does it matter if you have a POT or Hall sensor to reverse the Motor wires?
  13. xytras

    xytras Member Gold Contributor

    Joined:
    May 28, 2015
    Messages:
    92
    Location:
    germany
    Balance:
    587Coins
    Ratings:
    +22 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    It doesn´t matter, though I reversed the wires on the pot when I used pots because the graph in SMC3 remains visually logical. I guess that is where you get easily confused because the graph turns around when you reverse the wires on the motor. And since you cannot reverse the wires on a Hall sensor the reversed graph isn´t avoidable. It is silly but it was a trap for _my_ brain ;-)
    • Informative Informative x 1