Full drive mode stepper motor

hi,
I tried the following code for full drive of stepper motor but it is not working, while the same thing for half drive is working. What could be the problem?

void FD()
{
  digitalWrite(in1, HIGH);	
  digitalWrite(in2, LOW);
  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH); 
  delay(10);
  digitalWrite(in1, HIGH);
  digitalWrite(in2, HIGH);  
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW); 
 delay(10);
  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);  
  digitalWrite(in3, HIGH);
  digitalWrite(in4, LOW);
 delay(10);
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);  
  digitalWrite(in3, HIGH);
  digitalWrite(in4, HIGH);
  delay(10);
}

how are the pins wired to the motor and is there a datasheet for the motor?

Please provide the entire sketch, not a fragment, the problem isn't always where you think it is. Also the circuit diagram is useful. Full details of the hardware involved too - datasheets for motor, motor driver at least.

I can think of several possible issues, but with so little information I have no idea what your particular problem is.

hi, i am using nema 17 stepper motor and the following is the pin setup:

int en = 10;
int in1 = 9;
int in2 = 8;
int in3 = 7;
int in4 = 6;

void setup(){
  pinMode(en, OUTPUT);
  digitalWrite(en, HIGH);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);
}

the code works with half drive tested on actual stepper motor but the full drive sequence is not working, motor stalls/vibrates and does not rotate

Data for the actual motor, data for the driver, circuit schematic? It all matters, really.

are these the correct datasheets for the motor and sequence?

still unknown which coils in1, in2, in3 and in4 are connected to?

and a discussion of full and half step motors

the schematic is:

the code is:


int en = 10;
int in1 = 9;
int in2 = 8;
int in3 = 7;
int in4 = 6;

void FD()
{
  digitalWrite(in1, HIGH);	
  digitalWrite(in2, LOW);
  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH); 
  delay(10);
  digitalWrite(in1, HIGH);
  digitalWrite(in2, HIGH);  
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW); 
 delay(10);
  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);  
  digitalWrite(in3, HIGH);
  digitalWrite(in4, LOW);
 delay(10);
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);  
  digitalWrite(in3, HIGH);
  digitalWrite(in4, HIGH);
  delay(10);
}

void setup(){
  pinMode(en, OUTPUT);
  digitalWrite(en, HIGH);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);
}

void loop() {
	FD();
   }

The Nema17 is of 4 wire with phase A as red, phase A' as blue, phase B as green and phase B' as black. Datasheet link:https://motion.schneider-electric.com/hybrid-stepper-motor/m-17-nema-17-1-5-1-8-stepper-motor/
The motor driver is L298N and datasheet link is:https://www.sparkfun.com/datasheets/Robotics/L298_H_Bridge.pdf

what do you think the sequence should be for the coils?

Internal-Diagram-of-NEMA17-Stepper-Motor

hi,
this is not the motor coil i have, i have 4 wires stepper motor, i have posted link of stepper motor above.
A=red
A'=blue
B=green
B'=black

does that match your code?

yes, as I said, half drive mode works perfectly it just the full drive mode

what does the above do?

Hi,
What is the model number of your stepper, Nema17 is a physical motor size spec, not an electrical spec, the link you provided shows 3 different specs.

This might help;

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

hi,
if you mean the following 3 types then it is the middle one(40mm measured).
d
like full drive, wave drive also does not work but half drive works

Hi,
This is the important bit.


The electrical specs.

Do you have a DMM, what does your 12V supply measure when you try the motor, half step and full step?

Tom... :smiley: :+1: :coffee: :australia:

The L298N is an ancient brushed DC motor driver, and is totally unsuitable for this low-impedance (2.1ohm/1.5Amp) stepper motor. On a 12volt supply, this combination would try to draw more than 6Amp, which would burn the stepper, or the driver, or the supply.
Get a real (current controlled) stepper driver, like the DRV8825.
Leo..

Hi,

stepper.pdf (399.3 KB)

Tom... :smiley: :+1: :coffee: :australia:

You must sequence alternating A and B, as in A, B, A', B', A, B, A', B'.
If you sequence A, A', B, B', ... it won't work.

A and B are 90 degrees apart electrically, and A -> A' is 180 degrees, so it looks like you were trying to do 0, 180, 90, 270, 0, 180, 90, ...

Hi,
For a BiPolar Stepper;

Can I suggest @eestudent tries 100 rather than 10 in the step delay?

Tom... :smiley: :+1: :coffee: :australia:

That table is bogus. The sequence is A, B, #A, #B.