NEMA 17 stepper and l298 H-Bridge

I have fallowed multiple guides on how to hook power these motors through this board and have so far been unable to get to motor to do more than vibrate. These are my components and I am using the default stepper motor examples.

Motor Fact sheet: http://www.omc-stepperonline.com/download/pdf/17HS19-2004S1.pdf

Bridge: http://www.instructables.com/id/Control-DC-and-stepper-motors-with-L298N-Dual-Moto/

I am using 2 11.1V 20-30c LiPol batteries in series

Make a pencil drawing showing how YOU have connected everything and post a photo of your drawing.

Those batteries in series will produce 22.2v and your motor would quickly fry if you apply that to it. The L298 is not a good choice for a stepper motor controller because it does not have a convenient facility to limit the coild current to protect the motor.

You have not said what is the capacity of your batteries.

High voltages are a good idea with a stepper motor.

A Pololu DRV8825 would be a much better choice but it would be very much at its limit with a 2 amp motor. For that motor I would choose a driver that can handle 3amps or 5amps - but they are considerably more expensive. There are boards based on the Toshiba TB6560 but there are mixed reviews about their quality.

...R
Stepper Motor Basics

kestrel117:
I have followed multiple guides on how to hook power these motors through this board and have so far been unable to get to motor to do more than vibrate. These are my components and I am using the default stepper motor examples.

I too am using an L298N for driving steppers. I have no problems with L298N at all for my purposes. I apply pulse width modulation on the ENA and ENB inputs for setting a suitable motor voltage. The L298N provides adequate current to my motor. My own setup doesn't cause my L298N to get hot.

At the moment, I'm applying approximately 20% duty cycle for the PWM, with 490 Hz PWM frequency (or there-abouts).

I got some links to diode protection that I am using in my circuits, mentioned in:

http://forum.arduino.cc/index.php?topic=379829.msg2660107#msg2660107

The diode protection circuits shown in:

I made a video of the L298N driving the NEMA17 at:

The code I used for just making the stepper spin around 3 times in either direction with the MEGA 2560 (I modified Scott Fitzgerald's code) is shown below. Arduino MEGA Pin 9 controls In1 of the L298N, while In2 is an inverted version of Pin 9 (obtained via a logic inverter gate. Pin 10 drives In3, while an inverted version of Pin 10 (through an inverter gate) drivers In4. In1 and In2 relate to coil 1, while In3 and In4 related to coil 2. The logic inverter gates are inside the DIL-chip on the bread-board (shown in the video).

int analog_pin_2 = 2;
int analog_pin_3 = 3;

unsigned long timestart = 0;
unsigned long delta_t = 0; 
unsigned long now = 0;

// the setup function runs once when you press reset or power the board
void setup() {

  // initialize digital pins 9 and 10 as an outputs.
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);

  int myEraser = 7;             // this is 111 in binary and is used as an eraser
  TCCR3B &= ~myEraser;   // this operation (AND plus NOT),  set the three bits in TCCR3B to 0; the '3' is associated with timer #3
 
  int myPrescaler = 3;         // this could be a number in [1 , 6]. In this case, 3 corresponds in binary to 011.   
  TCCR3B |= myPrescaler;  //this operation (OR), replaces the last three bits in TCCR3B with our new value 010, prescaler = 2, giving 4 kHz PWM frequency.
  
  pinMode(analog_pin_2, OUTPUT);
  pinMode(analog_pin_3, OUTPUT);


  analogWrite(analog_pin_2, 50);
  analogWrite(analog_pin_3, 50);
  
  digitalWrite(9, HIGH);   //initialisation
  digitalWrite(10, HIGH); 
  delay(1000);  
  
  
}

// the loop function runs over and over again forever


void loop() {

  ccw(4, 150);
  delay(1000);
  cw(4, 150);
  delay(1000);
}

void ccw(int period_ms, int rev_num_by50) {
  while (rev_num_by50 > 0) {
  digitalWrite(9, LOW);   
  digitalWrite(10, HIGH);    
  delay(period_ms); 
  digitalWrite(9, LOW);   
  digitalWrite(10, LOW);    
  delay(period_ms); 
  digitalWrite(9, HIGH);   
  digitalWrite(10, LOW);
  delay(period_ms); 
  digitalWrite(9, HIGH);   //anti-clockwise sequence
  digitalWrite(10, HIGH); 
  delay(period_ms);
  rev_num_by50 -= 1;
  }
}

void cw(int period_ms, int rev_num_by50) {
  while (rev_num_by50 > 0){
  digitalWrite(9, HIGH);  
  digitalWrite(10, LOW);    
  delay(period_ms);           
  digitalWrite(9, LOW);   
  digitalWrite(10, LOW);    
  delay(period_ms); 
  digitalWrite(9, LOW);  
  digitalWrite(10, HIGH);    
  delay(period_ms); 
  digitalWrite(9, HIGH); 
  digitalWrite(10, HIGH);  
  delay(period_ms);
  //digitalWrite(9, HIGH); 
  //digitalWrite(10, HIGH);  
  //delay(period_ms); 
  rev_num_by50 -= 1;
  }
}
}

Southpark:
My own setup doesn't cause my L298N to get hot.

You have not provided a link to the datasheet for your motor. It may be very different from the OP's motor.

...R

Robin2:
You have not provided a link to the datasheet for your motor. It may be very different from the OP's motor.

...R

I use : 17HS19-2004S1
as well as : 17HS19-1684D

The L298N is meant to handle 25 Watt per output. If higher power handling is needed, then some other driver can be used.

Southpark:
I use : 17HS19-2004S1
as well as : 17HS19-1684D

Those numbers mean nothing to me - there are hundreds of different motors. Please post a link to the datasheets.

...R

kestrel117:
I have fallowed multiple guides on how to hook power these motors through this board and have so far been unable to get to motor to do more than vibrate. These are my components and I am using the default stepper motor examples.

Motor Fact sheet: http://www.omc-stepperonline.com/download/pdf/17HS19-2004S1.pdf

Bridge: http://www.instructables.com/id/Control-DC-and-stepper-motors-with-L298N-Dual-Moto/

I am using 2 11.1V 20-30c LiPol batteries in series

That motor is a 2A, 1.4ohm bipolar stepper - you cannot possiblt drive it with an H-bridge from 12V, its needs
current drive, not voltage drive, using a chopper-driver capable of 2A. You might get away using
1.5A or so with a DRV8825 run very hot.

Robin2:
Those numbers mean nothing to me - there are hundreds of different motors. Please post a link to the datasheets.

...R

The OP provided a link for the specs already. The 7HS19-2004S1 is the one I showed in the video, which is identical to the OP's model number.

Just indicating it is possible to use the L298N to drive a NEMA 17 stepper. Just depends on whether or not the power handling limit of the L298N is violated, which depends on what we're planning to do with the NEMA 17 in terms of power/torque etc requirements.

I was able to drop the motor voltage to values below 12V DC by applying PWM to the ENA and ENB inputs to the L298N. This is sort of like testing the NEMA 17 with a L298N by not using PWM, but manually reducing the 12V DC source voltage until both the motor and the L298N operate happily. If somebody requires extra power - more than 25 Watt per output, then they can use a different driver.

For those that just see vibration/oscillation or no movement with no physical load on the shaft on a NEMA 17 (for testing with L298N), then the issue is just a hardware error or a software step sequencing error (or both).

The L298 will drop about 4V in total trying to drive a 1.7A load, that's 7W (more than the motor
dissipates). I suspect you aren't putting more than about 1A into that motor kludging it like that.

A 1.7A low impedance bipolar stepper definitely needs a chopper driver like the DRV8825 or better.
Its not like they are hard to find or expensive these days either. You can run them off 24V and get
microstepping and half-decent speed performance too.

It all depends on requirements (purpose, performance etc). For those that just want to drive a stepper with an L298N dual H-bridge. It can be done. Although, it is beneficial to know the limitations, and what options we have - for either the L298N itself or other motor drivers - to achieve what is needed.

According to some posts - some hobby shops apparently sell L298N boards with stepper motors - giving some hobbyists the 'impression' that L298N is what they are meant to use to drive their stepper (although we know it's not ideal). In that case, one option is to just go ahead and use it. Test its ability and its limitations. Then, later, try a different kind of driver.

The basic issue is all the cheap steppers are high performance these days, so chopper drive is needed,
yet many dual H-bridge say they can drive a stepper motor without qualification that they mean 12V 40 ohm
stepper (which used to be commonplace I guess)