# Make the step motor jump [Help]

Hello peeps,

Ive got some questions that I hope u, the community can help me with.

I have a bipolar stepper motor, which has 4 cables (2 pairs A and B) and what I am in need of help with is how you can make the motor jump from one step to an other.

If we look at the thruth table(?), I can come up with a conclusions.

• A1A2B1B2 = this has up to 16 different states, from 0000 - 1111

Questions:
What do I need to input to make it move 1 step forward, or 1 step backward?
If I want it to take 2 step forwards, what inputs does it need?

There are so many options to make, so I thought it would be easier by asking.

Cheers

Edit:
Why am I doing this? Because I want the motor to jump to another step immediatly, I know that you can do this cause there are magnets involved and such.

I have successfully made it rotate ofcourse, but thats not what Im out after.

Think of the currents in each winding - for each winding A, B there are two directions for the current, +, -

For wave-mode you'd sequence A+, B+, A-, B-
For full stepping its A+B+, A-B+, A-B-, A+B-
For half-steps its A+, A+B+, B+, B+A-, A-, A-B-, B-, B-A+

For a bipolar drive the controller will often do this sequencing for you. For simple unipolar drive each of the 4 signals directly controls A+, A-, B+ and B-.

So what motor controller do you have?

What do you think is the difference between making it rotate and making it step. To me it is the same thing.

The name of the motor controller is Dual H Bridge DC Stepper Motor Drive Controller Board Module L298N for arduino
Can be found here L298n Dual H Bridge DC Stepper Motor Drive Controller Board Module for Arduino for sale online | eBay.

And grumpy, it is the same but not at the same speed. If you use the example in arduino and make it rotate, there will be a delay for it to reach spot x. But if I just make it "jump" to spot x it will go way more faster.

Cheers.

But if I just make it "jump" to spot x it will go way more faster.

No it won't.

You have to give it enough steps to rotate to point X, it can not be made to jump there.

The speed limit on a stepping motor is determined by a lot of factors, the main one being the voltage you drive it at. To get maximum speed you need a regulating driver. This is not the type you have.

Well how can I maximize the rotation of the stepper motor then, if Im using this controller I have.

Is it all about the voltage then?
And you know the revolution example, is there a better way than using this code?

Well how can I maximize the rotation of the stepper motor then

By trying to see how fast you can pulse the motor before it stalls. Then take less than this as a start point and ramp up the maximum speed, you find by experiment. Note you will also have to ramp down from this speed so you have to incorporate that into your code.

Is it all about the voltage then?

When it comes to maximum speed the faster you can get the current into the coil the faster you can step the motor without stalling. The only way to get the current into the coil faster is to start off with a voltage that is way too big and then cut it off when it reaches the coil's maximum current.

is there a better way than using this code?

Yes write your own code to output your control pattern, delay and then repeat for the next pattern. Adjust the delay for adjusting the speed.

I see, thanks for the replies. Now my mind is more clear about these stuffs.

Right now Im trying several input sequenses, but there are so many combinations with ones and zeroes. Do you have any clue what I should input to make it move forward?

edit:
I managed to make it work, but only with halfstep. How do you make it fullstep?
Here are the values to make it go 1 step (but it goes pretty slow…)

There are like thousend of different sequenses but none of em works.

``````B2B1A2A1 STEP

0111    1
0110    2
1110    3
1010    4
1011    5
1001    6
1101    7
0101    8
``````

Cheers

Second Edit:
Well now I successfully got it to work with full step.
Id like to share the code, and have some thoughts of how I could make it faster, I dont think I can speed this up anymore without letting the stepper motor have the same cords all the time.

What Im trying to do is a frameless harp.

Here is a prototype just to make the rotating.

`````` int motorPin1 =8;
int motorPin2 =9;
int motorPin3 =10;
int motorPin4 =11;
int motorDelay = 3;

void setup() {
Serial.begin(9600);
}

void loop() {

for(int StepX = 8 ; StepX > 0; StepX--){
step_backward(1);
delay(3);
}

for(int StepX = 0 ; StepX < 8; StepX++){
step_forward(1);
delay(3);
}
}

int step_forward(int y){
for(int x = 0 ; x < 1 ; x++){
digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, HIGH);
digitalWrite(motorPin4, LOW);
delay(motorDelay);

digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, HIGH);
digitalWrite(motorPin3, HIGH);
digitalWrite(motorPin4, LOW);
delay(motorDelay);

digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, HIGH);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, HIGH);
delay(motorDelay);

digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, HIGH);
delay(motorDelay);
}
}

int step_backward(int y){

for(int x = 0 ; x < 1 ; x++){

digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, HIGH);
delay(motorDelay);

digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, HIGH);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, HIGH);
delay(motorDelay);

digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, HIGH);
digitalWrite(motorPin3, HIGH);
digitalWrite(motorPin4, LOW);
delay(motorDelay);

digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, HIGH);
digitalWrite(motorPin4, LOW);
delay(motorDelay);
}
}
``````

Full Step = A B -A -B
Wave = AB -AB -A-B A-B
Half Step = A AB -AB -A -A-B -B A-B

The only way to make the stepper motor move without tieing up your Arduino is to have a second processor (Arduino, ATtiny2313...) doing the move and then signalling back to the main unit when it has completed the move.

The only way to make the stepper motor move without tieing up your Arduino

No you can do it with interrupts. Generate those at the rate you want to step at and have the ISR output the next pattern in the sequence.

Do you have any clue what I should input to make it move forward?

http://www.thebox.myzen.co.uk/Workshop/Motors_4.html