Arduino stepper driver M542 contrlling issue

Hi guys,

Thanks in advance,

I am new to electronics. I am facing a problem while powering my m542 for controlling stepper. When I power it on, it behaves weirdly i.e. it keeps on restarting/blinking for some time and i have to turn it off to avoid any harm to it. Previously it use to work. I have tried re wiring it but things doesn't change. And some times it works fine.

Any help from community would be great. I have attached the wiring image

and

of arduino and m542, also I have created a video displaying my problem here is the link for the same

Youtube Link

Thanks :slight_smile:

Photographs of wiring nests are just as useful, but not nearly as pretty, as photos of bird's nests.

Make a pencil drawing showing all your connections and post a photo of that.
Post a link to the datasheet for your stepper driver.
Post your code - without that we have no idea what you are trying to do.
And please use the code button </> so your code looks like this and is easy to copy to a text editor

...R

Hi Robin2,

Thank you very much for response. Kindly find the details you have asked.

Leadshine M542 datasheet

My wiring diagram is as below.

And below is the code.

#include <StepperMSeries.h>

// change this to the number of steps on your motor
#define STEPS 200
#define PULSE_PIN 23
#define DIRECTION_PIN 25
#define ENABLE 27

StepperMSeries stepper(STEPS, PULSE_PIN, DIRECTION_PIN);

void setup() {
  // set the speed at 60 rpm:
  stepper.setSpeed(150);
  pinMode(ENABLE,OUTPUT);
  digitalWrite(ENABLE,HIGH);
  // initialize the serial port:
  Serial.begin(9600);
}

void loop() {
  // step one revolution  in one direction:
  Serial.println("clockwise");
  stepper.step(STEPS);
  delay(500);
  
   // step one revolution in the other direction:
  Serial.println("counterclockwise");
  stepper.step(-STEPS);
  delay(500); 
}

Thanks in advance,

Any help is appreciable.

Regards

That diagram is much better, and sufficient for now. However a pencil drawing would have been easier to assimilate. Even a poor pencil drawing.

I know nothing about that stepper library.

This Simple Stepper Code does not use any library and should work with your driver for testing purposes. Obviously you need to get the pin reference correct. And you may need to add control of the enable pin - but it may work without it connected at all.

...R
Stepper Motor Basics

Are you giving it the right supply voltage? It wants 20 -- 50V.

Hi All,

Thank you all for your support. I found my driver was culprit. Switch 4 that was on half current was creating this issue. I modified it to full current and it is working smoothly now.

Thanks.

Grazie tantissimo, ho cercato per lungo tempo la risposta a questa domanda.
defraggler alternative

bforu_gs:
Hi All,

Thank you all for your support. I found my driver was culprit. Switch 4 that was on half current was creating this issue. I modified it to full current and it is working smoothly now.

Thanks.

That's the mode that reduces current when the motor is idle for a short time - this can greatly reduce
power consumption - rather than disable it, try it out - the motor will jump back to full current on the
next step anyway.