Driving a NEMA11 stepper motor

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

// 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?

• Darlington drivers aren't suitable for low voltage use, typically low voltage stepper motors are intended for use with high voltage chopping current mode drivers. At any rate, questions here are required to fully stand on their own and not depend on links for critical pieces, to receive help you will need to fully document your actual setup in an edit to your question. Be sure to include the nature and ratings of your motor power supply. – Chris Stratton Nov 7 '20 at 16:30
• @ChrisStratton I updated the question to stand on its own - sorry for the inconvenience! It's just weird, since I used a similar setup with an Arduino Nano and another lowV stepper before. I am just wondering what the wiggling could be a sign off. Maybe you are right and I was just lucky back then... – André Nov 8 '20 at 6:02
• Have you tried different pin orders in your code, eg. 1,3,2,4? Is the power supply connected to the motor powerful enough? – ocrdu Nov 8 '20 at 13:06
• USB is an insufficient power source for this, and besides you must never attempt to run motor power through a microcontroller boad. And as explained before, Darlington drivers like you are trying to use will not work well with low voltage anyway, even if your supply had sufficient current capability. You might luck out and get low performance, but this is not a sensible setup at all. What is the actual problem you are trying to solve with this stepper motor? – Chris Stratton Nov 8 '20 at 16:11
• @ocrdu I checked wiring and even tried flipping, both for D1->H-bridge and H-bridge->stepper. The result is always the same... – André Nov 8 '20 at 18:24

I checked with an Arduino Nano and a ESP32 dev board and it worked with the wiring, driver, code and all. Since it felt quite reliable, I wondered about the discussion regarding the performance and tested it: I measured a torque of 4.5Ncm, which is close enough to the 6Ncm they claim in the datasheet. It seems that the D1 (or just the one I have) does not supply sufficient power!

• The issue with a low supply voltage is dynamic torque, not static holding torque. However, your Darlington driver chip has immense losses, so even when no commutation making the winding inductance a non-issue, you're putting a much lower voltage on the coil than you are supplying to the driver chip, and so drawing less current than designed. And you can't get rated current without violating the USB spec anyway. This bad design isn't viable with USB as a power source, or in using only rated voltage for anything but slow rotation or positioning. – Chris Stratton Nov 12 '20 at 18:04
• @ChrisStratton Even though my solution works perfectly within my needs, your comments motivated me to look a bit ahead. I did some more research on alternatives to the Darlington drivers and found the DRV8834 and DRV8833 that are special lowV drivers for 2.5-10V. I ordered some and will use those in my final implementation to improve the energy efficiency and maybe get even more performance out. Thanks for the critical pointer! – André Nov 17 '20 at 14:03
• While that is better you still have the issue with the insufficiency of USB as a power source. Also those don't appear to be complete chopping drivers on their own. Look at the drivers used in 3d printers for comparison. – Chris Stratton Nov 17 '20 at 16:07