Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PWM Current Control of a DC Motor

Status
Not open for further replies.

rdleslie

New Member
Hey Guys,

I've been working on developing a current controller for a DC Motor for quite some time now and I keep coming up to this same stumbling block.

I'm using an integrated H-bridge driver, I've tried the LMD18200t, and now im trying the L6205 from ST. In either case I am getting the same results.

I've tried both the sign/magnitude and also lock/antiphase methods for switching but I'm having difficulties because in my application I need to eliminate the feeling of damping torque caused by the motors back-emf.

Basically, when the motor is idle, and you back-drive the shaft with your hand, you feel a shaft-velocity dependent torque on the shaft opposing your hand. I want to eliminate this feeling all together.

On both the LMD18200t and L6205 for the OFF state it is possible to switch all of the mosfets off (using the enable logic input), and this will allow the motor to free-wheel in the off state. I've tried this, and the back-emf damping is no longer present.. although now the relationship between pwm-duty cycle and motor voltage seems to be thrown out of whack. I've found that I cant really start to see any significant voltage until close to 3/4 duty cycle, and in that last 1/4 duty cycle I get all the voltage increase.

I'm puzzled, especially since I've reproduced the exact same problem on two completely different parts.

My next test will be using a current sense resistor, which I've just tried on the high side supply.. but this measurement seems to be noisy.

Im wondering if I can use one of the two original control schemes, along with a current sensing scheme to actively eliminate the feeling of back-emf damping on the motor shaft?

cheers,

Ryan
 
What are you doing with the motor?

If you disconnect the motor wires completely does it freewheel ok then? I'm assuming your bridge with all the MOSFETs off will behave like the motor with no wires.

But when the MOSFETs are all off, why are you trying to do PWM? :eek: Please explain. :)
 
the OP said:
On both the LMD18200t and L6205 for the OFF state it is possible to switch all of the mosfets off (using the enable logic input), and this will allow the motor to free-wheel in the off state. I've tried this, and the back-emf damping is no longer present.. although now the relationship between pwm-duty cycle and motor voltage seems to be thrown out of whack. I've found that I cant really start to see any significant voltage until close to 3/4 duty cycle, and in that last 1/4 duty cycle I get all the voltage increase.

Particularly
the OP said:
the relationship between pwm-duty cycle and motor voltage seems to be thrown out of whack

A reminder, that if your measuring the PWM waveform, you need to use a True RMS meter with the appropriate frequency response to get meaningful numbers. ie. a 50% duty cycle at 10 V would read proportionally, or 5 volts, otherwise your meter will read somewhat garbage.

Since the driver is likely operating in Brake mode in one of your conditions, this means that the DC motor is acting as a generator into the load of the MOSFETS in the H-bridge.

The above makes no sense.

An H-bride" driver can have 3 modes, Brake, fwd, rev and free wheel.
 
Last edited:
The enable should solve your problem (at least with the 6205). It almost sounds like enable is not back on at the correct time. How is it controlled?
 
Hey Guys,

I'm measuring each motor terminal relative to ground with two channels of my oscilloscope. I can subtract these two waveforms to see the absolute voltage over my motor terminals.

To verify that the LM18200t, or 6205 are operating properly.. I drove them in the lock/antiphase method and verified with my scope waveforms that I was getting the correct switching on my motor terminals. These waveforms all seemed to be correct. So I can assume that I have my circuit at least working for typical operation.

I actually also have two 15uH inductor in series with the motor terminals connecting to the motor wires, I was told this helps protect the brushes on my DC motor.
 
On the 6205 there seems to be 5 states for the mosfet switches, four with the bridge enabled, and one with the bridge disabled. The four Enabled states are; ON (forward current through motor), ON (reverse current through motor), OFF (low side switches brake motor), OFF (high side switches brake motor). The single Disabled state is OFF (all switches disconnected)..

In this final Disabled-OFF state the feeling on the motor shaft is as if its leads were left floating, it freewheels.
 
It might be more instructive to try and explain what Im trying to achieve without any reference to the actual controller hardware.

I want to feel only two torques on the motor shaft. 1) the torque caused by friction in the motors bearings that is always present 2) A commanded torque produced by the motor. In the second torque I want to be able to specify in software a desired shaft torque, and have the shaft of the motor produce that torque.

The problem I am having is that I can set my PWM duty cycle (different depending on pwm-scheme) such that no current/torque is being supplied to the motor. In this case I am commanding zero torque to the motor. But when I move the motor shaft I feel a torque caused by the back-emf of the motor... so I am actually feeling a torque that I have not commanded.

I know this back emf is caused when the motor terminals are shorted together (or in the braking states of the H-bridge). So I've postulated two possible solutions 1) eliminate the brakeing states and only use the disabled-freewheeling state and ON states.. 2) keep using the braking states but instead use a current sense resistor and a microcontroller to actively compensate somehow for the back-emf... in essence always control the back-emf to zero.

I've got the 1st solution working on the LMD18200t.. but it has some bad side-effects.. and I am clueless at the moment on how I would do the 2nd scheme
 
Thanks for provided the information, now it makes more sense what you are doing. :)

If you want to produce a constant torque at the motor shaft you need to measure the torque using a strain gauge etc and use a closed loop system to keep the torque constant. As that is hand to implement, you can get a useful enough result from applying a constant current to the motor winding. You need to use a closed loop system to measure the motor current (and NOT voltage) and then control the h-bridge accordingly. (You may still need to turn the hbridge off to get a very low (or zero) torque value.)

Probably what is probably happening with your circuit now is the PWM driver (which is voltage controlled) is sensing a generated voltage when you turn the motor by hand and is then applying reverse power or braking in response.
 
Last edited:
I have felt similar systems in the past where no strain gauge was needed on the output of the motor shaft. But this was using a linear current amplifier with a closed loop control on the current sourced to the motor. I do know that PWM type solutions without an output strain gauge also exist.

You mention a closed loop system to measure motor current. I have a question regarding that;

Is there a proper place in the circuit to place my sense resistors such that I can properly measure the current generated by the motors "back emf"?

If I could measure that current.. a closed loop controller could monitor the current, and adjust the pwm duty cycle accordingly to compensate. Also, because there is a ripple in the current.. is it very important to have my sampling in sync with my pwm frequency?

Anyone ever implemented a system like this?
 
I found a patent online where a fellow is putting a sense resistor in series with the motor. He then measures both the total voltage drop over the motor terminals, and the voltage drop across this sense resistor.

He can use this to estimate the back emf.. are there other ways to do this?
 

Attachments

  • Vemf measurement.png
    Vemf measurement.png
    16.1 KB · Views: 338
Also, because there is a ripple in the current.. is it very important to have my sampling in sync with my pwm frequency?

No. The inductance of most motor windings does a pretty good job of smoothing out the current. Some filtering is still in order though. You're likely switching enough current to introduce noise without a solid ground and decoupling.
 
You don't need to be concerned with back EMF or forward EMF for that matter. Just measure the (filtered) current and keep it constant.

It's not hard to filter the high frequency PWM ripple with an aggressive filter, as you load is generally quite slow (as is motor inertia) so just filter the current feedback signal and use it to control the PWM.
 
You don't need to be concerned with back EMF or forward EMF for that matter. Just measure the (filtered) current and keep it constant.

It's not hard to filter the high frequency PWM ripple with an aggressive filter, as you load is generally quite slow (as is motor inertia) so just filter the current feedback signal and use it to control the PWM.

So I should just try and measure the voltage over a sense resistor on the low side of my driver? I do have some 1 ohm, 3 watt resistors handy. I guess ideally (if I had the parts) I could also use a much smaller resister value (like 0.1-0.3 ohms), and then use some sort of difference amplifier to boost that signal up to voltage input range of my dsPIC's A2D converter.

I guess I can filter this signal with a small cap, and see how it looks through my scope. After I do this, I'll post some images of my scope so you guys can see what the signal looks like.
 
Here are some waveform results from my scope.

In this experiment Im using locked-antiphase pwm, so 50% duty-cycle commands no current to the motor. I've shown the voltage measured at motor terminal B. Terminal A's voltage is just the opposite of this waveform.

I've put two 1 ohm sense resistors in parallel (so 0.5 ohm equiv) out of the senseA output of the L6205 (which comes out of the bottom side of the bridge to ground).

The second scope image is the voltage measured over these sense resistors. One problem with this measurement is it gives me no information about the direction of current flow.. as shown.. you see the waveform at roughly 50% duty (so zero net current).. the second half of the waveform should actually be reversed.. because the current is flowing the opposite way through the motor. Its just that I cant distinguish direction when measuring at the bottom of the bridge.

Also.. when a voltage in the motor is generated due to back-emf will I be able to sense this with my sense resistor at the bottom of the bridge?

Note: using 10x scope probes.. so 1V division is actually 10V... my supply voltage to the h-bridge is 18V
 

Attachments

  • voltage at motor terminal B.jpg
    voltage at motor terminal B.jpg
    1.2 MB · Views: 329
  • current sense resistor voltage.jpg
    current sense resistor voltage.jpg
    1.2 MB · Views: 293
Last edited:
You need to add an RC filter (integrator) after your current sense resistor so you get a nice stable DC feedback proportional to current.

You won't need to measure current in the reverse direction ever, unless you need to generate a reverse torque by applying a reverse current.

You won't need to sense back EMF or try to control it in any way. The torque produced by the motor is (roughly) based on the current through the motor so just keep the current constant.

If you say what this is actually FOR it would help people enormously in suggesting ways to go about it...
 
I am using this for a force controlled knob that a user can interact with. I want to be able to control the feeling of torque applied to the knob so I can apply different force sensations to the users hand.

One thing I have found that partially works.. I've put a 0.5ohm shunt resistor in series with my motor similar to that schematic I posted a few posts earlier. I measured this current using two ina168's (one for forward current, and one for reverse current). These little current monitor chips provide a nice analog reference signal that is proportional to my current output. I then fed both of these through the A2D of my microcontroller... subtracted the two signals.. and now I have a nice current reference in my software.

This somewhat worked.. my problem is signal noise. I used these signals as my reference for a proportional current control loop, but they are noisy enough that I hear a gritty kind of white noise sound coming from my motor. I tried different capacitors to clean up the signal, but have had no luck.

I guess the fact that im doing all this on a breadboard doesnt help either!
 
Im looking into this link here for ideas (this is basically what I am trying to accomplish).. that being the measurement of CUR+ and CUR-

**broken link removed**
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top