Go Down

Topic: NEMA 42 + DM2282 Driver setup not working (Read 210 times) previous topic - next topic

yafimski

Hi,
I've set up a NEMA 42 motor and a DM2282 driver via a breadboard, to my Arduino Uno.

Please see attached diagram for the setup.

The code I'm using is:

Code: [Select]
#include <AccelStepper.h>

    // defines pins numbers
    const int stepPin = 9;
    const int dirPin = 8;
     
    void setup() {
      // Sets the two pins as Outputs
      pinMode(stepPin,OUTPUT);
      pinMode(dirPin,OUTPUT);
    }
    void loop() {
      digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular direction
      // Makes 1000 pulses for making one full cycle rotation
      for(int x = 0; x < 1000; x++) {
        digitalWrite(stepPin,HIGH);
        delayMicroseconds(500);
        digitalWrite(stepPin,LOW);
        delayMicroseconds(500);
      }
      delay(1000); // One second delay
     
      digitalWrite(dirPin,LOW); //Changes the rotations direction
      // Makes 1000 pulses for making two full cycle rotation
      for(int x = 0; x < 1000; x++) {
        digitalWrite(stepPin,HIGH);
        delayMicroseconds(500);
        digitalWrite(stepPin,LOW);
        delayMicroseconds(500);
      }
      delay(1000);
    }



Can you tell why it isn't working?
The motor itself receives power so it's probably something in the digital pins or the wiring in the breadboard.

*The resistors are 330 Ohm


Thank you!

groundFungus

#1
Dec 08, 2018, 04:30 pm Last Edit: Dec 08, 2018, 04:33 pm by groundFungus
It appears that, on the breadboard, the digital output pins are connected to ground and one side of the 330 Ohm resistor.  That shorts the digital outputs to ground.  The wires in the red boxes do not belong there.  The path to ground for the driver - inputs (optoisolator cathodes) should be through the digital pins.  I suggest that you test those outputs to make sure that they were not damaged by shorting to ground if they were ever set to HIGH.


yafimski

Hi,
Do you mean just to remove those wires and that's it?

I'm not really sure how to 'test' the digital pins...

I tried using pins 10 and 11 instead of 8 and 9, and doing that while the wires you mentioned are removed, but the motor didn't move..

Any ideas..?


Thanks

MarkT

Test pin with LED in series with 330 ohm resistor...
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up