Electrical – Controlling NEMA 23 speed with Arduino

arduinostepper motor

I have an Arduino controlling a NEMA 23 motor using a digital stepping driver (DM542T).

I am trying to have it go a a given speed in RPM (60), but when I try it results in a very jerky movement of the motor that does not go at the expected RMP

Here is my Arduino code:

int driverPUL = 7;    // Pulse pin
int driverDIR = 7;    // Direection pin

int stepsPerTurn = 200;
int RPM = 60;
float stepsPerSecond = (stepsPerTurn*RPM)/60;
float waitInMilliseconds = (1/stepsneededPerSecond)*1000;


void setup() {
  pinMode (driverPUL, OUTPUT);
  pinMode (driverDIR, OUTPUT);
}

void loop() {
    digitalWrite(driverPUL,HIGH);
    delay(wait);
    digitalWrite(driverPUL,LOW);
}

In the motor documentation I have the following table but I'm not sure what impulse/turn means.

Nema23

EDIT

Here is the DM542T settings, it is configured to the 4.20 A and 400 Pulse/rec settings.

DM542T

Any help would be welcome,

Best Answer

I remember these drives need a comparatively long pulse width. Checking the datasheet (page 9) of this drive confirmes this. The minimum low time is specified to be 2.5 microseconds. In your code you set the pulse immediately high after setting low. This might explain the jerky operation, every now and then it misses pulses, resulting in inconsistent driving.

Caveat to my assumptions: I think your code is not the actual code, the posted version will not compile! (Missing/inconsistent variable names.)