I'm trying to control a Nema 17 stepper motor with a L298N H-Bridge.

My wiring is as below (except I'm using a ESP8266 not a YUN, and I have a mains 12V supply rather than batteries). This is consistent with other tutorials I have found online. enter image description here

#include <Stepper.h>

const int stepsPerRevolution = 400;  // 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, D1, D2, D3, D4);

void setup() {
  // set the speed at 60 rpm:
  // initialize the serial port:

void loop() {
  // step one revolution  in one direction:

  // step one revolution in the other direction:

The issue I am having is that the L298N has it's RED LED on, until I actually try to move the stepper motor. As soon as I try to move it a single step the LED turns off and it takes a while for the board to come back online. I believe this could be an issue with the motor drawing too much current but I have no clue how to fix this.

Cheers in advance!

  • $\begingroup$ what is your question? $\endgroup$ – jsotola Feb 16 '19 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.