# Waveforms from a Popular L298N Stepper Motor Drive Module

I am having problems using an L298N module from eBay, sometimes called Qunqi L298N Motor Drive Board Module (The L298N H-bridge motor controller module - basics - YouTube). The driver program is the example code stepper_oneRevolution came with the Arduino kit. So I unhooked the motor and looked at the waveforms on the four pins where the motor used to be attached.

I found that the waveform on the pin #2 is always flat while the other 3 pins have square waves as expected. I thought I fried the board and order a couple of new ones, likely from a different vendor. When I got them, however, I found both of them also have the same flat line waveform on pin #2.

If I reverse the order of input pins “in1,in2,in3,in4” to “in4,in3,in2,in1”, then pin #3 shows zero volts. Also, I checked the input signals from Arduino pins 8,9,10,11. They all showed square waveform.

Is this by design? I thought one needs four square waves to drive a stepper motor.

If you don't post the code we can't see it. Telling us rough instructions for finding it isn't helping us as much as posting the code (in code tags).

OK. Here is the code

/*
Stepper Motor Control - one revolution

This program drives a unipolar or bipolar stepper motor.
The motor is attached to digital pins 8 - 11 of the Arduino.

The motor should revolve one revolution in one direction, then
one revolution in the other direction.

Created 11 Mar. 2007
Modified 30 Nov. 2009
by Tom Igoe

*/

#include <Stepper.h>

const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

void setup() {
// set the speed at 60 rpm:
myStepper.setSpeed(60);
// initialize the serial port:
Serial.begin(9600);
}

void loop() {
// step one revolution in one direction:
Serial.println(“clockwise”);
myStepper.step(stepsPerRevolution);
delay(500);

// step one revolution in the other direction:
Serial.println(“counterclockwise”);
myStepper.step(-stepsPerRevolution);
delay(500);
}

Also, I found the problem. One of the wires connecting the Arduino board to the motor drive module was broken inside. After fixing that, the project works as expected now.

Thank you all for your help!