Understanding Motor's Step

Thread Starter

zx_spectrum

Joined Aug 28, 2022
3
Hello
I am new to stepper motors but I have learned to program them using TM4C123 (Cortex-M) thus:
1- I am not using Arduino
2- I am not using any library but rather I am programming stepper motors from scratch using assembly language

I do understand very well how to program the sequence code and how to control speed and direction.
my motor NEMA17 has 200 steps per rotation with 1.8 degree for step.
but it seams to me that it is impossible to make the motor run for arbitrary number of steps; it always has to be multiple of 4 steps (for a full step sequence) and thus we always have to rotate the motor for angle of multiple of (4*1.8) degree.
usually we loop through a sequence {0x05, 0x06, 0x0A, 0x09} multiple times thus the smallest step possible is (4*1.8 ) and that is by looping through all codes in the sequence.
what if I wanted to make the motor rotate for only 1.8 degree, which code should I send? is it 0x05? but this would work if this is the first step but if a previous single step was taken then 0x05 would move the rotor back to previous position as the motor now need 0x06 for the next step.
what if I wanted the motor to take 5 steps then should I send 0x05, 0x06, 0x0A, 0x09 and then 0x05 again ?
and after that if I wanted to rotate for another single step shouldn't I send 0x06?
how can I keep track of which code would represent the next step at the current state of the motor?
I asking this because I am trying to write a subroutine that take a parameter of any arbitrary number of steps and rotate the motor

am I missing something here ??
thank you for your effort
 

MisterBill2

Joined Jan 23, 2018
13,144
A stepper moves one step as the outputs change from one pattern to the next. This means that the drive must change from whatever the pattern is at the present position to whatever the pattern must be at the next position.
For operating in the full step mode there is a loop of four output combinations that are stepped through. So to take a single step the outputs must change, all at the same time, to the next pattern in the sequence.
It is also possible to operate in a half step mode, which has a sequence with eight different combinations of the four outputs, and rotates only 0.9 degrees for each change.
Some place in the information about that stepper motor the sequence should be found.

And in response to the last question, YES, you are missing a great amount of information.
 

Sensacell

Joined Jun 19, 2012
3,067
Your approach is a difficult one.
How do you handle acceleration? Without it, the speed will be severely limited.
Without doing some very tricky stuff with timers, this is a hard nut to crack.
 

Thread Starter

zx_spectrum

Joined Aug 28, 2022
3
A stepper moves one step as the outputs change from one pattern to the next. This means that the drive must change from whatever the pattern is at the present position to whatever the pattern must be at the next position.
For operating in the full step mode there is a loop of four output combinations that are stepped through. So to take a single step the outputs must change, all at the same time, to the next pattern in the sequence.
It is also possible to operate in a half step mode, which has a sequence with eight different combinations of the four outputs, and rotates only 0.9 degrees for each change.
Some place in the information about that stepper motor the sequence should be found.

And in response to the last question, YES, you are missing a great amount of information.
everything you said is already mentioned in my original post but what are the things that I am missing
if you could point to a link would be great
 

MisterBill2

Joined Jan 23, 2018
13,144
The first post also complained about taking four steps, and I was explaining that it does not need to work that way. This approach is not difficult,it was originally done with 7400 series TTL IC devices arranged to count in a loop.
The fact is that stepper motors ARE limited in the speeds that they can run, and that accelleration is provided by a variable frequency pulse generator driving the counter.
There is no reason at all for needing to move in groups of four steps, since the position is stable with any of the four drive patterns applied. And the normal driver circuit contains no timers and can stop at any of the four states.
Superior Electric was the primary producer of stepper motors back in 1975 and they produced several publications that explained everything one needed to know to apply stepper motors successfully. I have not checked to see if they have those on their website, but that would be a great place to start the search for more detailed explanations.
You did not mention about if the motor was a four-lead type or a six lead type. The driver circuits are very different.
 

Thread Starter

zx_spectrum

Joined Aug 28, 2022
3
The first post also complained about taking four steps, and I was explaining that it does not need to work that way. This approach is not difficult,it was originally done with 7400 series TTL IC devices arranged to count in a loop.
The fact is that stepper motors ARE limited in the speeds that they can run, and that accelleration is provided by a variable frequency pulse generator driving the counter.
There is no reason at all for needing to move in groups of four steps, since the position is stable with any of the four drive patterns applied. And the normal driver circuit contains no timers and can stop at any of the four states.
Superior Electric was the primary producer of stepper motors back in 1975 and they produced several publications that explained everything one needed to know to apply stepper motors successfully. I have not checked to see if they have those on their website, but that would be a great place to start the search for more detailed explanations.
You did not mention about if the motor was a four-lead type or a six lead type. The driver circuits are very different.
no it is bipolar stepper (4 lead) I ma driving it with L298N.
my main concern is about making ir rotate in arbitrary number of steps; 6 steps for example using full-step sequence
 

MisterBill2

Joined Jan 23, 2018
13,144
OK, a bipolar stepper needs an "H-Bridge" driver with the polarity reversing on alternate drivers. So the control will be a four bit up/down counter with a bit of logic to provide the required polarity changes for the two bridge drives.
It is too early in the morning here for me to generate that circuit,
For the number of steps, load the number into a presettable down counter and then with every stepper step, decrement the counter on, and when zero is reached, stop.. I think that the CD4516 was a good presettable up/down counter. But that is from long ago.
 
Top