Hi there, I'm new in arduino and stepper motor . Basically i setup a bipolar stepper motor on to an arduino uno stack with motor shield kit v2.0 with the help on the tutorial . Does anyone know how to write a code so that my stepper motor can rotate from 45 to 90 degree and then stop for 5 seconds and go back to the origin position? I know its a very basic stuff, but i don't have no any electrical based or what so ever.
The last time I looked, there were at least two bazillions tutorials on the internet. Which ONE did you follow?
Does anyone know how to write a code so that my stepper motor can rotate from 45 to 90 degree
Well, first you rotate to 45 degrees. That's some undefined number of steps. Then, you step some more until you have rotated 1/4 turn. Then, you wait a while. The blink without delay function shows one way. The other example shows another way.
Then, you step in the other direction some undefined number of steps.
Now the number of steps won't be undefined for you, because you know something about your motor that you didn't share.
but the problem now is once i done upload it, my stepper motor doesn't move . basically it just vibrates there.
I used the usb to power supply my motor and also 4 AA batteries not at the same time.
If i power supply my motor using usb , the green light on my motor shield keeps blinking , and theres orange light lighted on my Arduino uno , i sensed there might have some problems.
So i change it to using 4 AA batteries to supply, but there another problem occurred. which is the motor is not moving at all even though there's no more orange light and the green light on the motor shield is lighted not blinking.
So i change it to using 4 AA batteries to supply, but there another problem occurred. which is the motor is not moving at all even though there's no more orange light and the green light on the motor shield is lighted not blinking.
What stepper motor do you have? I think that you are seriously underestimating the amount of current (and voltage) that a stepper motor needs. And, I mean seriously. A car battery is more like what you should be using.
now that i setup without speed , the motor start moving. but it started move one step to left and then one step to right continuously . I went to check on my wiring connection, its might be the problem. But the problem still occurred .
i don't think you get what i meant. aren't it suppose to move 50 steps from 0 degree to 45 degree since its written " Serial.println("Single coil steps");
myMotor->step(50, FORWARD, SINGLE); " and its 1.8 degree per step.
but it seems to move left and right continuously ( estimated less than 5 degree )