High-power stepper motor driver 36v4 Not Running

Hello,

I received the driver in the mail a few days ago and am using it to power a NEMA23 stepper
motor. I’ve made all the wirings and connections and am trying to run the default “BasicStepping” program from the Arduino library but it has failed to even run the motor a little bit.

I am using a 24V power source and have double/triple checked the wiring. My motor can use up to 4.2 amps but have set the current limit to 3000 mA for the sake of testing (I’ve left the rest of the starting code unchanged).

I can read 24V in the Driver’s Vin but nothing in A1, A2, B1, or B2 when I run the program.

Not sure where I am going wrong.

Arduino Pin → Stepper Driver Pin
D2 → DIR
D3 → STEP
D4 → SCS
D11 (MOSI) → SDATI
D12 (MISO) → SDATO
D13 (SCK) → SCLK
5V → IOREF
GND → GND

I have attached a picture of my simplified setup below. I am strictly running the example “BasicStepping.”


Thanks!

Figured out the problem! The Sleep Pin defaults to LOW so I just had to set it to high. This is not included in the default stepping code. Now just trying to see how to increase speed by a more substantial amount. Thanks!

Hello.

I am glad you got it working! Thank you for letting us know.

Good catch! Our examples for that driver are essentially set up to work with the wiring shown in the"typical wiring diagram" on the driver’s product page, which connects the nSLEEP pin to the logic supply (driving it high instead of controlling it with a pin from the microcontroller), so they do not include code for driving that pin high.

Brandon

Hi Brandon,

Thanks for your prompt reply and confirmation. I had a programming-related question for you on how to create smooth motion without using a for loop to call each step() function. To clarify, I would like to use a while loop to call the step function for my particular project.
The following code works with no problem:
for(unsigned int x = 0; x < 1000; x++)
step();
The following code does not work:
while(some condition)
step();

I can hear the current running through the motor but there is no actual stepping motion.

Please let me know if you have suggestions or tips on how to create the smooth motion in a while loop.

Thanks!

Hello.

Why do you want to avoid using a for loop? Can you post complete examples of your program that works with the for loop, and your program that does not work with the while loop? These examples should be the most simplified versions of your programs that still demonstrate the problem.

- Patrick

I need to avoid using a for loop since I want to step the motor as long as a condition is set. I’m using an ultrasonic sensor to track the distance of an object and while the object is a certain distance away, I want the motor to step. I can’t use a for loop since I don’t know exactly the number of steps that I want the motor to move.

Here is a while loop within the loop() function that I want to run that moves the motor (it steps the motor but there is a brief pause after the for loop finishes its 1000 iterations before running again:

sd.setStepMode(HPSDStepMode::MicroStep64);
phase = 1;
while(phase == 1){
      for(unsigned int x = 0; x < 1000; x++)
           stepSlow1();  
      if(averageDistanceReading() + 1.5 < startingDistance)
        phase = 2;
      Serial.println("Phase 1");
    }

Here is how I would like to step the motor without the for loop (basically just have it constantly step until the if statement condition allows for it to stop:

    sd.setStepMode(HPSDStepMode::MicroStep64);
    phase = 1;
    while(phase == 1){
      stepSlow1();  
      if(averageDistanceReading() + 1.5 < startingDistance)
        phase = 2;
      Serial.println("Phase 1");
    }

The above code without the for loop doesn’t actually step the motor but I can hear some current flowing.

Here is the stepSlow1() function:

void stepSlow1(){
  phase1Steps++;
  StepPeriod = 4000;
  // The STEP minimum high pulse width is 1.9 microseconds.
  digitalWrite(StepPin, HIGH);
  delayMicroseconds(3);
  digitalWrite(StepPin, LOW);
  delayMicroseconds(3);
  delayMicroseconds(StepPeriod);
}

I simplified the program quite a bit to show the problem. Let me know if you have any questions. Thanks!

Your programs look okay, so I suspect this might be an issue of your sensor or your calculations not working as expected. Could you try printing the value of startingDistance and averageDistanceReading() to check if they are what you expect?

- Patrick