CheapStepper
CheapStepper copied to clipboard
Crashing on NodeMCU
I am not entirely sure where the error lies here, but I am trying to use a NodeMCU v1 together with a ESP-12E Motor Shield and a 28BYJ stepper motor. According to this link, the pins shall be 5, 0, 4, 2 or D1, D3, D2, D4.
However, when I try to spin the motor, I get a crash loop while I can hear the motor, but the shaft is not spinning. This is how the crash looks:
17:48:39.891 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
17:48:39.891 ->
17:48:39.891 -> Soft WDT reset
17:48:39.891 ->
17:48:39.891 -> >>>stack>>>
17:48:39.891 ->
17:48:39.891 -> ctx: cont
17:48:39.891 -> sp: 3ffffd60 end: 3fffffc0 offset: 01a0
17:48:39.891 -> 3fffff00: 4020297d feefeffe feefeffe feefeffe
17:48:39.891 -> 3fffff10: 40100250 00000010 3ffee2e8 40100279
17:48:39.926 -> 3fffff20: 3ffe8622 3ffee2e8 00000010 4020120c
17:48:39.926 -> 3fffff30: 00000001 00000001 00000000 00000000
17:48:39.926 -> 3fffff40: 40201344 3ffee2e8 3ffee2e8 4020123a
17:48:39.926 -> 3fffff50: 40201344 3ffee330 00000739 4020129d
17:48:39.926 -> 3fffff60: 3ffee310 0000000c 3ffee330 402012cc
17:48:39.960 -> 3fffff70: 3ffee310 3ffee330 3ffee330 00000800
17:48:39.960 -> 3fffff80: 3ffee310 3ffee330 3ffee2e8 40201080
17:48:39.960 -> 3fffff90: feefeffe feefeffe feefeffe 3ffee398
17:48:39.960 -> 3fffffa0: 3fffdad0 00000000 3ffee358 40201b80
17:48:39.960 -> 3fffffb0: feefeffe feefeffe 3ffe84e0 40100be9
17:48:39.997 -> <<<stack<<<
This is the code:
#include <CheapStepper.h>
bool stepped = false;
const int stepsPerRevolution = 2048;
CheapStepper motor(D1, D3, D2, D4);
void setup() {
Serial.begin(74880);
motor.setTotalSteps(stepsPerRevolution);
motor.setRpm(17);
Serial.println("UP");
if (!stepped)
{
Serial.println("stepping ...");
motor.move(true, stepsPerRevolution);
stepped = true;
}
}
Can someone help me out? Is the NodeMCU or the shield maybe not compatible with this library?
I do know that the motor works with that board, because I was using the LUA firmware before, but now want to use C++/Arduino IDE.
Hi there, I know this is late to the party, but in case anyone is going through this I wanted to post my experience.
I have been successfully using the CheapStepper library with a nodeMCU board for a while now. Every so often I do get this soft reset issue, but for my use case it hasn't been an issue. If you're having issues getting the shaft to turn (I certainly did), I recommend you try using the moveDegrees() method rather than the move by steps version you've tried here. it's been more reliable for me. I've included a section of my working code below.
// Initalize Stepper object
CheapStepper stepper(D0,D1,D2,D3);
boolean clockwise = true;
boolean counterclockwise = false;
if (motorone_status == "ON") {
stepper.moveDegrees(clockwise, 180);
Serial.println("one turn of motor ");
server.send(200, "text/plain", "One spin sent!");
delay(2000);
motorone_status == "OFF";
stepper.off();
}
Hi there, I know this is late to the party, but in case anyone is going through this I wanted to post my experience.
I have been successfully using the CheapStepper library with a nodeMCU board for a while now. Every so often I do get this soft reset issue, but for my use case it hasn't been an issue. If you're having issues getting the shaft to turn (I certainly did), I recommend you try using the moveDegrees() method rather than the move by steps version you've tried here. it's been more reliable for me. I've included a section of my working code below.
// Initalize Stepper object CheapStepper stepper(D0,D1,D2,D3); boolean clockwise = true; boolean counterclockwise = false; if (motorone_status == "ON") { stepper.moveDegrees(clockwise, 180); Serial.println("one turn of motor "); server.send(200, "text/plain", "One spin sent!"); delay(2000); motorone_status == "OFF"; stepper.off(); }
Thank you good sir!
That solves the "soft WDT reset". Now the ESP just crashes.