Unipolar stepper motor with L298N Driver works fine for seconds then fails

Good morning everybody,

I would like to expose my problem connecting stepper motors and a L298N bridge. I'm trying to connect my Arduino Yún to a unipolar stepper motor (I've tried both unipolar as bipolar and bipolar versions) through a L298N bridge like this: |500x500

I'm following this schematics |500x477

And using a 12V / 8.5A power supply connected to the bridge (with a 4700uF capacitor) and my computer to power the Arduino. Both grounds, Arduino and the bridge are connected. I'm using basic stepper code from Arduino library.

The result: it works for 10-15 seconds aprox, then starts failing, losing steps, stops turning and doing weird noises. Obviusly, I don't let it doing it for more than some seconds. As you can expect, the bridge gets hot as hell (untouchable)

My bet is with the 8.5A current. I had tried previously with a 12V / 5.5A one and same happened.

I'w really appreciate some guidance here, I'm a total noob and this is my very first Arduino project.

Thanks in advance

If you use a motor shield to drive a stepper:

1) You won't get much speed from it - 200rpm tops 2) You must use a motor with high impedance windings such that IxR = supply voltage

What winding resistance is you motor? If its less than about 40 ohms it will not work as you intend from 12V as the current draw will be excessive - this seems to be what's happening, the motor driver is overheating and shutting itself down.

Normally with bipolar motor you use low impedance windings and drive with constant current driver. This allows much faster rotation speeds and better torque curve as you can simply increase the supply voltage for faster top speed.

10 years ago high impedance unipolar motors were more common, now they are rare, expensive, and bipolars rule (which means you need a stepper driver not a motor shield).

You need to post a link to the datasheet for your motor. My guess is that the L298 is overloading and shutting down.

Your diagram seems to be for a bipolar motor.

...R Stepper Motor Basics

Hi guys, thank you both for your answers. I have been here for a while now and know about your knowledge.

First things first:

1) I was misguided to buy that driver to use with stepper motors. Now I know that the Pololu A4988 fits much better for my project.

2) This is the datasheet info of my stepper. As I can see, resistance is 1.5 Ohm per phase. Is that the same as "per winding"?

Since the driver was getting SO hot (also the motor) it totally seems that is a overheat problem.

Now my doubt: is it possible to run a stepper with that driver? What voltage / current?

Thanks!

If you ignore the centre connections to the two coils that can be operated as a bipolar motor.

I can't figure from the datasheet if the 1.5 ohms is measured between an end and centre tap on a coil or between the two end taps. You should measure it with your multimeter.

It is obviously designed to take 2 amps and that is really outside the practical range of an A4988. The Pololu DRV8825 has a little more capacity. If you need the full 2 amps I think both drivers would need heat sinks and maybe fans. The problem is that if you go for stepper drivers with more current capability there is a big jump in price. There is a Toshiba TB6560 chip that can handle about 3 amps but there have been suggestions of poor quality control in driver boards that use it.

Is your comment "Since the driver was getting SO hot" referring to the L298 or the A4988 ?

It is normal for the motor to get hot - uncomfortable to touch.

...R

GrauchoMarx: Hi guys, thank you both for your answers. I have been here for a while now and know about your knowledge.

First things first:

1) I was misguided to buy that driver to use with stepper motors. Now I know that the Pololu A4988 fits much better for my project.

for a low-impedance stepper, yes.

2) This is the datasheet info of my stepper. As I can see, resistance is 1.5 Ohm per phase. Is that the same as "per winding"?

depends if its intended to be used as unipolar (4-phase) or bipolar (2-phase) - 6 wire motors can be either. You get a multimeter and measure it yourself to know for sure (always worth doing with a new motor just in case its faulty or the wrong winding resistance).

Since the driver was getting SO hot (also the motor) it totally seems that is a overheat problem.

Now my doubt: is it possible to run a stepper with that driver? What voltage / current?

As has been said DRV8825 is a little pokier than the A4988 - 2A is a bit too much, try it at 1.5A and see if its enough (motor will run cooler).

For high current steppers 2A+, discrete motor driver design is necessary - cheapest commercial unit I've seen is http://www.pbhonline.in/products/psd-5042-2p?utm_medium=cpc&utm_source=googlepla&variant=1089571764&gclid=CLiJr4qB7cgCFVAljgodNxIBzA (But cannot personally vouch for it).

There is also the DRV8711 module: http://www.ti.com/tool/boost-drv8711, but that needs to be programmed over the SPI bus before it works.

Hi again, guys. Thanks for your answers.

If you ignore the centre connections to the two coils that can be operated as a bipolar motor.

Yep, I was doing that.

Is your comment “Since the driver was getting SO hot” referring to the L298 or the A4988 ?

I meant the L298N. The A4988 ran much cooler and smoother.

In the end we are going to use Nema17 at 1.7Amps/phase. These ones
We didn’t wanted to use unipolar steppers, as I told you, I was badly recommended (and being such a noob…)

What do you guys think about the Nema17 A4988 combo? It is not supposed to need neither big torque nor rpms.

Thanks!

The little A4988 and DRV8825 driver boards are commodity items these days (ultra cheap on eBay if you trust that source), and will get high performance if needed.

If you don't need any performance a high-impedance unipolar stepper can be driven from an ULN2803 (like the little boards that come with the 28BYJ-48 mini-steppers). High impedance here means about 48 ohms for a 12V NEMA17 motor. However you don't get microstepping either that way, which can be a problem (vibration).

I suspect chopper-drive and low impedance 4-wire bipolar steppers are becoming the universal standard. Lots of old projects on the internet haven't caught up with this changeover (which is why a lot of motor shields claim to support steppers, but only work with rare high impedance steppers).

MarkT: I suspect chopper-drive and low impedance 4-wire bipolar steppers are becoming the universal standard. Lots of old projects on the internet haven't caught up with this changeover (which is why a lot of motor shields claim to support steppers, but only work with rare high impedance steppers).

Isn't it always like this? My only remaining doubt (I was intended to try): would the stepper work better with a smaller power supply? Or batteries? Anyway, I think I may have my correct setup now. I need to test it now.

I will let you know.

Thanks again!

For batteries I'd strongly suggest avoid steppers if possible - they consume lots of power when stationary, other motor types don't.

Aaaaaaalright! It was intended only to test, in order to avoid high voltage / current.

Another thing, I am testing endstop switchers to stop the stepper. I have connected one to A0 input and did some tests. It works. So my doubt is: what is the 10K resistor for?

Thank you guys!

GrauchoMarx: what is the 10K resistor for?

WHAT 10k resistor ?

It is usual to use a pull-up or pull-down resistor to ensure the I/O pin "rests" in a known state. Otherwise the value seen by digitalRead() could vary randomly between HIGH and LOW.

You can use pinMode(pin, INPUT_PULLUP); to use the Atmega's internal pullup resistor.

...R

Nice, thanks!

I'm using analog inputs since I'm running out of digital pins. My idea is setting a while to return the motor to the origin position.

Analog pins can also be used as digital pins. A0-A5 are D14-D19.

Obviously, that's going to be useful for me, so that way I don't need to set dirty analog comparisons when I am not needing the analog values at all.

Thanks!!

Hi GrauchoMarx,

I am late to this discussion but checking the motor and H-bridge datasheets it appears as if:

  • The L298N does not appear to have built in current limiting.
  • It provides a current sense and enable for external regulation with PWM using the EA inputs (note: you have tied them to Vcc).
  • With this set up you would need to use external ballast resistors for each phase (1.5 ohm 6w for a 6v supply or 4.5 ohm at 24w for 12v).
  • I think you should to provide a 25% duty (at 12v) or 50% duty (at 6v) PWM to the EA pins if you don't use ballast resistors.
  • The suggested frequency for the PWM is at least 8 kHz.

I hope this helps, regards Alan0

Alan0: It provides a current sense and enable for external regulation with PWM using the EA inputs (note: you have tied them to Vcc).

Stepper motors do not work with PWM in the way that a DC motor does.

Building the external circuitry to limit the current provided by an L298 sounds like hard work compared to using a specialized stepper motor driver. A specialized stepper driver can limit the current in every single step movement separately.

...R

Robin2: Stepper motors do not work with PWM in the way that a DC motor does.

Building the external circuitry to limit the current provided by an L298 sounds like hard work compared to using a specialized stepper motor driver. A specialized stepper driver can limit the current in every single step movement separately.

...R

Hi Robyn2,

Yes easier to use a board with built in PWM but these board can be used for steppers and people want to use them(?).

If your using 12 volt power supply and your motor voltage is 2.4v then a PWM duty of 20% (on the EA inputs) will work fine. No need for current sensing or feedback loops etc.

The real headache is you need a fairly high frequency (say 20kHz), so the analogWrite just will not cut it.

So that means learning how to write Timer and ISR code. But then is this not what the Arduino is all about?

Regards Alan0

Alan0:
If your using 12 volt power supply and your motor voltage is 2.4v then a PWM duty of 20% (on the EA inputs) will work fine.

My knowledge of the dynamics of inductance and back EMF is far too inadequate to allow me to comment on that.

My understanding is that a specialized stepper driver tests the current during the course of each step and only interferes when it reaches the limit.

…R

PWM duty cycle is only linearly related to output drive if you use synchronous rectification mode, not the normal decay modes. Standard decay modes are not linear in response.