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

DIY FFB Steering wheel (MMosFFB ) (In Progress)

Discussion in 'DIY peripherals' started by Alexey, Dec 10, 2015.

  1. Alexey

    Alexey Well-Known Member

    Joined:
    Sep 23, 2014
    Messages:
    452
    Occupation:
    Electronics Technician
    Location:
    Adelaide, Australia
    Balance:
    8,060Coins
    Ratings:
    +620 / 2 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    Torque is generally at it's highest at 0 rpm (theoretically) and drops off with more rpm. PWM controls the voltage level applied (less on time) thus reducing torque.
    [​IMG]

    On this graph, imagine that the lower line is PWM at lowest duty cycle and top line is PWM max duty cycle. So with FFB wheel being on stall most of the time you have maximum motor torque all the time.
    PWM then reduces the torque by effectively dropping voltage which in turn drops current which drops the torque. No need to "re-invent the wheel" (no pun intended).

    My understanding:
    Less FFB strength responses = less PWM duty cycle
    High strength FFB = higher PWM duty cycle

    So the PWM isn't necessarily controlling the speed of the motor because speed is always at minimal anyway. I'd say the PWM for FFB is in fact a torque controller.
  2. pipis2015

    pipis2015 over-boost

    Joined:
    Feb 18, 2015
    Messages:
    222
    Location:
    Athens, GREECE
    Balance:
    10,248Coins
    Ratings:
    +271 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    You are right when you say that you can change the torque by changing the pmw.But you don't control it. You just change it (increase it or decrease it) by an unknown factor.

    Only by given certain and known amperage flow values...different pmw (aka different voltage values) produce different controlled torque results for each individual motor.

    My guess was that there had to be some kind of amperage regulatory system at least if not a continuously calculated value.

    So to end up I was just curious to know if there was some kind of 3d mapping that the wheel controllers use to reproduce with torque, the data that they get from the game.

    Or if approximated (and most probably unrealistic) torque queues (forces) are reproduced on our wheelsets

    Thank you very much for your answer.
    • Like Like x 1
  3. Alexey

    Alexey Well-Known Member

    Joined:
    Sep 23, 2014
    Messages:
    452
    Occupation:
    Electronics Technician
    Location:
    Adelaide, Australia
    Balance:
    8,060Coins
    Ratings:
    +620 / 2 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    I'm not quite understanding what you are trying to do or improve.
    A motor will take the maximum current it needs for a given voltage in it's rpm range. With a FFB wheel their rpm range would be quite minimal so torque would be determined by the PWM applied. Different torque values for individual motors vary because of motor strength, not the PWM control signal. It is up to you as the designer to choose a motor with the desired torque. The maximum torque you would feel is the motors stall torque and then everything else is scaled from there. If you are after a specific torque, eg. you have measured the torque of a steering wheel in a race car and want to simulate it, you would have to use a motor capable of delivering that torque. If the motor is too strong you simply turn down the FFB gain until the torque is correct. The game itself controls all the varying strength for the FFB and the FFB controller simply outputs a signal (PWM) proportional to the strength and direction for the motor driver dictated by the game being played.

    Forgive me if I'm still not on the same page as you.
    • Agree Agree x 1
  4. Alexey

    Alexey Well-Known Member

    Joined:
    Sep 23, 2014
    Messages:
    452
    Occupation:
    Electronics Technician
    Location:
    Adelaide, Australia
    Balance:
    8,060Coins
    Ratings:
    +620 / 2 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    Would be interesting to see, but I doubt any game would send out torque data as different wheels would have different torque ratings. The steering wheel itself inputs its wheel position to the game and then the game outputs a force strength and direction back to the FFB controller. For things like the ripple strip curbs, the game would output data to the wheel basically saying oscillate the wheel backwards and forwards at XX rate and XX% FFB strength. If you'd like a more pronounced strength you simply turn up the gain for that effect within the games FFB settings.
  5. Alexey

    Alexey Well-Known Member

    Joined:
    Sep 23, 2014
    Messages:
    452
    Occupation:
    Electronics Technician
    Location:
    Adelaide, Australia
    Balance:
    8,060Coins
    Ratings:
    +620 / 2 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    I suppose the question I need to ask is why control the current and why is it any different to the PWM that already controls the current?

    Ok, so lets say you know your motors torque for a given current. The FFB controller gives you a %75 duration signal for a given event within the game. Lets say that at this point you have calculated that the wheels needs 1NM of torque but the force felt is actually 0.7NM. Why would you want to change the current at this point? Just turn up the gain then?

    Cheers in advance
  6. Alexey

    Alexey Well-Known Member

    Joined:
    Sep 23, 2014
    Messages:
    452
    Occupation:
    Electronics Technician
    Location:
    Adelaide, Australia
    Balance:
    8,060Coins
    Ratings:
    +620 / 2 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    Just found this posted by Mizoo back in 2012 who i think actually wrote the MMos FFB.
    So there ya have it, I was wrong about assuming simple direction and force strength. well partially anyway.

    • Informative Informative x 2
  7. RacingMat

    RacingMat Well-Known Member Gold Contributor

    Joined:
    Feb 22, 2013
    Messages:
    2,234
    Location:
    Marseille - FRANCE
    Balance:
    20,895Coins
    Ratings:
    +2,084 / 21 / -2
    My Motion Simulator:
    2DOF, DC motor, Arduino
    @Alexey : Mizoo wrote the first firmware for LPC Pack board
    and later, MMos write a firmware for SMT Disco board
    There is also a Arduino firmware written by EtienneGameSeed.
    • Informative Informative x 1
  8. Pit

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

    Joined:
    Oct 2, 2013
    Messages:
    3,013
    Location:
    Switzerland
    Balance:
    30,416Coins
    Ratings:
    +3,088 / 31 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    @Alexey may I ask you to upload a wiring diagram of your components or some more detailed photos of the boards?
    • Like Like x 1
  9. Alexey

    Alexey Well-Known Member

    Joined:
    Sep 23, 2014
    Messages:
    452
    Occupation:
    Electronics Technician
    Location:
    Adelaide, Australia
    Balance:
    8,060Coins
    Ratings:
    +620 / 2 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    Sure thing, I'll start documenting what I've done so far. I am assuming you want to test out the MMos controller and compare to the T500?

    One thing you will need to do is to find out the resolution of the optical encoder in (CPR) and its wiring configuration (Channels A and B and if there is a "Home" channel).
    It's ok to mix up channel A and B as you can reverse it in the software setup. Another thing you will need is a 24V motor controller H bridge that can utilize either 4x PWM channels or PWM + DIR.

    If you use a 12V H-Bridge on your motor you will continually shut down the PSU from over voltage during fast turns of the wheel. The H-Bridge can take the over voltage but the PSU cant.
    I know this because I tried using a 24 volt motor on a 12 v system.

    Other annoyances will be button arrangements such as shifters and other controls that are used by the T500.
    They will have to be wired to the MMos board (button activation pulls logic level low, GND)

    I'll aim to post something in more detail same time tomorrow.

    Cheers
    • Like Like x 1
  10. Pit

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

    Joined:
    Oct 2, 2013
    Messages:
    3,013
    Location:
    Switzerland
    Balance:
    30,416Coins
    Ratings:
    +3,088 / 31 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    That's it, would be very interesting.
    I will use the VNH5019.
    I wouldn't do so, of course this makes no sense.
    I will still use the buttons of the T500RS which is still connected to the PC, but the wheel is disconnected from the board, this makes it easier for me.
    Thank you very much, your help is greatly appreciated.
  11. Alexey

    Alexey Well-Known Member

    Joined:
    Sep 23, 2014
    Messages:
    452
    Occupation:
    Electronics Technician
    Location:
    Adelaide, Australia
    Balance:
    8,060Coins
    Ratings:
    +620 / 2 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    Sorry with being so slow on this, struggling to find free time.
    • Funny Funny x 1
  12. OZHEAT

    OZHEAT Active Member

    Joined:
    Oct 26, 2015
    Messages:
    208
    Location:
    Australia
    Balance:
    2,458Coins
    Ratings:
    +106 / 6 / -0
    My Motion Simulator:
    3DOF, DC motor
    @Alexey
    Sorry for the late reply as I had a 2 week wait for internet due to damm cap.
    Before losing internet I had a chance to read a bit about microsoft's force feedback implementation (DirectInput).
    Although a bit thrifty on details of the functions, I can kinda understand what is happening.
    Wheel position is irrelevent to FFB.
    FFB constant force magnitude +/- 10000 with 0 being no force, -10000 max force left and +10000 max force right.
    This kinda reinforces what I think that the wheel would work better in a torque controlled mode.

    You posted
    I think you are misunderstanding what I mean by torque controlled mode and think I mean max current limiting.
    Using your example I can clarify.
    I don't want the controller to directly control the H-bridge with PWM. I want the controller to output a desired current(torque) value.

    Varing the duty cycle(PWM) which will give constant voltage but varing current depending on motor speed(stopped high current or moving lower current). You cannot control the current accurately as simply turning the wheel will change the current.
    Each PWM pulse will try move the motor at max current mainly because you are holding the wheel resisting the forces, from your earlier post you show this as being the speed/torque curve, what you posted is correct only at set speed. Say you have constant PWM of 75% which translates to ~9V for a 12V motor and 18 oz-in at 0 rpm, now if you start turning the wheel at the same time the torque value will be lower eg 9V 15oz-in @150rpm. Now do you still think you are controlling torque?

    What I want to do is the ffb directinput value as a current level value 0 - 10000 and direction.
    That 0-10000 value would be scaled to the motor's set max torque(10000) to min torque(1)
    Or max set current(10000) to min current(1)
    eg 10A@24V 1Nm stall torque
    max set current 10A@1Nm(10000) to min torque 0.05A @ 0.005Nm(1)


    sorry thats all I got time for tonight, damm slow typing...
    Cheers Andy
    • Informative Informative x 1
  13. Alexey

    Alexey Well-Known Member

    Joined:
    Sep 23, 2014
    Messages:
    452
    Occupation:
    Electronics Technician
    Location:
    Adelaide, Australia
    Balance:
    8,060Coins
    Ratings:
    +620 / 2 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    You are right that the the FFB controller doesn't care about wheel position but the physics engine does care. When turning a corner it is not as simple as the FFB strength being a set state, it is dynamic as the corner itself.

    That being said the loss of torque as you mentioned is almost negligible at such low rpm, to top it off you are turning the motor in the opposite direction to what it is being driven, effectively working as a brake because of magnetic forces constantly repelling that direction. You can try this out, take a car on a circular track like the test track in iracing and go a constant speed. You will notice the wheel has its FFB resistance and then as you turn the wheel in for a tighter radius turn it will increase it's resistance to you turning it. I have tested this on my bench top supply with a current display. I turn on the power but hold the motor in position, keeping it at stall and watching the current. As I counter rotate the motor the current increases, more than the rated stall current (this point proves the changing of the motor torque as you mentioned, only the torque seems to increase rather than decrease).

    Disregarding the above:
    If we were to look at the FFB response of both systems (PWM vs Current control) as you round a corner, the response curve would be almost identical (apart from counter rotation current spikes) between the two systems. In a linear situation I can understand how current control would increase the accuracy of the torque that is felt by the user but with forces being so dynamic, you will never actually feel the difference between the two systems.

    I'm not saying you are wrong or I am right, the current control system would be a smoother torque response. But at what effort would you need to go about implementing current control systems of very high current loads for minimal advantage over the standard PWM method?

    If you do find a way of implementing current control I would certainly be happy to test it all out. I'm not opposed to new ideas and I always try to do things outside of the box. I just need something substantial to push me through the boundary of not understanding something enough to think that it is viable.

    Cheers
    • Like Like x 1
    • Informative Informative x 1
  14. OZHEAT

    OZHEAT Active Member

    Joined:
    Oct 26, 2015
    Messages:
    208
    Location:
    Australia
    Balance:
    2,458Coins
    Ratings:
    +106 / 6 / -0
    My Motion Simulator:
    3DOF, DC motor
    Maybe this page from STM will explain, although aimed at a 3ph bldc the principle is the same.

    stm.png
    Basically, the current sense circuit acts as a PWM duty cycle manager in current mode while
    it acts as a maximum current limiter in voltage mode. The current loop allows a fine control of
    the torque by imposing the current in the windings.
    Voltage mode can be used when there is a high torque variation.
    • Informative Informative x 2
  15. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    15,650Coins
    Ratings:
    +1,009 / 9 / -1
    @Alexey and @OZHEAT, I believe you are both correct. My understanding is (although not confirmed) the cheaper wheels such as G25, G27 just use the PWM to drive the H-Bridge directly. As Alexey points out most of the time the wheel is at stall or close to so it is a reasonable approximation. However it will loose many finer details in the feedback signal as a result.

    I also believe (again not confirmed) that the more expensive wheels use true torque control feedback to maximise the detail that is driven to the wheel. I suspect this is one of the reasons they are reported to have "more detailed feedback"
    • Agree Agree x 1
  16. RacingMat

    RacingMat Well-Known Member Gold Contributor

    Joined:
    Feb 22, 2013
    Messages:
    2,234
    Location:
    Marseille - FRANCE
    Balance:
    20,895Coins
    Ratings:
    +2,084 / 21 / -2
    My Motion Simulator:
    2DOF, DC motor, Arduino
    I agree: direct drive wheels are torque driven by VSD or Argon or IONI drivers

    an other point about more detailed feedback is no clipping...
    about inertia comparison, I don't know if commercial wheels inertia are known...
  17. Alexey

    Alexey Well-Known Member

    Joined:
    Sep 23, 2014
    Messages:
    452
    Occupation:
    Electronics Technician
    Location:
    Adelaide, Australia
    Balance:
    8,060Coins
    Ratings:
    +620 / 2 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    Clipping is where the FFB goes to 100% force and unable to output any more detail in the FFB, That is not a control issue but incorrect FFB power level setting in the game.

    Ok so now I understand more about the current control. The only issue would be that someone would have to write up a controller or at least modify the MMos code to run a feedback loop. For now code is out of my domain.
  18. OZHEAT

    OZHEAT Active Member

    Joined:
    Oct 26, 2015
    Messages:
    208
    Location:
    Australia
    Balance:
    2,458Coins
    Ratings:
    +106 / 6 / -0
    My Motion Simulator:
    3DOF, DC motor
    @Alexey
    I'm a electronics hobbiest or more precise a hacker of electronics. More ideas than prac so sometimes I think "outside the box".
    I reread some of my earlier posts and I might have come across as non supportive and "I want to" for that I appoligize.
    I do believe you to be one of the best here to complete the controller, I just want to sway you in a different way.

    While the current control could be done in the stm32, MMos would need to program for it although I think he did plan to use cs but the Argon has torque control mode and that made it so the current control wasn't needed on MMos.

    Torque control done external to the controller MMos and motomonster h-bridge.
    While I could probally make the circuit learning along the way, I thought Alexey could implement a lot easier having the expertise , boards and equiptment on hand.
    stmmod.png
  19. OZHEAT

    OZHEAT Active Member

    Joined:
    Oct 26, 2015
    Messages:
    208
    Location:
    Australia
    Balance:
    2,458Coins
    Ratings:
    +106 / 6 / -0
    My Motion Simulator:
    3DOF, DC motor
    A- MMos PWM output.
    B- cap to avg pwm to give analog voltage
    C- comparator
    D- op-amp gain, adjust max amps
    E- Clock, this might be what mizoo mentions as motors time constant
    F- Latch? not sure what this is called but reset will block off the clock signal
    G- Input to H-bridge PWM
    H- CS low side current sense of H-bridge
    J- Dir from MMos to H-bridge
  20. Alexey

    Alexey Well-Known Member

    Joined:
    Sep 23, 2014
    Messages:
    452
    Occupation:
    Electronics Technician
    Location:
    Adelaide, Australia
    Balance:
    8,060Coins
    Ratings:
    +620 / 2 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    No need to apologize, you have a valid point.
    I'm certainly not the best here when it comes to electronics.