I have a problem with a library AFMotor.h in the motor 2 coil

I use this code with a DVD motor

It works fine … but
when I started using the bigger motor ,Moving for a very very small distance

and used Arduino Mega 2560

and motor control shield

#include <Servo.h>
#include <AFMotor.h>

#define LINE_BUFFER_LENGTH 512

char STEP = MICROSTEP ;

// Servo position for Up and Down 
const int penZUp = 115;
const int penZDown = 83;

// Servo on PWM pin 10
const int penServoPin =10 ;

// Should be right for DVD steppers, but is not too important here
const int stepsPerRevolution = 48; 

// create servo object to control a servo 
Servo penServo;  

// Initialize steppers for X- and Y-axis using this Arduino pins for the L293D H-bridge
AF_Stepper myStepperY(stepsPerRevolution,1);            
AF_Stepper myStepperX(stepsPerRevolution,2);  

/* Structures, global variables    */
struct point { 
  float x; 
  float y; 
  float z; 
};

    
  } 
}

I would be willing to bet you did NOT use that code to get a stepper motor to run.

Paul

Yes :confused: :confused: :confused: :confused: , I use this code with the stepper motor
What should I use ????

Paul_KD7HB:
I would be willing to bet you did NOT use that code to get a stepper motor to run.

Paul

Is there any answer if you allow?

The code you have posted is not a complete program. It will not compile. So it will definitely not run anything.

Steve

ahdkfiri:
when I started using the bigger motor...

What makes you think that wimpy brushed DC motor shield (not stepper) can control a modern low impedance stepper motor.
Seems the wrong tool for the job.
Post the datasheet for that stepper motor.
Leo..

Wawa:
What makes you think that wimpy brushed DC motor shield (not stepper) can control a modern low impedance stepper motor.
Seems the wrong tool for the job.
Post the datasheet for that stepper motor.
Leo..

It seems I used the wrong library (AFmotor)
But now using the (((AF Stepper))) library
But there is an error in the pins


image upload

Wawa:
What makes you think that wimpy brushed DC motor shield (not stepper) can control a modern low impedance stepper motor.
Seems the wrong tool for the job.
Post the datasheet for that stepper motor.
Leo…

Am I wrong in using this control?

ahdkfiri:
Am I wrong in using this control?

A board with ancient L293 brushed DC motor driver chips is no match for modern low impedance steppers.
Max continuous current of those chips is less than 600mA.

As requested, post a link to the stepper motor.
We want to know the coil resistance (and current).

And the way you are powering that shield (voltage, current).
Leo..

Wawa:
A board with ancient L293 brushed DC motor driver chips is no match for modern low impedance steppers.
Max continuous current of those chips is less than 600mA.

As requested, post a link to the stepper motor.
We want to know the coil resistance (and current).

And the way you are powering that shield (voltage, current).
Leo…

Thank you for your reply
I am use external source ( 12v 1A ) to L293d

and stepper Motor (17HS2408)

Motor seems to have 8 ohm windings, with a 600mA current limit.

Coil current on a 12volt supply could be 12/8= 1.5Amp per phase.
Almost twice the max motor current. Enough to burn the motor windings.

You’re lucky that the ancient L293D drops about 4volt at max current.
But that still results in ~1Amp motor current.
And 1A/phase will fry the L293D chips.

You might be sort of ok with a 9volt/1.5A power supply.
But a much better option is to use dedicated stepper motor drivers, with the current set to <=600mA.
Then you also can keep your 12volt supply.
Leo…

Wawa:
Motor seems to have 8 ohm windings, with a 600mA current limit.

Coil current on a 12volt supply could be 12/8= 1.5Amp per phase.
Almost twice the max motor current. Enough to burn the motor windings.

You’re lucky that the ancient L293D drops about 4volt at max current.
But that still results in ~1Amp motor current.
And 1A/phase will fry the L293D chips.

You might be sort of ok with a 9volt/1.5A power supply.
But a much better option is to use dedicated stepper motor drivers, with the current set to <=600mA.
Then you also can keep your 12volt supply.
Leo…

I am sorry for the many questions
But do give up the control shield؟؟ and use a manual method
As in the chart

An L293D (used on the motorshield and in your diagram) is the wrong chip for a low impedance stepper motor.
Which part of that don't you understand.
Leo..

Wawa:
An L293D (used on the motorshield and in your diagram) is the wrong chip for a low impedance stepper motor.
Which part of that don't you understand.
Leo..

Well I understood .. i must change the slide used
And replace them with these

Paul_KD7HB:
I would be willing to bet you did NOT use that code to get a stepper motor to run.

Paul

Wawa:
An L293D (used on the motorshield and in your diagram) is the wrong chip for a low impedance stepper motor.
Which part of that don't you understand.
Leo..

Thank you all .. especially wawa
After fatigue and continued work I got the desired result by following this chart

now I have a special Shield

I got the required score with stepper motor

I hope there's an A4988 stepper driver under that heatsink, not an L293D.
Leo..

Wawa:
I hope there's an A4988 stepper driver under that heatsink, not an L293D.
Leo..

Unfortunately no .. I used the L293D, because I could not find a way to connect to A4988 and no one helped me. i need how to connect 3 a4988 controllers to Arduino manually as I did in L293D

ahdkfiri:
I could not find a way to connect to A4988 and no one helped me. i need how to connect 3 a4988 controllers to Arduino manually as I did in L293D

A CNC shield with up to four A4988 modules, as in post#13, could be an easy solution.

Several examples on Google Images how to connect two or more bare modules to an Arduino.
Each module only needs two control pins, and a shared 5volt/ground.
And ofcourse motor power from a separate motor supply.
Leo..