The physical operation of a stepper motor is performed by magnetism – yes, magnets! So here are some basics to do with magnetism:
1. Magnets have two poles – just like the earth – called North and South
2. ‘Opposite poles attract’ – ie the North of one magnet will create a physical attraction (pull) for the South pole of another magnet. And vice-versa.
3. ‘Similar poles repulse’ – ie the North poles of two magnets will create a physical repulsion (push) for the North pole of another magnet. The same goes applies for South and South.
4. Some magnets are ‘permanent’ – ie they are always magnets with North and South being in the same place. Remember those horseshoe shaped magnets you had as a child or used at school to mess around with iron filings?
5. Take a metal bar and wrap some wire around it. Putting current through the wire will turn the bar into a magnet. This is called an electro-magnet. Depending on which direction the current is moving through the wire will decide which end of the bar is North and which is South.
So lets create a simplistic model of a stepper motor (NB this is very simplistic so don’t try it – it may not work in practice - its just a theoretical example!).
1-Lets take a bar magnet (ie a metal bar that is a permanent magnet with one end always being North and the other always being South). Lets call this ‘Bar A’.
2-Now take a non-magnetised metal bar, wrap some wire around it to create an electro-magnet and call it ‘Bar B’.
3-Lets bang a nail through the middle of Bar A so that it can spin – ie it drives the wheel of our robot
4-Lets superglue Bar B to our work surface with one end of the bar pointing at the nail in Bar A.
So now we have something like this:-
So now we turn on the supply across Bar B so a current runs through it and it becomes a magnet. Lets assume that the left end of Bar B becomes South. So now we have:-
So now we have two South poles facing each other and we know that ‘similar poles repulse’. Bar B is super glued to the table so only Bar A can move – and that has a nail in it so it can only spin. So Bar A starts to spin. Whilst the South pole of Bar A spins away from Bar B then this ‘repulsion’ becomes less. But wait a moment – this means that North pole of Bar A gets closer to the South pole of Bar B and we know that opposite poles ‘attract’. So this will ‘pull’ the North pole of Bar A towards the South pole of Bar B
Until, eventually, Bar A has spun a complete 180 degrees.
At this point: Bar A will stop spinning because its North is ‘pulled’ by the South pole of Bar B.
We have just made one ‘step’ – but, now what! Well, we reverse the voltage in the wire around Bar B so that the magnetism of its poles get ‘flipped’ – so we now have:-
So now we have two North poles facing each other and we know that ‘similar poles repulse’ So, just like before, Bar A will do another spin through 180 degrees until, after our second ‘step’, we get:-
Reverse the current in Bar B, and hence the polarity, and we are back to where we started:-
and so we keep on going.
Hey we have a motor ! Even though it is super glued and nailed to our dinning room table!
So how do we control the speed of the motor and what limits the maximum?
In our simplistic example, then the quicker we change the polarity of Bar B then the quicker the motor (Bar A) will turn. However, in practice, this is not the case since the switch in current on Bar B has to co-inside with the position of Bar A so that the necessary ‘push’/’pull’ is applied at the correct time. Hence this depends on how fast Bar A can rotate and, since this is a physical movement, it does take a minimum finite amount of time. So assuming that we have:
and Bar A starts spinning (because South repels South). But then we change the polarity of Bar B almost immediately. Then Bar A is attracted back to where it came from and so the result is ‘No Movement’ even though you have sent ‘2 steps’. This physical movement duration therefore dictates the maximum frequency at which you can issue new step commands. A typical motor frequency may be 400Hz – ie you can do a maximum of 400 steps per second.
So what have we learned? We have a basic understanding of how stepper motors work and we have created a motor that turns 180 degrees for each step – so 2 steps make Bar A spin though a complete 360 degrees. We have also learned that a motor has a maximum number of steps per second.