Hello,
I bought a Usongshine "US-17HS4023" stepper motor (for cheaper from china) to experiment on. I figure the US stand for Usongshine, making it the same as the other 17HS4023 steppers.
I had a 12V 10A power supply laying around that I cooked together with a A4988 driver and an Arduino Mega. I adjusted the max current draw to 1A on the driver board.
I want to do an experiment where I increase the speed until the stepper skips steps. Then I calculate to see if it matches the documentation. Depending on what source to believe it should either be around 200RPM (and actually higher when no load) or ">1400PPS" (Aliexpress link). 200RPM would mean 1.5ms per step (1.8° per step). 1400PPS would mean 714µs/ pulse.
Problem:
I was trying to reach the maxum speed by "Bitbanging" and get stuck at around 800µs/ pulse (50% duty cycle of course: 400µs on, 400µs off) meaning it's pretty close to the documented 1400PPS.
If my math still maths: 800µs/step = 0.8ms/step, (1minute =) 60 000ms/ 0.8ms/step = 75 000steps, 75 000steps/ ((360°/1.8°)steps/rotation) = is around 375RPM (=6RPS, which I highly doubt is actually the case: it does around 3rotations/sec when I film it, as seen in the video, making it around 200RPM).
When I try to go higher, the stepper just (literally) beeps without noticeable motion.
I thought adjusting the program to deal with inertia by using acceleration could bump it up a little bit, but there is where I ran into a problem: I found the "AccelStepper" library recommended online, but when using the library the motor tends to vibrate on every speed. And more peculiar: stepping over 95 "MaxSpeed" (=steps/ second), the stepper skips steps.
95steps/second = 631ms/step 10.5ms/step which is significantly (12.5x) higher than the achieved 800µs when "bitbanging".
- Can anyone confirm that it is plausible that 800µs is the limit of driving "17HS4023" NEMA17 with 12V and limiting the driver current to 1A?
- Does anyone have an idea how to get the same results with acceleration (using the AccelStepper library)?
Video of bitbanging, 95max speed and 100max speed. (including schematic)
"Bitbanging" code used:
// defines pins numbers
const int stepPin = 52;
const int dirPin = 53;
void setup() {
// Sets the two pins as Outputs
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
}
void loop() {
digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular direction
// Makes 200 pulses for making one full cycle rotation
for(int x = 0; x < 200; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(400);
digitalWrite(stepPin,LOW);
delayMicroseconds(400);
}
delay(1000); // One second delay
digitalWrite(dirPin,LOW); //Changes the rotations direction
// Makes 400 pulses for making two full cycle rotation
for(int x = 0; x < 400; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(400);
digitalWrite(stepPin,LOW);
delayMicroseconds(400);
}
delay(1000);
}
AccelStepper code used:
#include <AccelStepper.h>
// Define motor interface type (DRIVER means using a step/dir driver)
#define motorInterfaceType 1
// Define pin connections
const int dirPin = 53;
const int stepPin = 52;
// Create an instance of the AccelStepper class
AccelStepper stepper(motorInterfaceType, stepPin, dirPin);
void setup() {
// Set the maximum speed and acceleration
stepper.setMaxSpeed(95.0); // Steps per second
stepper.setAcceleration(30.0); // Steps per second^2
// Set the target position (e.g., 400 steps = 2 full revolutions on a 1.8° motor)
stepper.moveTo(800);
}
void loop() {
// Check if the motor has reached its target position
// If at the end of travel go to the other end
if (!stepper.run()) { // run() returns true as long as the final position has not been reached and speed is not 0.
stepper.moveTo(-stepper.currentPosition());
}
}
Edit: specified that the video includes the schematic.
Edit: added units to the RPM calculation as per reply.




