Hello all
I have been playing with some Nema17 steppers...
https://thepihut.com/products/nema-17-stepper-motor-42mm-x-40mm
I had a couple of A4988 Drivers here (standard red ones).
I drove them off an ESP32 Wroom (I hate those things) because I had a breakout board for one of them.
After faffing for HOURS trying to get a library to work, I finally got it running using the following library...
https://github.com/pkerspe/ESP-FlexyStepper
But... it runs absolutely horrible, very noisy with next to zero torque. The baffling array of Googled results on how to set the current doesn't help.
Using a decent 12v supply for the steppers and the ESP32 is running on 3.3v (as are the A4988's)
I have now ordered a couple of these drivers (same chip)... as these might be a bit suspect.
https://thepihut.com/products/a4988-stepper-motor-driver-carrier-black-edition
Now I am driving them using the examples in the library....
// ******************************************************************
// * *
// * Simple example for controlling a stepper motor *
// * *
// * Paul Kerspe 4.6.2020 *
// * *
// ******************************************************************
// This is the simplest example of how to run a stepper motor.
//
// Documentation for this library can be found at:
// https://github.com/pkerspe/ESP-FlexyStepper/blob/master/README.md
//
// This library requires that your stepper motor be connected to the ESP
// using a driver that has a "Step and Direction" interface.
// Examples of these are:
//
// Pololu's DRV8825 Stepper Motor Driver Carrier:
// https://www.pololu.com/product/2133
//
// Pololu's A4988 Stepper Motor Driver Carrier:
// https://www.pololu.com/product/2980
//
// Sparkfun's Big Easy Driver:
// https://www.sparkfun.com/products/12859
//
// GeckoDrive G203V industrial controller:
// https://www.geckodrive.com/g203v.html
//
// For all driver boards, it is VERY important that you set the motor
// current before running the example. This is typically done by adjusting
// a potentiometer on the board. Read the driver board's documentation to
// learn how.
#include <ESP_FlexyStepper.h>
// IO pin assignments
const int MOTOR_STEP_PIN = 3;
const int MOTOR_DIRECTION_PIN = 4;
// create the stepper motor object
ESP_FlexyStepper stepper;
void setup()
{
Serial.begin(115200);
// connect and configure the stepper motor to its IO pins
stepper.connectToPins(MOTOR_STEP_PIN, MOTOR_DIRECTION_PIN);
}
void loop()
{
//
// Note 1: It is assumed that you are using a stepper motor with a
// 1.8 degree step angle (which is 200 steps/revolution). This is the
// most common type of stepper.
//
// Note 2: It is also assumed that your stepper driver board is
// configured for 1x microstepping.
//
// It is OK if these assumptions are not correct, your motor will just
// turn less than a full rotation when commanded to.
//
// Note 3: This example uses "relative" motions. This means that each
// command will move the number of steps given, starting from it's
// current position.
//
// set the speed and acceleration rates for the stepper motor
stepper.setSpeedInStepsPerSecond(100);
stepper.setAccelerationInStepsPerSecondPerSecond(100);
// Rotate the motor in the forward direction one revolution (200 steps).
// This function call will not return until the motion is complete.
stepper.moveRelativeInSteps(200);
delay(1000);
// rotate backward 1 rotation, then wait 1 second
stepper.moveRelativeInSteps(-200);
delay(1000);
// This time speedup the motor, turning 10 revolutions. Note if you
// tell a stepper motor to go faster than it can, it just stops.
stepper.setSpeedInStepsPerSecond(800);
stepper.setAccelerationInStepsPerSecondPerSecond(800);
stepper.moveRelativeInSteps(200 * 10);
delay(2000);
}
Can someone explain to me how to correctly set the current. I started at the lowest and rotated clockwise until it started to run OK with no missed steps.
The voltage on the metal part of the potentiometer was 0.71v.
But... I just don't understand the lack of power. They only appear to run in one connection order. Reversing any wires on the stepper just means it fails to rotate.
Thanks