Thursday, January 20, 2011

Driving a Stepper

A stepper motor is a motor which can be turned in discrete steps whose size can be controlled by using various control schemes.

Lots of information on stepper motor is available on the following sites.
Here I have demonstrated the concept of micro stepping on a stepper motor. The stepper motor has a discrete step size. This means that when individual pulses are applied to the winding, the motor will rotate in a constant angle only. This angle is decided by the internal construction of the stepper ie by the number of magnetic poles and their location. Here I have used a stepper motor hacked from some machine.....and driven it using a quad push pull buffer (L293). This is  common misconception that L293 is an H Bridge.....but actually it is a push pull buffer which can also be used as an H Bridge.

I am using Unipolar Control method to drive the stepper. Now I have 4 windings of the stepper in space quadrature; if I pass AC current through the windings in phase quadrature torque will be generated in the windings (read Electric Machines by PS Bhimbra for the explanation). Thus 4 sinusoidal waves are generated using 2 individual PWM sources in the Attiny 861 microcontroller. This is passed through the L293 buffers to enable current flow in the windings at appropriate moments. This system results in smooth motion of the stepper motor as shown below.


The stepper motor system is basically a low pass system and hence we can safely conclude that the analog value of the PWM is being applied directly across the windings of the stepper which makes it rotate.

1) Sine - Winding A1
2) Cosine - Winding B1
3) minus Sine - Winding A2
4) minus Cosine - Winding B2

Now since the characteristic step size of a stepper is constant, the angle term in the sinusoidal waves can be varied in discrete steps to make the motor move. If the angle term is changed in steps of 90 degrees its called Full Stepping.....for 45 degrees its Half Stepping...and if the change in angle is less than 45 degrees then its called Micro Stepping. The micro step size can be decreased continuously until a significant amount of error is observed in the motion on the motor. The only shortcoming of micro stepping is that the resultant output torque is decreased. This process of micro-stepping is used in numerous applications. I am using it to build a CNC Milling and Drilling Machine to create 3D models from soft substances like wax and plastic.