Stepper Motor - not turning

(Apologies if this has been posted before but i am at a loss and looking for advice as to whats wrong)

Running ESP8266(LiLon NodeMCU V3)

Followed this guide:

This is the setup



And it just wont turn, check everything over and over and the website loads and click the buttons fine it shows in the Serial Monitor, only thing i have found is everything's getting hot like 70C + is that normal for a ESP8266?

Here is the code,

/*****************************************************
 * Date: 9 july 2018
 * Written by: Usman Ali Butt
 * Property off: microcontroller-project.com
 * ***************************************************/
#include <ESP8266WiFi.h>
 
const char* ssid = "";
const char* password = "";

int Step = 5; //GPIO0---D1 of Nodemcu--Step of stepper motor driver
int Dir  = 4; //GPIO2---D2 of Nodemcu--Direction of stepper motor driver

WiFiServer server(80);
 
void setup() {
  Serial.begin(115200);
  delay(10);
 pinMode(Step, OUTPUT); //Step pin as output
 pinMode(Dir,  OUTPUT); //Direcction pin as output
 digitalWrite(Step, LOW); // Currently no stepper motor movement
 digitalWrite(Dir, LOW);  
 
  // Connect to WiFi network
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
 
  WiFi.begin(ssid, password);
 
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
 
  // Start the server
  server.begin();
  Serial.println("Server started");
 
  // Print the IP address on serial monitor
  Serial.print("Use this URL to connect: ");
  Serial.print("http://");    //URL IP to be typed in mobile/desktop browser
  Serial.print(WiFi.localIP());
  Serial.println("/");
 
}
 
void loop() {
  // Check if a client has connected
  WiFiClient client = server.available();
  if (!client) {
    return;
  }
 
  // Wait until the client sends some data
  Serial.println("new client");
  while(!client.available()){
    delay(1);
  }
 
  // Read the first line of the request
  String request = client.readStringUntil('\r');
  Serial.println(request);
  client.flush();
 
  // Match the request
  int i=0;
  int value = LOW;
  
  if (request.indexOf("/Command=forward") != -1)  { //Move 50 steps forward
    digitalWrite(Dir, HIGH); //Rotate stepper motor in clock wise direction
          for( i=1;i<=50;i++){
          digitalWrite(Step, HIGH);
          delay(10);
          digitalWrite(Step, LOW);
          delay(10);}
    value = HIGH;
  }
  
  if (request.indexOf("/Command=backward") != -1)  { //Move 50 steps backwards
    digitalWrite(Dir, LOW); //Rotate stepper motor in anti clock wise direction
          for( i=1;i<=50;i++){
          digitalWrite(Step, HIGH);
          delay(10);
          digitalWrite(Step, LOW);
          delay(10);}
    value = LOW;
  }

  // Return the response
  client.println("HTTP/1.1 200 OK");
  client.println("Content-Type: text/html");
  client.println(""); //  do not forget this one
  client.println("<!DOCTYPE HTML>");
  client.println("<html>");
  client.println("<h1 align=center>Stepper motor controlled over WiFi</h1><br><br>");
  client.print("Stepper motor moving= ");
 
  if(value == HIGH) {
    client.print("Forward");
  } else {
    client.print("Backward");
  }
  client.println("<br><br>");
  client.println("<a href=\"/Command=forward\"\"><button>Forward </button></a>");
  client.println("<a href=\"/Command=backward\"\"><button>Backward </button></a><br />");  
  client.println("</html>");
  delay(1);
  Serial.println("Client disonnected");
  Serial.println("");
 
}

Not at all. You have a serious wiring error and have probably burned out one or more components. Please use code tags when posting code.

"Engineer's Garage" is a very low quality web site (as bad or worse than Instructables). The author is clearly an ignorant amateur and happy to mislead others, so I recommend that you find better sources of information. Pololu has excellent tutorials and circuit information on stepper motors.

This, for example, is completely useless nonsense:

9 volt battery is connected between Vmot and gnd pins of A4988 motor driver. 9 volts are enough to energize NEMA 17 coils.

1 Like

Thanks for the reply, Sorry, thought i use code tags, Engineer's Garage - bad okay ill look for another but it match most of my setup. any other help would be good, not sure I've burnt anything out yet... :slight_smile:

Damage has been done, regardless of whether the 8266 appears at the moment to be functional.

Any advice on how i can test? when i remove my wiring its fine not getting hot etc... so something with the other board/stepper?

If the MCU can upload and run the Arduino "LED blink" program, without anything else connected, it is still at least partially functional.

However, it may fail completely at any time, and one or more I/O pins may have been burned out.

I've cracked open a fresh 8266 and flashed the code seems to not be getting hot, so you might be on to something with the other 8266 , stepper still not turning... :frowning:

Post a link to the product page for the stepper you have.

To get a stepper turning with the A4988 motor driver, carefully follow the wiring instructions and set the current limit for the A4988 to 1 Ampere or less, e.g. a smaller value consistent with the stepper motor current rating, as described on the Pololu product pages. You will need a 12-24V motor power supply capable of providing a couple of Amperes.

In getting started with any new device or add on, look for very simple example programs that do nothing but demonstrate correct operation. I recommend to avoid wasting any more time with "Engineer's Garage".

Yeah, i've tried a few tutorials that was just the latest if i am honest, stepper is a stepperONLINE SN: 202401120657 when you say 1 Ampere how would i check this,

Please post a link to the actual stepper.

1 Ampere how would i check this

Follow this tutorial if you have a Pololu A4988 driver. If not, you need to know the value of the current sense resistor on the motor driver board, in order to properly adjust the current limit. The A4988 data sheet has the details.