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

My 2DOF with stepper motors

Discussion in 'DIY Motion Simulator Projects' started by Lebois, Jun 28, 2019.

  1. thefost

    thefost Member

    Joined:
    Sep 20, 2019
    Messages:
    31
    Balance:
    242Coins
    Ratings:
    +13 / 0 / -0
    Wow, fantastic work here! Thank you so much for sharing your stepper motor code, I'm seriously interested in using it to try making a gseat, but I'm a complete beginner at everything here on xsimulator. I'm just trying to learn as fast as possible. .
    Could I ask what was your reason for deciding to go with the 350W DC motor for the seatbelt tension instead of another stepper motor?
  2. Lebois

    Lebois (maybe I am wrong, but who knows...)

    Joined:
    Dec 10, 2018
    Messages:
    350
    Occupation:
    Math teacher
    Location:
    France
    Balance:
    2,544Coins
    Ratings:
    +206 / 2 / -0
    My Motion Simulator:
    2DOF
    First I bought this motor to build a mmos steering wheel. I did let go this idea. So I had this motor lying around ready to be used...
    Now the main reason you don't want to use a stepper motor to build a seatbelt is the stepper motor won't like to fail to reach a position. Depending on the stepper behaviour it will likely stop moving, go into safe mode, miss steps etc... The DC motor won't care (even if it makes a noise like it doesn't like to not move)...

    On top of that it's not natural to use a stepper... How will you drive it ? The more you brake, further the motor should turn ?
    With the dc motor it's easy, the more you brake, the more current goes into the motor, the more the belt is pulled...

    BTW : the motor is too strong for its purpose... I am not sure but in Simhub we put around 50% power..
    Then in idle state (when you don't brake), there always was around 5% power (through a simple potentiometer) so the belt was auto adjusting, very usefull for the drivers shift. The problem is that IMO you are consumming power all the time... that's not very economic considering we made a 24H race... Next time I will add a spring system to have the auto-adjust feature.
  3. My.stAr

    My.stAr Active Member

    Joined:
    Sep 7, 2012
    Messages:
    151
    Occupation:
    Engineer
    Location:
    Germany
    Balance:
    1,064Coins
    Ratings:
    +61 / 0 / -0
    My Motion Simulator:
    DC motor
    Hey @Lebois

    Thank you for your input.
    I cannot see a feedback for your seat belt tensioner. How is the setup? Maybe you can help me here.
    My.srAr
  4. Lebois

    Lebois (maybe I am wrong, but who knows...)

    Joined:
    Dec 10, 2018
    Messages:
    350
    Occupation:
    Math teacher
    Location:
    France
    Balance:
    2,544Coins
    Ratings:
    +206 / 2 / -0
    My Motion Simulator:
    2DOF
    Hi ! Why do you mean by feedback ? How it goes back in place ?
  5. My.stAr

    My.stAr Active Member

    Joined:
    Sep 7, 2012
    Messages:
    151
    Occupation:
    Engineer
    Location:
    Germany
    Balance:
    1,064Coins
    Ratings:
    +61 / 0 / -0
    My Motion Simulator:
    DC motor
    I mean how does the Controller know where the Motor is, and how much to turn. Potentiometer, Encoder... such a thing
  6. Lebois

    Lebois (maybe I am wrong, but who knows...)

    Joined:
    Dec 10, 2018
    Messages:
    350
    Occupation:
    Math teacher
    Location:
    France
    Balance:
    2,544Coins
    Ratings:
    +206 / 2 / -0
    My Motion Simulator:
    2DOF
    It's driven with torque.

    It doesn't know where the seatbelt is, but it doesn't need to because the seat belt is meant to be already closed to you. When it stops pushing, the seatbelt comes naturally back in place.
  7. Death Race

    Death Race New Member

    Joined:
    Jan 21, 2020
    Messages:
    7
    Balance:
    84Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF
    Thanks @Lebois for this project .. am a new here and i need to build my own simulator with stepper.. i need the final working code from you and wiring between motors and driver and Arduino,, and simtools setting ..


    Thanks in advance ..
  8. Lebois

    Lebois (maybe I am wrong, but who knows...)

    Joined:
    Dec 10, 2018
    Messages:
    350
    Occupation:
    Math teacher
    Location:
    France
    Balance:
    2,544Coins
    Ratings:
    +206 / 2 / -0
    My Motion Simulator:
    2DOF
    The code is in the first page and you will found the wiring in it :
    int const StepPin1 = 2, DirPin1 = 3, StepPin2 = 4, DirPin2 = 5; //Step or pulse pin

    Then nothing special. You should find the driver's wiring diagram on the manufacturer's side.
    I added the simtools settings in attachment in the first post.

    I won't detail more this project because I work on another motion rig that will be much more advanced.
    Otherwise :
    1) Anyway, you need to understand how everything work. You won't have anything moving if you don't understand the simtools settings, the arduino baseline code, the way a stepper motor is driven.
    2) You should try to make simple code work before trying the whole one. Try a communication code, a moving code, etc.
    3) Use reliable connectors to do the testings. I wasted too much time working with messed wires.
    4) The code should be working as it, but check if the Simtools "output - range" match the arduino "max pitch, max roll", and driver microstepping settings. 10 bits = 2^10 = 0 to 1023
  9. Death Race

    Death Race New Member

    Joined:
    Jan 21, 2020
    Messages:
    7
    Balance:
    84Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF

    Thanks for quick replying ..
    first i will use small stepper motor to test first before buying a bigger one :D to reduce the cost
    how many wires comes form your stepper motor ? and the motion is smoothing at the final ?
  10. Lebois

    Lebois (maybe I am wrong, but who knows...)

    Joined:
    Dec 10, 2018
    Messages:
    350
    Occupation:
    Math teacher
    Location:
    France
    Balance:
    2,544Coins
    Ratings:
    +206 / 2 / -0
    My Motion Simulator:
    2DOF
    I also forgot to say that you can ask everything you want ^^.

    I think there is 4 to the stepper driver for power supply. And 6 for the position encoder.

    Yeah quite smooth. Very detailed. There problem is that there is a lot of play in the pivot, so you loose a lot of details... I am planning to upgrade to a 3 DOf, so no pivot, and no play.
  11. Death Race

    Death Race New Member

    Joined:
    Jan 21, 2020
    Messages:
    7
    Balance:
    84Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF
    you mean 2 and 3 for each motor ? that is right ?
  12. Lebois

    Lebois (maybe I am wrong, but who knows...)

    Joined:
    Dec 10, 2018
    Messages:
    350
    Occupation:
    Math teacher
    Location:
    France
    Balance:
    2,544Coins
    Ratings:
    +206 / 2 / -0
    My Motion Simulator:
    2DOF
    2 and 3 what ? :)
  13. Death Race

    Death Race New Member

    Joined:
    Jan 21, 2020
    Messages:
    7
    Balance:
    84Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF
    wires comes out from the motor ?
  14. Lebois

    Lebois (maybe I am wrong, but who knows...)

    Joined:
    Dec 10, 2018
    Messages:
    350
    Occupation:
    Math teacher
    Location:
    France
    Balance:
    2,544Coins
    Ratings:
    +206 / 2 / -0
    My Motion Simulator:
    2DOF
    http://www.astrosurf.com/jd85/ESA/HBS-90-8.2.PDF

    1 A+ O Motor Phase A+
    2 A- O Motor Phase A
    3 B+ O Motor Phase B+
    4 B- O Motor Phase B


    1 EB+ I Encoder channel B+ input
    2 EB- I Encoder channel B- input
    3 EA+ I Encoder channel A+ input
    4 EA- I Encoder channel A- input
    5 VCC O +5V @ 100 mAmax.
    6 EGND GND Signal ground
  15. Lebois

    Lebois (maybe I am wrong, but who knows...)

    Joined:
    Dec 10, 2018
    Messages:
    350
    Occupation:
    Math teacher
    Location:
    France
    Balance:
    2,544Coins
    Ratings:
    +206 / 2 / -0
    My Motion Simulator:
    2DOF
    Guess you is back....in 3 DOF !!!
    [​IMG]
    • Like Like x 1
  16. dr.Evil

    dr.Evil New Member

    Joined:
    Aug 26, 2020
    Messages:
    15
    Balance:
    66Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF
    Nice setup, congrats on such a nice work.
    What encoders did you use for the 2DOF rig?
    • Like Like x 1
  17. Lebois

    Lebois (maybe I am wrong, but who knows...)

    Joined:
    Dec 10, 2018
    Messages:
    350
    Occupation:
    Math teacher
    Location:
    France
    Balance:
    2,544Coins
    Ratings:
    +206 / 2 / -0
    My Motion Simulator:
    2DOF
    the encoders are integrated into the stepper motors. I will soon release the tutorial to build my stepper-based actuators.
    • Like Like x 1
  18. yellofella

    yellofella Member

    Joined:
    Aug 8, 2011
    Messages:
    94
    Occupation:
    builder
    Location:
    UK
    Balance:
    743Coins
    Ratings:
    +84 / 0 / -0
    My Motion Simulator:
    3DOF, SimforceGT
    Hi @Lebois
    I am using hybrid steppers in a 6 motor g-seat/seatbelt design im building. I found in testing that those hybrid stepper drivers are not great as they will alert you that the driver missed steps but will do nothing to compensate for them so will still run out of position. I found that using the encoder to read the actuator position back to the arduino was the way forward. I use the quadrature encoder library for the arduino to read the position of the motors as it uses interrupts to catch the encoder pulses so it doesn't miss any. Each arduino can read 2 encoders but i use 1 nano per motor due to high rpm at 36v. I use a stm32 microcontroller at 128mhz as a master interface and read the data from each nano and send the data to the master using spi at high speed. The master can then detect if the current actuator position is at the target position and if not control the stepping to suit the distance from target. I use full steps to move the motors fast then micro stepping when within a few steps to stop the motor exactly on the target. In all the testing i have done i cant make it miss steps or run out of position as it will keep stepping until it reaches the target rather than sending a set amount of pulses and hope it gets to the target. I think that is how closed loop motor control should be. This may help if your thinking of building stepper motor actuators buddy.
    • Like Like x 1
  19. Lebois

    Lebois (maybe I am wrong, but who knows...)

    Joined:
    Dec 10, 2018
    Messages:
    350
    Occupation:
    Math teacher
    Location:
    France
    Balance:
    2,544Coins
    Ratings:
    +206 / 2 / -0
    My Motion Simulator:
    2DOF
    Wow that sound great ! I think that the driver is in alert if there is too many missing steps.
    Your electronic is great, otherwise it requires more electronic skill. I want to share my project so people can build it, so things must keep simple...
  20. Lebois

    Lebois (maybe I am wrong, but who knows...)

    Joined:
    Dec 10, 2018
    Messages:
    350
    Occupation:
    Math teacher
    Location:
    France
    Balance:
    2,544Coins
    Ratings:
    +206 / 2 / -0
    My Motion Simulator:
    2DOF
    but I would be interested to take a look at your code ;-)