The mainboard of my Driving Force GT died. As I have already modded the pedals for my training bike project, I thought it might be a good opportunity to go all the way and salvage the parts for a custom controller. The sensing part should be easy enough to emulate with a Pro Micro, as the rotary encoder is still working, the buttons almost (there are so many I would need some kind of multiplexer). What I have a problem with is the force feedback part...
I never fancied the FF effects provided by the games, so I have no need for those. However, what I would like to have is some (constant) resistance on the wheel, as now it is much too loose. I also would not mind getting the wheel to return to the middle position, as it is a nice feature to have.
I have looked at various similar projects (and there are quite a few), but they seem to be very light on the details as far as the software is concerned. They either use proprietary boards, use binary firmware or do not describe it at all.
So I would be grateful for the basics: how could the resistance be obtained with a DC motor and an encoder? Some sources mention an H-bridge (I have a L298N, if that helps), but how to use that specifically?
To generate controlled torque you need a motor controller with current sensing, and a feedback loop like
a PID loop that works from that current sense signal - current is proportional to torque in DC motors.
If you want to use a motor, then I would not bother with the current feedback. The RPM is close enough to zero that the motor will have a pretty constant relationship from input PWM to output torque.
Thank you for both answers, they have pointed me in the right directions!
It seems both solutions are used: for better, more precise (and expensive) controllers current sensing is used. Cheaper controllers seem to use PWM only. I suppose my wheel was one of the cheaper ones.
I want to use the motor, as I already have it assembled - only the board is faulty, the mechanics remain the same. Besides, I am somewhat used to the feel...
If I understand it correctly, to obtain resistance, I have to sense the direction of the rotation and counter it with the appropriate torque? Or is the braking force of the H-bridge sufficient for that?
One more question: I have no idea how much current the motor might take. Would the power supply nominal values (output 24V, 0.75A) be sufficient to determine that?
Yes you can put the H-bridge in braking mode but then it acts as a damper. More resistance for higher speed. At zero speed the braking effect is zero.
Since you already have the thing dismantled, you can test braking for yourself. Spin the wheel with the motor disconnected. Now connect the two wires on the motor to each other. (An alligator-clip test lead is useful here.) Spin again. You will notice significant resistance. This works with any DC motor, including brushless ones.
For a centering force like a spring, you just need to read the position and then apply an analogWrite() value proportional to the distance from center.
It would be reasonable to assume that, with that power supply, the motor will be good with 24V and just a little less than 0.75A. That's not 100% guaranteed but it's unlikely to be using any fancy switching power supply to run the motor at a lower voltage.