[STEPPERMOTOR] Can't stop my motor on a choosen step with DM432C

Hi guys, I have fews problems with my stepper moto driver. As part of a project in my engineering school, I have to do a plotting table and I've in provision DM432C driver motor ( datasheet ) for a NEMA 17 motor. Actually I can rotate the motor, I can change the speed of it, but I don't arrive to stop my motor on a step.

If anyone have an answer, please.. :cold_sweat:


Line 237. Definitely. Or line 73.

If you are in engineering school you should already know that if you want someone to diagnose a problem you need to give them as much information as possible.

Post a link to the datasheet for your motor Post your code. Describe what the code actually does, and what you would like it to do.


The motor : datasheet, reference.

The code:

const int xPULp = 2, xPULm = 3, xDIRp = 4, xDIRm = 5; //first motor x const int yPULp = 6, yPULm = 7, yDIRp = 8, yDIRm = 9; //second motor y

void setup() { pinMode(xPULp, OUTPUT); pinMode(xPULm, OUTPUT); pinMode(xDIRp, OUTPUT); pinMode(xDIRm, OUTPUT);

pinMode(yPULp, OUTPUT); pinMode(yPULm, OUTPUT); pinMode(yDIRp, OUTPUT); pinMode(yDIRm, OUTPUT);

digitalWrite(xDIRp, HIGH); digitalWrite(yDIRp, HIGH); delayMicroseconds(5); }

void loop() { if(Serial.available() >= 0) { digitalWrite(xDIRp, !xDIRp); digitalWrite(yDIRp, !yDIRp); delayMicroseconds(5); }

digitalWrite(xPULp, HIGH); digitalWrite(yPULp, HIGH); delayMicroseconds(100);

digitalWrite(xPULp, LOW); digitalWrite(yPULp, LOW); delayMicroseconds(100);


My code works correctly, the motor rotate like the program commands but I don't understand how to block a motor at a choosen step with this driver

That code probably will run two motors at identical speed. There's no attempt to stop them. You need to try a bit more before you've got something we can help you with.

Perhaps use a variable to count the steps?

With a stepper motor the essential thing is to count the steps and only perform as many steps as are necessary to move to a position. Have a look at this simple stepper code. You may also find something useful in stepper motor basics.