05 - Software driver

Submitted by Webbot on June 10, 2008 - 11:06pm.

 

Previous discussions have described the way to wire up bi-polar and uni-polar motors. These configurations effect current drain, torque but don’t change the way they are programmed.

As we have already mentioned – unlike a DC motor – you cannot just apply a fixed current and get to the motor to spin. Instead you need to supply pulses to the coils in a certain order. There are various ways to0 do this and each one has trade-offs to do with torque vs current consumption. So now we will look at the possibilities:-

The most simple ‘pulsing’ is called ‘Wave Drive’ and sets the coils as follows:-

T

T + 1

T +2

T + 3

1a

High

Low

Low

Low

1b

Low

Low

High

Low

2a

Low

High

Low

Low

2b

Low

Low

Low

High

This method only energises one coil at a time. So current consumptions is low. But equally the amount of torque is also low.

The next ‘pulsing’ method is called ‘Full Step Drive’

T

T + 1

T +2

T + 3

1a

High

High

Low

Low

1b

Low

Low

High

High

2a

Low

High

High

Low

2b

High

Low

Low

High

This method energises both coils at the same time- so requires twice the amount of current but provides about 40% more torque compared to Wave Drive. The other benefit of this method is that 1a is always the ‘inverse’ of 1b, and likewise 2a is always the ‘inverse’ of 2b. So we could control the motor with two output pins from the controller and, in our motor driver hardware, we could use an inverter between 1a-1b and another between 2a-2b.

The last pulsing method is called ‘Half Step Drive’ or ‘Micro-stepping’.

T

T+1

T+2

T+3

T+4

T+5

T+6

T+7

1a

High

Low

Low

Low

Low

Low

High

High

1b

Low

Low

High

High

High

Low

Low

Low

2a

High

High

High

Low

Low

Low

Low

Low

2b

Low

Low

Low

Low

High

High

High

Low

This method alternates between energising 2 coils and 1 coil. So the current requirements, and torque delivered, sit half way between ‘Wave Drive’ and ‘Full Step Drive’. It also helps to avoidance something called ‘resonance’ which can occur when using ‘Full Step Drive’ at certain speeds. The other side effect is to double the number of steps per revolution – which helps accuracy – but halves the overall maximum speed.

What have we learned? There are at least 3 ways to drive a stepper motor depending on whether we want o optimise torque or minimise current consumption. Since these do not require hardware changes then we could dynamically change from one drive mode to another in software depending on circumstances. For example: on a flat surface we might choose ‘Wave Drive’ and when a tilt switch in the robot tells us we are going up a steep hill the then we could change to ‘Full Step Drive’. Since the choice of drive method effects current then you also need to make sure that the current requirement does not exceed the ability of your batteries or of your H-Bridge output stage components.