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

Idea: convert a stepper motor drive to a FFB controller

Discussion in 'DIY peripherals' started by Aerosmith, Oct 31, 2024.

  1. Aerosmith

    Aerosmith Active Member

    Joined:
    May 30, 2024
    Messages:
    380
    Occupation:
    self employed
    Location:
    Germany
    Balance:
    2,223Coins
    Ratings:
    +225 / 0 / -0
    My Motion Simulator:
    3DOF, AC motor
    If you are a skilled programmer you can create lots of fancy stuff with Arduinos and motor controllers like the BTS7960. But if somebody with less knowledge of electronics and software is trying to replicate something somebody else has build there is so much that can go wrong. Especially for a force feedback controller the cheap motor drivers kind of suck. If any at all exists the current measurement is used as overcurrent protection and there is no way of measuring the actual motor current with the CPU. So the software has to guess the current based on speed, BEMF and PWM duty cycle.

    For force feedback it would be much better to have a current mode amplifier instead of a simple PWM H-bridge that basically controls voltage to the motor. Why not take some hardware that has all that already on board: a stepper motor drive. A modern digital drive (google MD556) already has built in:
    • a powerful CPU
    • two H-bridges
    • current control
    • full protection (overcurrent, short, overtemperature, overvoltage)
    • serial port to connect to PC
    All we'd need to do is to "hijack" the hardware and flash it with a new software. Well, writing the software would still be a challenging task. But once it works it would be "foolproof". No matter what motor used force is always proportional to the commanded value. No spaghetty wiring...
  2. cfischer

    cfischer Active Member Gold Contributor

    Joined:
    Sep 7, 2015
    Messages:
    379
    Location:
    Colorado
    Balance:
    2,721Coins
    Ratings:
    +266 / 1 / -0
    Are you thinking this controller would drive a stepper motor?
  3. Aerosmith

    Aerosmith Active Member

    Joined:
    May 30, 2024
    Messages:
    380
    Occupation:
    self employed
    Location:
    Germany
    Balance:
    2,223Coins
    Ratings:
    +225 / 0 / -0
    My Motion Simulator:
    3DOF, AC motor
    The MD556 or similar controllers are made to drive a stepper motor. Stepper motors are driven with a constant current at standstill. There are two coils and therefore two H-bridges in the drive. The current through each of the windings can be controlled seperately.

    When the motor moves the two currents form a vector that rotates in the coordinate system. 90° is a full step. With microsteps the vector steps around a circle.

    The Idea is to replace the stepper motor with one or two DC motors. With a modified (non-existent, at the moment) software the two currents can be modulated completely independently. Torque is proportional to the current which provides the "force" to the wheel, yoke, joystick or whatever.
  4. Jonny_boii

    Jonny_boii Member

    Joined:
    Oct 29, 2024
    Messages:
    49
    Balance:
    259Coins
    Ratings:
    +8 / 0 / -0
    My Motion Simulator:
    DC motor, Arduino
    All this sounds good, The main problem is who will do such a daunting task of hacking the stepper driver when you could use it as is for DD wheel with closed loop stepper (like NEMA 34).

    Anyway, one guy did try making a DD with a closed stepper motor it did work but at a cost. Fyi even he did not use a stepper motor driver but made his own. It had a lot of problems but I worked and he was selling it (at least that's what he was doing last time I checked) for more info read this post. Anyway, I am not discouraging anyone from hacking this device please try it by all means. But it's too expensive to replace if you make a
    mistake (at least for someone like me) if not then thas all good. ;)
  5. Aerosmith

    Aerosmith Active Member

    Joined:
    May 30, 2024
    Messages:
    380
    Occupation:
    self employed
    Location:
    Germany
    Balance:
    2,223Coins
    Ratings:
    +225 / 0 / -0
    My Motion Simulator:
    3DOF, AC motor
    Again, the idea is to use the stepper driver boards to drive a DC motor, not a stepper.

    And yes, hacking the MD556 wouldn't be easy. I think it uses some TI DSP which is quite different from the Arduinos most poeople are used to. I myself don't have the time for reverse engineering that device. But I have another idea.
    StepperDrives.jpg
    I have that crate full of old stepper motor drives. I have developped and produced them (that's actually part of what I make for a living) so I know how they work. They are capable of driving two windings with 10A each or 20A in parallel. It would be no big deal to modify the firmware to output current directly according to input commands over a serial port. It's almopst impossible to damage them as long as you don't connect the supply in reverse. They have full overvoltage, short and overheat protection.

    My only problem is that I have no clue at all how that FFB stuff works in the PC software. We'd need some software that can read the variable values from the sim software and output it to a serial port, just the same like FlyPT Mover does for the motion actuators.
    • Like Like x 1
  6. Aerosmith

    Aerosmith Active Member

    Joined:
    May 30, 2024
    Messages:
    380
    Occupation:
    self employed
    Location:
    Germany
    Balance:
    2,223Coins
    Ratings:
    +225 / 0 / -0
    My Motion Simulator:
    3DOF, AC motor
    BTW, the stepper motor driver can control the motor current and thus the torque/force directly and without any feedback from an encoder. Unfortunatelly, it doesn't have any analogue inputs for the position potentiometers. So for that part we'd still need an Arduino or leo-bodnar board.
    • Agree Agree x 1
  7. Jonny_boii

    Jonny_boii Member

    Joined:
    Oct 29, 2024
    Messages:
    49
    Balance:
    259Coins
    Ratings:
    +8 / 0 / -0
    My Motion Simulator:
    DC motor, Arduino
    Now this I can agree with
  8. Jonny_boii

    Jonny_boii Member

    Joined:
    Oct 29, 2024
    Messages:
    49
    Balance:
    259Coins
    Ratings:
    +8 / 0 / -0
    My Motion Simulator:
    DC motor, Arduino
    This problem is what everyone was facing when trying to make this work :_)
  9. John Murphy

    John Murphy Member Gold Contributor

    Joined:
    May 11, 2023
    Messages:
    82
    Occupation:
    Tech Exec
    Location:
    Virginia, USA
    Balance:
    495Coins
    Ratings:
    +22 / 2 / -0
    My Motion Simulator:
    3DOF, DC motor
    Why not just leverage what the Rhino community has done?
  10. Aerosmith

    Aerosmith Active Member

    Joined:
    May 30, 2024
    Messages:
    380
    Occupation:
    self employed
    Location:
    Germany
    Balance:
    2,223Coins
    Ratings:
    +225 / 0 / -0
    My Motion Simulator:
    3DOF, AC motor
    Because I didn't know them.:rolleyes:
    I just googled it but haven't found out what it really is. Is this a product I can buy? Is it hardware I can adapt to various control devices? Or can I use the software to build my own?
    :think
  11. John Murphy

    John Murphy Member Gold Contributor

    Joined:
    May 11, 2023
    Messages:
    82
    Occupation:
    Tech Exec
    Location:
    Virginia, USA
    Balance:
    495Coins
    Ratings:
    +22 / 2 / -0
    My Motion Simulator:
    3DOF, DC motor
    It's a ffb joystick base. you have to buy the motors and controller from vpforce, but after that you can do the whole thing diy and use their software, or order a full parts kit and assemble yourself, or order a finished unit from vpforce. The software is really quite amazing (although focused on flightsim) and is open sourced under GPL. There are also mods for pedals and collectives available to build or add ffb to existing hardware. Best way to find out more is to join their discord. There are people actively adapting the hardware/software for other uses (dont know about racing wheels, as I only do flightsim), but the basis is all there if you dont want to start from scratch.
    • Useful Useful x 1
  12. Aerosmith

    Aerosmith Active Member

    Joined:
    May 30, 2024
    Messages:
    380
    Occupation:
    self employed
    Location:
    Germany
    Balance:
    2,223Coins
    Ratings:
    +225 / 0 / -0
    My Motion Simulator:
    3DOF, AC motor
    Ok, the Rhino stuff looks quite professional. I keep that in mind for the case I need some and have the money to buy their boards. That totally makes sense if you want high quality but don't want to spend $5000 for a commercial FFB solution.

    But some people here want a dirt cheap and simple solution. As I already said, I don't have the time to provide a complete solution with driver hardware and software. But what I could do....

    I could modify my own stepper drivers to convert them to a simple "current amplifier". The don't have an USB interface to connect directly< to the PC and the sim software. But I could implement a simple PWM input just like for H-bridge motor drivers but for current instead of voltage. So 50% duty means no current, 0% duty means full backward torque and 100% duty means full forward torque.

    This way we could control the current for two DC motors with one board. The former step&direction inputs would become two PWM inputs. Would that be useful to anybody? We would still need some Arduino to implement the USB to PWM interfacing and somebody has to write the software.
    • Like Like x 1