Stepp motor no acceleration

Hello,
I read lot of topics here but could not solve problem with my stepp spining. I tried basic codes and my motor doesnt want to speed more than 4rpm. I am using nema 34 and driver: http://www.audiohms.com/en/cnc-electronics-products/drives-and-control-units-for-stepper-motors/microstep-stepper-motor-drive-mst-107.
Pin 9 is step, wiring done according shema, 24 -30V power suply. Anybody see the problem?


#include <AccelStepper.h>

#define dirP_1 31 // not wired
#define enableP_1 33 // hardware enabled
#define stepP_1 9

#define motorInterfaceType 1 // Define motor interface type 

AccelStepper m_1(motorInterfaceType, stepP_1, dirP_1);

void setup() {
  m_1.setMaxSpeed(10000);
  m_1.setAcceleration(100);
  m_1.setSpeed(200);
  m_1.moveTo(2000000);

  Serial.begin(9600);

}

void loop() {
  
  Serial.println();
 
  Serial.println(m_1.speed());

  m_1.run();
 

}

What happens if you comment out your prints?

Yes, that's it. Your many prints slow down the loop significantly - especially with only 9600 baud.

For those of us not familiar with the driver, can you explain the parameters and expected result of the 4 functions used? That would help us help you without a lot of research on our part.

In other words, are the speed variables rpm, or steps?

This is steps per second ( It's AccelStepper - doesn't have to do with the driver ). But with an AVR ( Mega/UNO/Nano ... ) you will never reach that speed - even without any prints in loop.

When I comment it printing it is better. Accelerating and than just stops and scrimming. He stops at approx 4 turns per second as I can see. I wrote up 4rpm sorry. I am using full step config. Using mega2560.

Doesn’t setSpeed(200) determine the speed of the stepper?

If so, how many steps per revolution is the stepper motor?

If 200 is 200steps/sec, then your revs/sec would be 200/(steps/rev). The units work out as (steps/sec)/(steps/rev) or revs/sec.

It's very likely that your stepper cannot come up with this speed rate in full step mode. Even not with acceleration.

200 steps per revolution is motor.

If you use the run() method ( with acceleration/deceleration ) the max speed that is reached after acceleration is determined by setMaxSpeed. With this setSpeed() should not be used at all, because it is used by run() internally to set the speed during acceleration.

Ah, so max speed is the target speed, which you may or may not hit depending on the distance you move. I assume it’s units are steps/sec.

So if your target is 10000steps/sec, and the motor is 200steps/rev, then revs/sec should be 10000/200 or 50revs/sec or 3000 rpm. So is your motor capable of running 3000rpm?

You might want to try some smaller max speed to see if you’re trying to run it too fast.

Exactly!

ok, seems little better but still stops at some small speed althouh I set up 1/4 stepp with deep switch. It can run fast not sure how much

void setup() {
  m_1.setMaxSpeed(3000);
  m_1.setAcceleration(100);
  //m_1.setSpeed(200);
  m_1.moveTo(2000000);

//  Serial.begin(9600);

}

void loop() {
 

  m_1.run();
 

}

Well, steppers are not high speed motors. Did you set the coil current according to your motor specs?
And what about your power source? To achive high speeds, the voltage should be as high as possible for your driver.

I looked at the HW controller spec… How have you got the mode dip switches set? You could be at 1/16’th step, which could explain your slow speed. Your expected revs/sec is 50, but if the dip switches are set to 1/16’th, you’d be running about 3revs/sec!

I imagine the driver set speed function should match the dip switch settings.

I suspect that both max speed and acceleration are too high. Experiment a bit with them to see what you can get for speed.

So stupid, I connected coils good just on one twisted wires. Thank you guys. Now runs like fly :slight_smile: Anyway know now little more about accelStepper.