# Powering Stepper Motors Using Drivers

I am working on a project involving several stepper motors, I have chosen the L298N as the driver - and my system supply is a switching power supply 12V 15A.

My question is, how can I connect the 12V 15A supply to the L298N? I do understand the wiring and schematics but do not understand the power input to the driver itself.

I considered a buck converter but because I have 6x L298N's, I am struggling to understand how I can connect the 6x L298N's with 12V 15A Supply. It is clear 12V input is fine but 15A isn't? Any guidance would be appreciated.

The data sheets are here if needed: https://www.sparkfun.com/datasheets/Robotics/L298_H_Bridge.pdf https://docs-emea.rs-online.com/webdocs/157a/0900766b8157a734.pdf

• Measure the resistance of the coils of the stepper motor and tell me if you can push 15 A into it with 12 V across it. Feb 6, 2018 at 21:12
• @HarrySvensson I do not understand what you mean? I am asking is it possible for me simply connect 12V 15A straight to the L298N drivers? From what i understood, it isn't, so how would I go about this if I have 6 of them. Feb 6, 2018 at 21:16
• Can you just measure the resistance across the coils so we can teach you one thing or two about ohm's law? Feb 6, 2018 at 21:25
• why can't you hook them up directly? datasheet says it accepts up to 50v... Supply amp rating needs to be higher than load rating, and 15a is a lot. Feb 6, 2018 at 21:25
• You are confusing current consumed with available current that can be consumed.
– user105652
Feb 6, 2018 at 22:41

You are creating a problem that does not exist. You are confusing current consumed with available current that can be consumed.

The IC and motors will only draw the current they need. The motors are rated to operate at 2.5 amps maximum current, so your power supply has plenty of current to spare. Its 15 amp rating is how much it can supply if all six motors 'request' that much current at the same time, which totals 15 amps (6 * 2.5).

What you should do for safety reasons is put a 5 amp fast-blow fuse or a 3 amp MDL slow-blow fuse in series with each ICs power input. This way a stalled motor or shorted circuit will blow the fuse instead of burning up in a bad way, and shut down only one motor.

EDIT: If you really need current limiting then:

Each motor driver IC has a current sense pin which has a resistor to ground. The voltage at that pin tells you the current drawn by that motor. To avoid using a MPU and complex software, just buy a LM339 quad comparator and set its trip point for 1.5 amps (I do not know what voltage that will be, as it is determined by your sense resistor). Use a P-channel MOSFET on the power input of the IC so the LM339 can shut it off by letting the gate-source voltage drop to zero.

A current sense resistor of 1.00 ohms 3 watts will give a voltage of 1 volt per amp, or 1.5 volts per 1.5 amps. The power per each IC goes through the fuse first, then the P-channel MOSFET which drives the +Vs connection in figure 6 of your data sheet. Set the LM339 to have the output go 'high' if (+) input is greater than 1.5 volts. Use a trim pot to put 1.5 volts on the inverting (-) pins.

The motor control IC can be driven by any MPU with a few pins to spare.

• This was a very useful answer to my question. I do understand what you are trying to say, your tip for the fuses is also very helpful. I understand I won't be running these motors at their max rating, so how would i limit their current to 1.5A each? Feb 6, 2018 at 23:24
• @james: You missed the most important bit in Sparky's answer: "The IC and motors will only draw the current they need." LEDs are unique in requiring a current-limited power source - virtually everthing else will only draw the current it needs when given the appropriate voltage Feb 6, 2018 at 23:34
• The concept is ok but to the L298 is ill suited for 2.5V motor Feb 9, 2018 at 1:23
• I dont know where you are , but I have been a professional Engineer since 1975 in Canada. If my sincere advice has offended you. lets discuss in chat. Your comments are unprofessional Feb 9, 2018 at 1:59
• @TonyStewart.EEsince'75. No chat. If you think the L298 is the wrong IC for the job you should have posted it to the OP, several days ago. It was the OP's choice to use that IC. Don't penalize me for his choices.
– user105652
Feb 9, 2018 at 2:02

Oh, I thought there was only one link, but you had one link right after another. I only saw the first one. After closer inspection I see that the resistance of the motors is 0.9 Ω and their rated current is 2.5 A.

You can hook up the L298N straight to 12 V if you utilize some PWM signals. All MCU's are capable of generating PWM, I don't know which MCU you got in particular so I don't know how many PWM outputs you got, if you're lacking in that department then you can just make some from some timer.

Okay, so 12 V in, let's assume that the inductance of the stepper is around 5 mH, this means that the coil of the stepper will act like a low pass filter. And we want the current to be in the range between -2.5 A and 2.5 A. With 0.9 Ω resistance it means that the voltage across the coils of the stepper will be in the range between -2.25 V and 2.25 V.

$\frac{2.25}{12}=18.75\%$. This means that the duty cycle of the PWM that will go to one of your L298N will be between 0% and 18%. If you go above 18% duty cycle then you will go above the rated current and within minutes get some magic smoke. Or you'll just reduce the lifetime of the motor.

You will probably set this PWM signal through a byte, 18% × 256 = 48. So finally your PWM will go between 0 and 48. When the PWM is at 0 = 0% the voltage across the stepper will be 0 V. When the byte for the PWM is 48, the duty cycle will be 18% and you will have 2.25 V across your coil of the stepper motor.

One side of the H-bridge will go to the PWM, the other side of the H-bridge will go to some other pin of your MCU. When this pin is, say High, then when PWM goes from 0 to 18% you will have your output going from 0 V to 2.25 V. And then if you change your pin to the other one, say Low, then when PWM goes from 0 to 18% you will have your output going from -2.25 V to 0 V.

Here's some clever formulas:

$P=\frac{V^2}{R}=\frac{12V^2}{0.9Ω}=160W$ = smokey smokey, you cannot just connect the stepper straight to L298N and then to 12 V without any PWM.

$P=\frac{V^2}{R}=\frac{2.25V^2}{0.9Ω}\approx5.6W$=Nice, PWM saves the day.

I've tried to mimic the datasheet as much as possible. This is essentially how I would drive it. • The left graph is the duty cycle of the PWM (19% in this case).
• The middle graph is the PWM of that duty cycle
• The right graph is the voltage across the 0.9 Ω resistor, one of the coils of your stepper motor.

I couldn't care any less if this is too much math for you / if I'm drowning you with math. If you want to fry your stepper then that's fine with me.

Press the "This" link above, or this This, if you want to simulate the circuit in your browser (which I strongly recommend). Change the 0.19 V by scrolling, change the input by clicking on them. See what happens. And this is how it would look like for one piece of coil for having the stepper motor rotate. Look at that, a sinusoid.

Honestly, do whatever you feel is right.

• Does that mean I cannot use my motors on Digital pins from my micro controller? I am using the MBED FRDM KL25Z. Thank you for the answer. Feb 6, 2018 at 23:42
• I think you drowned the OP in too much math not relevant to his question. Sometimes simple hardware answers are what the OP wants. If the OP supplies a lot of math, then they want a math solution.
– user105652
Feb 6, 2018 at 23:47
• @james "Does that mean I cannot use my motors on Digital pins from my micro controller?", what makes you say that? Sure you can. Look here, you got 6 PWM pins. This means you can drive 6 coils in a good manner. Each stepper got 2 coils so 3 steppers. Or just get some external PWM. Either way, it's up to you. I'm off. Feb 7, 2018 at 0:14

Based on previous questions you have some motors with the following specs.

Current rating: 2800 mA
Voltage rating: 2.5 V
Resistance/coil: 0.9 Ohms

So using 12V supply with L298N as the driver with an approximate Vol/Iol resistance ratio on the driver about the same as the motor. ~1 Ohm which means the driver will be very lossy and have excessive voltage so PWM duty cycle ratio must be low.

James is there something you didn't like about this answer ? << 50% efficiency is not a good solution. Dont use L298's to drive this motor. They will dump 3 watts and burn up without a decent heat sink at rated load minimum and much more with excess Supply voltage (12 - 2.5V)

Do you have any new questions?