THE ANNIN ROBOTICS FORUM HAS MOVED TO A NEW COMMUNITY. 👉
Basic programming o...
 
Notifications
Clear all

Basic programming of nema 11 stepper motor with arduino

1 Posts
1 Users
0 Reactions
102 Views
Kenny T
(@kenny-t)
New Member
Joined: 2 months ago
Posts: 1
Topic starter  

I bought the nema 11 motor with a gearbox with a gear ratio of 13.73:1 plus a dm320 driver, and made the connection to the arduino. Where PUL = 5, DIR = 6, and OPTO = 7, Pin 7 is programmed high to be activated with 5v, now when programming I use 1/2 step in the driver configuration, which is actually 400 steps for my 1.8 degree motor, but since the motor has a gearbox included and I have to change my steps, which would be, 1.8 / 13.73 = 0.13 degrees, which would be 2769.23 steps for one motor revolution, but included at 1/2step = 400 steps in the driver would be 5538.46 revolutions of the motor so that the gearbox can make one revolution. When I program it, the gearbox makes a half turn. My question is, is there a defect with the motor? Is my analysis correct? Or do you have to include something else in the programming?

 

This is the program:

int x;

int PUL = 5;

int DIR = 6;

int EN = 7;

void setup() {

pinMode(PUL,OUTPUT); //

pinMode(DIR,OUTPUT); //

pinMode(EN, OUTPUT);

digitalWrite(PUL, LOW);

digitalWrite(DIR, LOW);

digitalWrite(EN, HIGH);

}

void loop() {

digitalWrite(DIR,HIGH); //

for(x = 0; x < 5538.46; x++) //

{

digitalWrite(PUL,HIGH); //

delayMicroseconds(500); //

digitalWrite(PUL,LOW); //

delayMicroseconds(500); //

}

delay(1000); /

digitalWrite(DIR,LOW); //

for(x = 0; x < 5538.46; x++)

{

digitalWrite(PUL,HIGH);

delayMicroseconds(500);

digitalWrite(PUL,LOW);

delayMicroseconds(500);

}

delay(1000);

}

 

I would be grateful for the answer



   
Quote
Share:
Upload your Photo