I got a NEMA11 bipolar stepper motor rated at 3.8V @ 0.67A, 5.6Ohm and 4.2mH. I thought to run it with the D1 mini powered via USB and using its 5Vout for the SN754410 H bridge and motor power: However, when I tested it with my D1 Mini, it just wiggles and has zero torque. I started with the basic stepper lib code:
#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, 1,2,3,4);
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);
}
I ran another stepper a couple years ago with a similar setup (just using a Android Nano instead of the D1 Mini) and it worked great. Back then I used Accelstepper:
#include <AccelStepper.h>
#define HALF4WIRE 8
// Motor pin definitions
#define motorPin1 1 // A1
#define motorPin2 2 // A2
#define motorPin3 3 // B1
#define motorPin4 4 // B2
// Initialize with pin sequence IN1-IN3-IN2-IN4 for using the AccelStepper with 28BYJ-48
//AccelStepper stepper; // Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5
AccelStepper stepper1 (HALF4WIRE, motorPin1, motorPin2, motorPin3, motorPin4, true);
void setup() {
stepper1.setMaxSpeed(1200.0);
stepper1.setAcceleration(100.0);
stepper1.setSpeed(100);
stepper1.moveTo(2000); //250 full rotations @ 48 steps each = 12,000 steps
}//--(end setup )---
void loop() {
//Change direction when the stepper reaches the target position
if (stepper1.distanceToGo() == 0) {
stepper1.moveTo(-stepper1.currentPosition());
delay(500);
}
stepper1.run();
}
However, I dug out the old motor, and even that one is just vibrating. It changes in tune with the Accelstepper speed, so I assume something is working as it should, but never moves out of the same position. I tried even an external power source but with no difference. Any tips what could be off? Broken chip, wiring, power?