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

Wiring a return to home switch.

Discussion in 'DIY Motion Simulator Building Q&A / FAQ' started by matthew loomis, Jun 7, 2017.

  1. matthew loomis

    matthew loomis Member

    Joined:
    May 18, 2017
    Messages:
    94
    Location:
    rochester,ny
    Balance:
    603Coins
    Ratings:
    +82 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    I want the mushroom switch I have to make my sim return to home, just drop the ffb and return to level. I looked up emergency stop in the forums and faq but all the info was for a complete power down. I already have a switch for my power supply, so I dont need that. I use a sabertooth 2x32 arduino combo so I have a few options.

    The sabertooth can use 2 pins for an e stop. Not yet sure if I use both or just send one to ground. This safely removes power from the motors, a little better then pulling the plug. I believe this would just kill the motors though. There also seems to be something in the ard programming for e stop, this may be a better option.

    I could use someone to point me in a good direction, I dont mind learning but this project already has my head spinning.

    build thread: https://www.xsimulator.net/community/threads/started-first-2dof-today.10341/
  2. Tim McGuire

    Tim McGuire "Forever a work in progress"

    Joined:
    Jul 26, 2015
    Messages:
    261
    Occupation:
    Electrical/Electronics Engineer
    Location:
    Canada
    Balance:
    2,194Coins
    Ratings:
    +314 / 2 / -0
    My Motion Simulator:
    3DOF, DC motor
    What software are you using for the motor controller? I'm assuming you mean return to rest position. It should be really easy to add a "return to rest position" routine to an arduino firmware. Wire the button up like you normally would (with a pullup or pulldown resistor), and put the output of the button to one of the unused GPIO pins on the arduino. From there you'd do something like this (this is just pseudocode, not actual C):

    Set up an external interrupt on the button pin:

    attachInterrupt(digitalPinToInterrupt(interruptpin), returnToHomeISR, RISING)

    void returnToHomeISR()
    {
    set Motor 1 position to Home
    set Motor 2 position to Home
    set Motor 3 position to Home
    set eStopFlag to True
    }

    and then somewhere in your main program loop you'd put a check to see if the eStopFlag variable was set to true, and if it was, you'd break out of the motion loop and let the motors sit.
    • Agree Agree x 1
    • Useful Useful x 1