stepper motor with drv8825 not work

Hi
I am newbie to arduino , i bought Professional 3D printer Arduino CNC Module Kit Stepper Motor Drive for Kuman UNO R3 for Arduino from aliexpress .
i installed the parts of arduino uno + CH340G cnc Shield 3.0 + DRV8825 with power supply 12v 15 Amp.
The problem is when i upload arduino sketch to the board the stepper motor gives pulses , no shaft motor movement .
I use codes from arduini uno stepper Library.
how can i solve the problem ?
Thanx

You need to post links to the datasheets for all the products you mention (apart from the DRV8825).

Also post the program you have tried.

In the meantime these links may help
Stepper Motor Basics
Simple Stepper Code

...R

Thank you for your kindness
This is the link to offer page

This is the code
/*

#include <Stepper.h>

// change this to the number of steps on your motor
#define STEPS 100

// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it’s
// attached to
Stepper stepper(STEPS, 8, 9, 10, 11);

// the previous reading from the analog input
int previous = 0;

void setup() {
// set the speed of the motor to 30 RPMs
stepper.setSpeed(30);
}

void loop() {
// get the sensor value
int val = analogRead(0);

// move a number of steps equal to the change in the
// sensor reading
stepper.step(val - previous);

// remember the previous value of the sensor
previous = val;
}


Code 2

/*
Stepper Motor Control - one revolution

This program drives a unipolar or bipolar stepper motor.
The motor is attached to digital pins 8 - 11 of the Arduino.

The motor should revolve one revolution in one direction, then
one revolution in the other direction.

Created 11 Mar. 2007
Modified 30 Nov. 2009
by Tom Igoe

*/

#include <Stepper.h>

const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

void setup() {
// set the speed at 60 rpm:
myStepper.setSpeed(60);
// initialize the serial port:
Serial.begin(9600);
}

void loop() {
// step one revolution in one direction:
Serial.println(“clockwise”);
myStepper.step(stepsPerRevolution);
delay(500);

// step one revolution in the other direction:
Serial.println(“counterclockwise”);
myStepper.step(-stepsPerRevolution);
delay(500);
}


Code 3

/*
Stepper Motor Control - one step at a time

This program drives a unipolar or bipolar stepper motor.
The motor is attached to digital pins 8 - 11 of the Arduino.

The motor will step one step at a time, very slowly. You can use this to
test that you’ve got the four wires of your stepper wired to the correct
pins. If wired correctly, all steps should be in the same direction.

Use this also to count the number of steps per revolution of your motor,
if you don’t know it. Then plug that number into the oneRevolution
example to see if you got it right.

Created 30 Nov. 2009
by Tom Igoe

*/

#include <Stepper.h>

const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

int stepCount = 0; // number of steps the motor has taken

void setup() {
// initialize the serial port:
Serial.begin(9600);
}

void loop() {
// step one step:
myStepper.step(1);
Serial.print(“steps:”);
Serial.println(stepCount);
stepCount++;
delay(500);
}

The standard Stepper library is not intended for use with stepper drivers that take step and direction signals

Try the code in my link.

With that shield you may need to set the enable pins for the drivers to work. I think they work when enable is set to LOW

…R

PS … when posting code please use the code button </>

so your code looks like this

and is easy to copy to a text editor See How to use the Forum

Thank you for your attention
I did not see link to code in last reply

That shield most likely follows the form factor of a GRBL one.

Look up what pins are assigned in GRLB for the STP and DIR for the motor you are trying to drive.

Load up the Blink example and change the LED pin number to the STP pin number of the motor.

Play around with the delay value to see how fast you can move the motor before it "stalls".

Rihani:
Thank you for your attention
I did not see link to code in last reply

The link is in my Reply #1 - I presume you did read it?

...R

Yes i read it , but i thought you were talking about another code link .

I used this code & it gave the same result.
And i got this Msg

The sketch name had to be modified.
Sketch names must start with a letter or number, followed by letters,
numbers, dashes, dots and underscores. Maximum length is 63 characters.
Sketch uses 2286 bytes (7%) of program storage space. Maximum is 32256 bytes.
Global variables use 208 bytes (10%) of dynamic memory, leaving 1840 bytes for local variables. Maximum is 2048 bytes.

// testing a stepper motor with a Pololu A4988 driver board or equivalent
// on an Uno the onboard led will flash with each step
// this version uses delay() to manage timing

byte directionPin = 9;
byte stepPin = 8;
int numberOfSteps = 100;
byte ledPin = 13;
int pulseWidthMicros = 20;  // microseconds
int millisbetweenSteps = 250; // milliseconds - or try 1000 for slower steps


void setup() { 

  Serial.begin(9600);
  Serial.println("Starting StepperTest");
  digitalWrite(ledPin, LOW);
  
  delay(2000);

  pinMode(directionPin, OUTPUT);
  pinMode(stepPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  
 
  digitalWrite(directionPin, HIGH);
  for(int n = 0; n < numberOfSteps; n++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(pulseWidthMicros); // this line is probably unnecessary
    digitalWrite(stepPin, LOW);
    
    delay(millisbetweenSteps);
    
    digitalWrite(ledPin, !digitalRead(ledPin));
  }
  
  delay(3000);
  

  digitalWrite(directionPin, LOW);
  for(int n = 0; n < numberOfSteps; n++) {
    digitalWrite(stepPin, HIGH);
    // delayMicroseconds(pulseWidthMicros); // probably not needed
    digitalWrite(stepPin, LOW);
    
    delay(millisbetweenSteps);
    
    digitalWrite(ledPin, !digitalRead(ledPin));
  }
}

void loop() { 
}

And this code gave the same result , only pulse no movement .

// testing a stepper motor with a Pololu A4988 driver board or equivalent

// this version uses millis() to manage timing rather than delay()
// and the movement is determined by a pair of momentary push switches
// press one and it turns CW, press the other and it turns CCW

byte directionPin = 9;
byte stepPin = 8;

byte buttonCWpin = 10;
byte buttonCCWpin = 11;

boolean buttonCWpressed = false;
boolean buttonCCWpressed = false;

byte ledPin = 13;

unsigned long curMillis;
unsigned long prevStepMillis = 0;
unsigned long millisBetweenSteps = 25; // milliseconds

void setup() { 

     Serial.begin(9600);
     Serial.println("Starting Stepper Demo with millis()");

     pinMode(directionPin, OUTPUT);
     pinMode(stepPin, OUTPUT);
     pinMode(ledPin, OUTPUT);
     
     pinMode(buttonCWpin, INPUT_PULLUP);
     pinMode(buttonCCWpin, INPUT_PULLUP);
     
}

void loop() { 
    
    curMillis = millis();
    readButtons();
    actOnButtons();
    
}

void readButtons() {
    
    buttonCCWpressed = false;
    buttonCWpressed = false;
    
    if (digitalRead(buttonCWpin) == LOW) {
        buttonCWpressed = true;
    }
    if (digitalRead(buttonCCWpin) == LOW) {
        buttonCCWpressed = true;
    }
}

void actOnButtons() {
    if (buttonCWpressed == true) {
        digitalWrite(directionPin, LOW);
        singleStep();
    }
    if (buttonCCWpressed == true) {
        digitalWrite(directionPin, HIGH);
        singleStep();
    }
}

void singleStep() {
    if (curMillis - prevStepMillis >= millisBetweenSteps) {
            // next 2 lines changed 28 Nov 2018
        //prevStepMillis += millisBetweenSteps;
        prevStepMillis = curMillis;
        digitalWrite(stepPin, HIGH);
        digitalWrite(stepPin, LOW);
    }
}

Rihani:
The sketch name had to be modified.

That is not surprising as there was no name for the program in my link

.

And this code gave the same result , only pulse no movement .

Have you tried setting the enable pin as I suggested in Reply #3 ?
Have you tried a much slower step rate?

If that does not solve the problem I think it is time to get more details from you.
What stepper motor power supply are you using (volts and amps)?
How have you everything connected ? (make a simple pencil drawing and post a photo of it. See this Simple Image Guide

…R

I do not know how to do it , I had a look on Arduino reference , is the code digitalWrite( , LOW) ?
How to find enable pin number ?

Robin2:
With that shield you may need to set the enable pins for the drivers to work. I think they work when enable is set to LOW

I use 12 v 15 Amp for cnc shield, drv8825 & stepper motor .
For arduino uno it takes the power from laptop & printer cable .

I used 12 v 1 Amp for Arduino uno with the printer cable but it gave the same result only pulse no movement

Did you read reply #5 ?

You should be using pins 2-4 (X,Y,Z) for step pulses.

Pin 8 is the enable control pin so you are just turning the driver(s) on and off rapidly.

justone:
Did you read reply #5 ?

Yes i read reply #5 but i did not do it because i do not know how to do it , as i mentioned i am newbie to arduino & need to find simple source to learn or simple tutorial to solve this problem .

Thank you for your kindness & replies

How to find STP pin number of the motor ?

Rihani:
How to find STP pin number of the motor ?

Which motor?

X will use pin #2, Y will use pin #3, and Z will be pin#4.

Please use Google and look up "GRBL sheild for Uno" and see what pins are used.

This is of course if your shield follows the GRBL pinout.