# Current chopping with an h-bridge and PWM

I have some stepper motors and L298N dual h-bridge drivers. I can't find exact specs for the steppers,* but similar motors from another product line have rated voltages from 2.64v to 5.8v. Since most power supplies don't come at these exact values, it seems current chopping is necessary.
*Minebea, the company that manufactured the motors, says the motors were part of a custom order, so they don't have specs.

I had the idea that open-loop current chopping might be possible with PWM from the controller board (in this case an Arduino). Since torque isn't much of an issue, it should run fine without needing to compensate for changes in the back EMF.

Using soft PWM I was able to generate a 20kHz signal and could have gone much higher.

On page 4 of a datasheet I found for the L298N it lists a bunch of delay times (e.g. "Source Current Turn-off Delay"). Those values should be quite relevant here. Page 2 also lists the peak output current for different time ranges. I have a bit of concern there because the max repetitive current is 2.5A. If I'm reading the bottom of page 3 correctly the total voltage drop is at least 1.8v. What might the drop be at a higher voltage, say 12v?

The question is, it it a workable strategy to run a stepper at high voltage (e.g. 12v) by chopping the current by switching the h-bridge? I've only seen a couple references to doing this (here and here), though neither fully answers the question. I want to be sure this won't fry either the h-bridge or stepper.

It is indeed a good strategy to chop the current from a higher voltage source (e.g. 12V) to feed a stepper motor. In fact, most integrated stepper drivers do it that way (have a look at DRV8825 datasheet for example).

For your information, what is usually done however, is that the stepper driver monitors the current through the windings and adjusts the chopping depending on this current. Using a fixed duty cycle (as you seem to plan to do) would result in less consistent driving of the motor (e.g. missing steps on high loads, ...). But it could still be acceptable depending on your application.

Now, regarding your doubts on the max current of L298. The current is not the peak pulse voltage divided by the resistance of the winding here. Because you are chopping at high frequency, the current will be smoothed by the inductance of the winding (which is what we want). So it is actually the average voltage (depending on the duty cycle) divided by the resistance. Therefore, if you have a 50% duty cycle, this makes 6V (not couting the losses), and you'll have a current of 1.5A. It seems you're fine.

Regarding the voltage drop question, it is specified for a supply voltage of 42V in the datasheet. But it should not depend on the supply voltage, anyway. It is more dependent on the load current. So I'm not sure I understand that part of the question.

• Thank you, that's very reassuring. I had mistakenly combined "steppers can be run at voltages much higher than rated" with "components only draw the current they need" to form the (obviously false) conclusion that I didn't need to worry about either! The voltage drop question was based on the idea that there would be less voltage through the motor winding, resulting in a lower current flow. In other words, I thinking about the effect of internal resistance. But I think it's not an issue based on your statement it is actually the average voltage ... divided by the resistance. – Nateowami Apr 25 '16 at 9:54
• Slightly related: Is there any advantage or harm in increasing the frequency? The 20k Hz is just a figure I read somewhere and hard-coded into my sketch. 200k Hz is probably about max the Arduino can do, and I kinda doubt the L298 could keep up. – Nateowami Apr 25 '16 at 10:02
• I didn't have a look at the switching time/frequency issues. But basically, if you switch too slowly, the current will not be smoothed enough. It depends on your motor inductance. And, if you switch too fast, you'll have more switching losses, and at a certain point, the driver will not even be able too keep up. Usually, stepper drivers use a switching frequency in the range of 20-50KHz. The datasheet of the L298 says typical 25KHz and max 40KHz. So choose, but I wouldn't go much higer that typical. – dim lost faith in SE Apr 25 '16 at 10:13
• OK, thanks. That makes sense. I'm new to reading datasheets, but not that you mention that I see it. – Nateowami Apr 25 '16 at 10:26

In the datasheet of the L298 see section "3. APPLICATIONS". In that section there are a few schemes described and schematically shown for current limiting by chopping.

The voltage drop of 1.8v min is the Vce(sat) of the internal transistors which will vary with current not necessarily with the voltage. This is the voltage you lose due to the less than perfect transistor switching.

The delay times listed on page 4 are switching delays of the internal circuitry. They are just the electrical characteristics of the device.

• Thanks. One of my main concerns was the –Repetitive (80% on –20% off; ton = 10ms) which was 2.5A. If we assume 4Ω for the stepper at 12v, that's 3A. Is it possible to calculate the approximate internal resistance of the L298n? I'm guessing there won't be a problem because I'd use a duty cycle closer to 25%, not 80%, and much faster (about 13μs rather than 10ms). I'm not positive the exact resistance of the motor winding because my ohm meter is broken (I got a rough measure with an Arduino, it should be at least around 4Ω I think). – Nateowami Apr 25 '16 at 7:47
• The equivalent resistance of the L298 can be estimated at a certain fixed current (per the data sheet), however this is an active part of the internal transistor and the equivalent resistance changes as the current changes. You can likely expect to lose about 2v internally so you could estimate the maximum current assuming about 10v on the motor. (As in the other answer, the current may not even reach this maximum due to the inductive effects and fast switching.) Lastly, you might add moderate value sense resistors (see data sheet) to further limit the current if you are worried about it. – Nedd Apr 25 '16 at 9:51