kidi3
Full Member level 1
Hi guys..
I am at the moment trying to make a stepper motor move, but can't seem to make it happen.
I am interfacing it through a control board, which takes the input Step, Dir, En, and 5V.
I am providing those inputs signal from an arduino, but can't get the damn thing to move. all it does it move a step forward and backwards, like it being stuck or and tries to wiggle out of something.. What could the reason be..
The code i am running om my arduino is this:
And the things are connected as such:
I suspect the issue is caused by the battery and the arduino isn't sharing the ground pin, but on the other hand. Only one ground signal is provided which is from the negative terminal of the battery. Which make me question what might be wrong?
The control board i am using is a ST330-v3
And the motor i am using is a bipolar stepper motor.
I am at the moment trying to make a stepper motor move, but can't seem to make it happen.
I am interfacing it through a control board, which takes the input Step, Dir, En, and 5V.
I am providing those inputs signal from an arduino, but can't get the damn thing to move. all it does it move a step forward and backwards, like it being stuck or and tries to wiggle out of something.. What could the reason be..
The code i am running om my arduino is this:
Code:
#include "stepper_motor.h"
int max_step = 200;
stepper_motor::stepper_motor()
{
pinMode(BUILTIN_LED,OUTPUT);
pinMode(step_pin,OUTPUT);
pinMode(dir_pin,OUTPUT);
pinMode(en_pin,OUTPUT);
alive_bool = true;
position_bool = false;
step_count = 0;
}
void stepper_motor::step_pwm()
{
if(position_bool==true)
{
//Dir pin low
digitalWrite(step_pin, LOW);
digitalWrite(dir_pin,LOW);
digitalWrite(en_pin,LOW);
delay(0.005);
digitalWrite(step_pin, LOW);
digitalWrite(dir_pin,LOW);
digitalWrite(en_pin,HIGH);
delay(0.005);
int step = 0;
while(step < max_step)
{
digitalWrite(step_pin,HIGH);
delay(1);
digitalWrite(step_pin,LOW);
delay(1);
}
//digitalWrite(en_pin,LOW);
//position_bool = false;
}
else
{
//Dir pin high
delay(1000);
digitalWrite(step_pin, LOW);
digitalWrite(dir_pin,LOW);
digitalWrite(en_pin,LOW);
delay(0.005);
digitalWrite(step_pin, LOW);
digitalWrite(dir_pin,LOW);
digitalWrite(en_pin,HIGH);
delay(0.005);
digitalWrite(step_pin, LOW);
digitalWrite(dir_pin,HIGH);
digitalWrite(en_pin,HIGH);
int step = 0;
while(step < max_step)
{
digitalWrite(step_pin,HIGH);
delay(1);
digitalWrite(step_pin,LOW);
delay(1);
}
//digitalWrite(en_pin,LOW);
//position_bool = true;
}
}
And the things are connected as such:
I suspect the issue is caused by the battery and the arduino isn't sharing the ground pin, but on the other hand. Only one ground signal is provided which is from the negative terminal of the battery. Which make me question what might be wrong?
The control board i am using is a ST330-v3
And the motor i am using is a bipolar stepper motor.