Stepper Motor control with DM320T and Arduino Uno

I am having a problem getting the shaft of a NEMA 17 motor to rotate. I have attached a wiring diagram and the Arduino code. i am using an Arduino Uno with output controls on digital pins 6 and 7. I am interfacing the Uno to a DM320T Driver manufactured by OMC (www.omc-stepperonline.com). I am using a 12V power source for the driver. The motor is manufactured by Polulu and is described as unipolar/bipolar , 6 wire, 200 steps/rev, 1.2A/phase, 42x48 mm.
I set up the circuit using the DM320 User manual in bipolar mode (I think) with center taps of A and B windings disconnected. The attached diagram shows DIP settings and wiring. The manual suggests 1k resistors on the control lines between Uno pins and the Driver PUL and DIR terminals. I measured the voltages on the 1K resistors. Pin 7 (PUL) to ground was 5.0V. Pin 6 (DIR) to ground alternated (assume pulse waveform) 0.0/5.0V. On the Driver side of the 1k resistor this measured 3.0v/5.0v.
I have some electronics background but limited experience with stepper motors. I have successfully used a ULN2003 driver with a NEMA 11 motor and an UNO. I am wondering about a timing issue or wrong motor (200 steps/rev)
Code

//DM542T
int x;

void setup() {
  pinMode(7,OUTPUT);    //Set Pin 7 as PUL
  pinMode (6,OUTPUT);   //Set Pin 6 as DIR  

}

void loop() {
  digitalWrite(6,HIGH);     //Set high level direction
  for (x=0; x<400;x++)        //Repeat 400 times a revolution when setting is 400 on driver
  {
    digitalWrite(7,HIGH);    //Output high
    delayMicroseconds(500);   //Set rotate speed
    digitalWrite(7,LOW);      //Output low
    delayMicroseconds(500);    //Set rotate speed
  }
  
  digitalWrite(6,LOW);        // Set high level direction
  for(x=0;x<400;x++)
  {
    digitalWrite(7,HIGH);
    delayMicroseconds(500);
    digitalWrite(7,LOW);
    delayMicroseconds(500);
  }
  delay(1000);

  

}

Thanks, Kirk Rensmeyer

.DM320T System Diagram

But you have the coil current at SW1=ON, SW2=ON, SW3=ON which is 0.3A.
SW1=OFF, SW2=OFF, SW3=ON would give 1A.

You have the microstepping set to x64 which is 128000 steps per revolution (SW4=OFF, SW5=ON, SW6=OFF). 400 steps will move the motor shaft 1.125° which may not be enough to see. I would suggest that you set the microstepping to more like x4 or x8 while getting the motor running. And step the motor more steps and put a flag on the shaft so that you can see it move.
See page 8 of the data sheet for switch settings.

Also, in the code, you are starting the motor at 1000 steps per second. You may want to slow it down to get it running. Increase the delay time to slow the motor.

Did you use a meter to Ohm out the windings to identify the right wires to connect to the driver.

Your schematic is barely readable. This may help with the schematic drawing.

Thanks. I will try your suggestions and get back to you.

Seasonal note: October is ideal for ground fungus-have a lot in my backyard!

Kirk Rensmeyer

Indeed - in fact you never want to run a stepper this big without ramping the speed, say using the AccelStepper library or similar as the inertia will cause miss-stepping if you try to jump the speed instantly. You can only get away with this with low speeds and tiny steppers.

Erm, that only applies in the northern temperate zone :slight_smile:

Further note: The code I listed was provided by the Driver Tech support people at OMC. A question: I noticed it does not include the Arduino stepper library, as far as I can tell. I'm going to adjust the For statement to 50 as in for (x=0; x<50; x++)

You don't need the resistors for 5V input.
Try:
delayMicroseconds(5000); //instead of 500

Thanks! I'll try that.

Hi Mark,
Thanks for your suggestions. I'm going to make another attempt at this. I'm trying a new Arduino board. I wanted to attempt a low speed rotation and need to check if I'm calculating things correctly. If I understand things correctly; the delayMicroseconds value determines the motor rotation speed. If I use a delay of 5000 microseconds in the code that would be 5000 microseconds High and 5000 Microseconds LOW and the Period would be 10000 Microseconds. That would make the shaft rotation frequency 1/Period = 1/10000 us =1/.01 sec =100 cycles/sec. Do I have that right? I'm not sure how that works out with steps or microsteps. I'm going to set the driver at 400 steps/rev.
Thanks Kirk

100 steps per second / 400 steps per rev = 0.25 revs per second * 60 = 15 RPM, good luck.

Any reason not to checkout the AccelStepper library - speed ramping is likely to be essential (unless you really are sticking to 15rpm or so!!)

Thank you for that formula and calculation.

Hi Mark,
I had a couple of reasons. First, when I purchased the OMC driver and started talking to their support people they sent me a sample program. I've been working off that program and I'm really not sure how to adapt to this two lead (PUL/DIR) system/ code. Secondly I am interested in low rpm applications. I did get the NEMA 17 motor to turn. More on that later. I think my Arduino Board had a bad port. Thanks for your assistance.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.