I really appreciate all the information provided in the Pololu Forum and the product pages. Perhaps I’m too much of a newbie, but despite harvesting all the information I can, I’m struggling to get my stepper motor up and running. Try as I may, I’m getting no motion, voltage, or current at the pinouts to the stepper motor.
There may be a few questionable aspects of my setup, but hopefully they don’t expose me here as too much of an amateur. (1) I’m using a reclaimed ATX power supply to provide 12 V for my external power supply (measured at 11.68 V using DVM). I’m not able to confirm the current, but the label on the ATX claims 17A at 12V. (2) My stepper motor is a a NEMA17 (Pololu item #2267). According to the datasheet, the rated current is 1.68A, so I have set setCurrentMilliamps36v4() to 1680mA in the code. Hopefully this is not confusing the rated current with the max allowable current. Also, from the datasheet, I’m supposing the black wire is AOut1 and the red wire is BOut1 and I am not reversing the coils. (3) As the title to the post suggests, I am attempting to use the 36v4 high-power stepper motor driver. I assume it is compatible with this NEMA17 motor and my power supply. (4) I’ve read several mentions of the common ground between logic and external power supply and hopefully I have made the appropriate connections. (5) I assuming my brown wire connection from Arduino ground to logic power supply is redundant or completely wrong, but feel free to educate me. (6) It’s possible I am doing something wrong in the Arduino GUI v1.8.13, such as not using the SPI or HighPowerStepperDriver libraries properly, but my code always compiles and examples from these libraries do open for me in the GUI.
I’ve include pictures of my connections, but here is a rundown as well (including DVM voltages at the relevant pinouts):
Arduino Driver Voltage
(jumper to IOREF) V5 (out) 4.98
(jumper to V5) IORef 4.98
Power GND GND n/a
D3 STEP 0
D2 DIR 0
D12 (MISO) SDATO 4.97
D11 (MOSI) SDATI 0
D13 (SCK) SCLK 0
D4 SCS 0.08
Power 5V Out SLP 5.03
n/a RST 0
n/a FLT 4.97
Of course, I’m working with the BasicSteppingSPI.ino
example and trying to get it to work. Any insight would be greatly appreciated. Here is my code for good measure:// This example shows basic use of a Pololu High Power Stepper Motor Driver.
#include <SPI.h>
#include <HighPowerStepperDriver.h>
const uint8_t CSPin = 4;
// This period is the length of the delay between steps, which controls the
// stepper motor's speed. You can increase the delay to make the stepper motor
// go slower. If you decrease the delay, the stepper motor will go faster, but
// there is a limit to how fast it can go before it starts missing steps.
const uint16_t StepPeriodUs = 2000;
HighPowerStepperDriver sd;
void setup()
{
// Setup serial communication
Serial.begin(9600);
while(!Serial);
Serial.println("--- My sketch has started ---");
delay(3000);
SPI.begin();
sd.setChipSelectPin(CSPin);
// Give the driver some time to power up.
delay(1);
// Reset the driver to its default settings and clear latched status
// conditions.
sd.resetSettings();
sd.clearStatus();
// Select auto mixed decay. TI's DRV8711 documentation recommends this mode
// for most applications, and we find that it usually works well.
sd.setDecayMode(HPSDDecayMode::AutoMixed);
// Set the current limit. You should change the number here to an appropriate
// value for your particular system.
sd.setCurrentMilliamps36v4(1680);
// Set the number of microsteps that correspond to one full step.
sd.setStepMode(HPSDStepMode::MicroStep32);
// Enable the motor outputs.
sd.enableDriver();
}
void loop()
{
// Step in the default direction 1000 times.
sd.setDirection(0);
for(unsigned int x = 0; x < 1000; x++)
{
sd.step();
delayMicroseconds(StepPeriodUs);
}
// Wait for 300 ms.
while(!Serial);
Serial.println("Completed stepping in one direction");
delay(300);
// Step in the other direction 1000 times.
sd.setDirection(1);
for(unsigned int x = 0; x < 1000; x++)
{
sd.step();
delayMicroseconds(StepPeriodUs);
}
// Wait for 300 ms.
while(!Serial);
Serial.println("Completed stepping in other direction");
delay(300);