Essentials of Mechatronics  ISBN: 0-471-72341-X- ©John Billingsley 2006 - published John Wiley & Sons, Inc

2/1/3.htm Stepper demonstrator

As well as showing the behaviour of a stepper motor, this is a good introduction to simulation.

You must allow scripts to run.

Click this link.  You will see code in a window, plus 'balls' that represent the currents in the windings and the rotor position.

The demonstration represents 'full-step' mode.

When the code is not running, you can edit the code in the window.  If you change the line with

count=(count+2)&7;

to

count=(count+1)&7;

you can see 'half step' mode in action.

You can also adjust the damping by editing the line that sets dtheta,

  dtheta=dtheta+((yd-yb)*xb-(xd-xb)*yb)*.1-0.2*dtheta;

changing the value from 0.2.

Each time you try running again, you will have to 'refresh' first.