Author Topic: How to control dc motor torque using H Bridge?  (Read 4011 times)

0 Members and 1 Guest are viewing this topic.

Offline lion032Topic starter

  • Newbie
  • Posts: 2
  • Country: il
How to control dc motor torque using H Bridge?
« on: November 13, 2018, 09:20:42 am »
Hi all!

I am working on a force feedback yoke for my home cockpit and I am trying to understand how to control the motor torque using current sensing.
I found the following of the motor driver that was used in the Microsoft Force Feedback stick.
http://www.simprojects.nl/ms_siderwinder_ff2_hack.htm
Being a programmer I am struggling to figure out what is going on in the attached schematic.



Thanks in advance,
Leon.
 

Offline max_torque

  • Super Contributor
  • ***
  • Posts: 1279
  • Country: gb
    • bitdynamics
Re: How to control dc motor torque using H Bridge?
« Reply #1 on: November 13, 2018, 02:40:24 pm »
1) Broadly (in beginner terms) for a motor, Current = Torque and Voltage = Speed of that motor.  So to control motor torque you need to control motor current.

2) The current that gets driven through a motor depends on 3 things (broadly speaking, don't write in to point out that there's lot of other more complicated things going on.....!!)  a) the voltage you apply to that motor (supplied by the motor driver)  2) the Backemf of the motor (the voltage generated by the motor vs it's rotational speed and c) the impedance of that motor (a mixture of inductance(AC) and resistance(DC).

3) Generally therefore, you'll need to measure the current that is being supplied to the motor, and use some form of closed loop controller to apply a suitable drive voltage to the motor to drive the current through it that you want.  Remember though that a motor acts in 4 quadrants!  (Forwards motor, Forwards generate, Reverse motor, Reverse generate) so your current sensing and driving may need to both be bi-polar


In the case of a force feedback steering wheel, the motor speed (and hence Backemf) is proportional to the wheel speed (how fast you are turning it) and the steering wheel torque to the current flowing through the motor.  For example, to generate a fixed constant torque, you'd need your driver to apply a voltage that is maintained at a fixed delta above the backemf, and that of course therefore depends on the speed of turning!


The circuit you posted shows current sensing being done at the Bridge common ground reference. This is done to make it simple (no requirement for high side current sensing), the down side being two sets of current sensing parts are required.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: How to control dc motor torque using H Bridge?
« Reply #2 on: November 13, 2018, 03:37:49 pm »
As I understand it, the motor is being used as a brake.  It doesn't rotate in the conventional sense, rather, it makes the wheel harder to turn.  More to the point, it can make the wheel harder to turn in one direction than the other.  This would attempt to match the dynamics of steering a real car.

Both braking functions  (left and right) have their own current feedback.  The inputs are going to be PWM signals, low percent of on time yields low torque, full on time is going to provide stiff braking.  In software, some bit of code determines how much torque should be applied in each direction (control signal) and the motor feeds back how much torque (current) is being applied and the PWM code does its thing with the pulse width.  A pair of PID loops but I don't imagine they bother with anything more than the Proportional function.  Integral and Derivative would seem to be overkill.

I would expect a car in a situation with left hand oversteer (the back end is stepping out to the right) to be easier to steer to the left (increasing the oversteer) than to the right.  In a real car, we mitigate that difference by using power steering and lose some sense of pending oversteer or understeer.  Understeer happens when the front end breaks free and moves outside the turn radius.  Oversteer is fun, understeer, not so much. Basically, the car isn't responding to steering wheel input.

Given that, I guess I expect the motor to be running left and right at the same time with a potential unbalance in their torque in each direction.

I would use a scope and look at the PWM signals while playing a game.
« Last Edit: November 14, 2018, 11:46:44 pm by rstofer »
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: How to control dc motor torque using H Bridge?
« Reply #3 on: November 13, 2018, 05:51:20 pm »
It's obvious that both the right and left drive signals can't be high at the same time, same as with any H-bridge.  In applying asymmetric braking, the signals could be interlaced in such a way that the motor turns left for one pulse and immediately turns right for the other pulse and each pulse could provide a different current.

I'm not sure this is what is intended.  I'm just guessing and the reason I am guessing that braking is asymmetric is that there are two sense resistors when one would do the job if the drive signal only went in one direction for a relatively long time.  Not interlaced, so to speak.

I would really like to see how the controller works.  I would love to get a scope or logic analyzer on the drive signals.
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 5870
  • Country: de
Re: How to control dc motor torque using H Bridge?
« Reply #4 on: November 13, 2018, 08:58:41 pm »
There's a lot wrong with that circuit. Power transistors with the same part number are depicted as both N- and P-channel, the drive circuit is ridiculous etc.
But the OP states it's Microsoft, knowing their software it could be real. :-DD

 

Offline HwAoRrDk

  • Super Contributor
  • ***
  • Posts: 1476
  • Country: gb
Re: How to control dc motor torque using H Bridge?
« Reply #5 on: November 13, 2018, 10:50:07 pm »
There's a lot wrong with that circuit. Power transistors with the same part number are depicted as both N- and P-channel, the drive circuit is ridiculous etc.

Jokes on you, that part number is a P+N channel mosfet pair. :P
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: How to control dc motor torque using H Bridge?
« Reply #6 on: November 14, 2018, 05:15:42 am »
As I understand it, the motor is being used as a brake.  It doesn't rotate in the conventional sense, rather, it makes the wheel harder to turn.  More to the point, it can make the wheel harder to turn in one direction than the other.  This would attempt to match the dynamics of steering a real car.


That's not how any force feedback game controller I've used works. They all drive the motor to apply torque to the wheel, done well you can feel all the little bumps on the road. The best example of force feedback I've ever seen was in the Atari arcade games Hard Drivin' and Race Drivin', however even many of the consumer force feedback steering wheels are quite good. The key is to have a powerful motor with nice tight gearing to the wheel. The rest of the magic is in the game software itself, some do a much more convincing job than others.
 

Offline max_torque

  • Super Contributor
  • ***
  • Posts: 1279
  • Country: gb
    • bitdynamics
Re: How to control dc motor torque using H Bridge?
« Reply #7 on: November 14, 2018, 06:28:35 pm »
The motor obviously rotates as it is attached to the steering wheel!  And as it rotates, it DOES generate a Backemf (otherwise it is breaking the laws of physics, and even for microsoft, that'd be reasonably difficult......).  So if you want to control torque precisely, then your control system has to apply a forwards voltage to the motor that both exactly compensates for the Backemf and drives the current to the value you need to meet your torque demand!

A lot of these circuits use a locked antiphase drive strategy (google it) where they apply forwards (rotationally speaking) then backwards voltage at a sufficiently high frequency for the electrical inductance and the mechanical inertia of the motor to low pass filter that current ripply to a low enough value as to be imperceptible.  Modulation of that ON/OFF time is then used to bias the torque in a forwards or reverse direction.

 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: How to control dc motor torque using H Bridge?
« Reply #8 on: November 14, 2018, 10:24:51 pm »
The motor obviously rotates as it is attached to the steering wheel!  And as it rotates, it DOES generate a Backemf (otherwise it is breaking the laws of physics, and even for microsoft, that'd be reasonably difficult......). 

How much does the motor rotate as I attempt a land speed record at Bonneville Salt Flats, Utah?  The point being that the wheel is often held stationary for long periods and the motor does not rotate and back-emf is a non-issue.  But the motor is still energized to achieve braking.

Given no back-emf, the current is only limited by the applied voltage and the armature resistance and this is a very good reason for having current feedback.  Something has to prevent the motor from burning up since the stalled rotor current will be several (or more) times higher than nominal full load current.




 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: How to control dc motor torque using H Bridge?
« Reply #9 on: November 14, 2018, 10:53:01 pm »
It operates like a servo, the drive current through the motor is modulated as needed to apply torque to the wheel depending on what the game is doing. It's a closed loop system that monitors the position of the wheel and responds to the user applying torque to the wheel, and the software instructing the wheel to apply torque to the user. Done well it feels very much like driving a real car, it's far from just behaving like a brake, there is a dynamic force that will try to center the wheel.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: How to control dc motor torque using H Bridge?
« Reply #10 on: November 14, 2018, 11:51:24 pm »
There's a lot wrong with that circuit. Power transistors with the same part number are depicted as both N- and P-channel, the drive circuit is ridiculous etc.
But the OP states it's Microsoft, knowing their software it could be real. :-DD

The HAT3004R device contains both a P and N channel device.  Note parts IDs Q1 and Q1' - they are in the same package.  Same for Q2 and Q2'.

http://www.ic72.com/pdf_file/h/564630.pdf

I'm guessing that the NPN transistors could be 2N2222A but I don't know that.  I also find it odd that the designers added capacitance to the MOSFET gate capacitance ad then used a very low value series resistor to overcome the capacitance (27R).  I'm thinking they truly fine tuned the potential for punch through.

It's actually a pretty clever circuit.  I have a wheel around here but I don't know if it has force feedback.  It would be worth looking at.

 

Offline lion032Topic starter

  • Newbie
  • Posts: 2
  • Country: il
Re: How to control dc motor torque using H Bridge?
« Reply #11 on: November 15, 2018, 07:15:29 am »
Got it!

Thank you very much!
 

Offline max_torque

  • Super Contributor
  • ***
  • Posts: 1279
  • Country: gb
    • bitdynamics
Re: How to control dc motor torque using H Bridge?
« Reply #12 on: November 15, 2018, 06:58:57 pm »
The motor obviously rotates as it is attached to the steering wheel!  And as it rotates, it DOES generate a Backemf (otherwise it is breaking the laws of physics, and even for microsoft, that'd be reasonably difficult......). 

How much does the motor rotate as I attempt a land speed record at Bonneville Salt Flats, Utah?  The point being that the wheel is often held stationary for long periods and the motor does not rotate and back-emf is a non-issue.  But the motor is still energized to achieve braking.

Given no back-emf, the current is only limited by the applied voltage and the armature resistance and this is a very good reason for having current feedback.  Something has to prevent the motor from burning up since the stalled rotor current will be several (or more) times higher than nominal full load current.

The motor rotational speed is clearly the steering wheel angular velocity multiplied by the physical gear ratio between the two components.  To get a high steeringwheel torque, you either need a high turn count motor (high KT, but also high KE as a result) or a low turn count motor (low KT & KE) driving the steering wheel though a significant gear reduction, which, guess what, ends up with the same effective KT/KE !!

No way are you going to get anything like realistic force feedback if you fail to consider the most important characteristic in the system....

(the good news, is that if you use a current control topology (in hardware or software) then you get the Bemf compensation for free, the issue simply becomes one of control bandwidth and accuracy)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf