NodeMCU with 28BYJ-Stepper gets out of control after few seconds

Hello,
I'm trying to move an Stepper with the NodeMCU using the regular stepper-library and basicly the oneRevolution-scetch.

The following parts I'm using:

NodeMCU ESP8266 ESP12E
ULN2003 with standard breakoutboard
28BYJ-48 5V Steppermotor
5V external Powersupply

The ULN2003 is connected to the Pins D5 - D8 and to the 5V Powersupply
The GND of the Driver and the ESP are connected.

My code look like this:

/*
 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 = 2038;  // 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, 14, 13, 12, 15);

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

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

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

As you may notice, the two middle pins are interchanged, this was due to the problem which is discriped in this article:

The article is in german, so if you cant read it, I will summerize it for you:
The library is giving the inpulses for the stepper in the wrong order, by changing the wires IN 2 and In 3 the order becomes right. This works very well, as the Motor only vibrates with the regular order, and moves perfectly fine with the change.

But now to my problem:

After powering on the System, first everthing works perfectly fine, the Motor moves about 90° forward, 5sec break, then the same amount back, break. But after few iterations, the behaviour changes, the Motor moves forwards, short break, moves forward, short break moves forward.
On the LEDs of the Breakoutboard is also a change in behaviour to see, while working normal:
two LEDs on while the breaks, then all four LEDs while moving.

After the "freakout":
two LEDs on while break, then all LEDs off for very short time, then all four LEDs on.

So to me this seams like the board is restarting in every of the short breaks.

Then I tried the same code with an Arduino Uno (only pin numbers changed)
But it had the same behaviour.

Another fact I noticed:
After the board was turnd of for a long time, like 10min the code will work for 5 to 10 Iterations.
If I turn the board off and on again, it works for only 2 to 3 times, and so on.
As if it has something to so with a capacitor

I'm realy out of ideas....

Thanks for your help!

Best regards, Christian

I suspect that the motor power supply is not capable of continuously supplying the motor current, and is overheating and shutting down internally. Try a different motor power supply.

jremington:
I suspect that the motor power supply is not capable of continuously supplying the motor current, and is overheating and shutting down internally. Try a different motor power supply.

Seams like you are partially right, and it is a powersupply related problem.

So a few more words to the supply:

I Used a 12V 2A Supply with a

elegoo 3.3 / 5 V Breadboard / USB powersupply module (using AMS1117)
like this one: How to use YwRobot Power Supply Properly - Wiki

On this it says Vin >12V

I changed the Powersupply to one with changeable Voltage

At 12V 1A:
"freakout"

At 9V 1A:

works perfecly fine.

So it seams like the elegoo Board cant handle 12V input.

Thank you very much for your help!

Best Regards, Christian