Tricky Circuit

Stepper: commands with a direction

Turn counted steps into motion

A stepper motor advances its shaft in discrete steps. A full step is one complete advance; this example uses 1.8° per step. A motor driver is the power circuit that sequences current through two coils, wire windings that make magnetic fields.

Open interactive experiment

EXPERIMENT BENCH

Change the circuit settings, predict the readings, then check a challenge. These are learning models, with the assumptions explained in each lesson.

Sign in to save progress. Guest progress stays on this device.

Open laboratory in a full window

Why it works

The selected count previews one command from zero, not a running position counter. Turning the lab off clears the preview, not a real shaft. Torque, missed steps, current regulation and mechanical motion are omitted.

n is the step count, θ signed angle and r signed turns. Direction 0 means forward; 1 means reverse. Bipolar operation sends current both ways through each winding, not transistor regions. A and B name the two independent windings; +/− are current-direction commands. Phase 0 is the chosen starting reference for the four-state sequence, not a measured current. A negative angle marks direction.

Difficulty
  1. Build · Build it

    Power on with n = 25 and direction 0, forward. Get θ = 45° and r = 0.125 turns.

    Need a hint?

    n = 25 → θ = +45°; r = +0.125

  2. Explore · Change the command

    Set n = 100 and direction 1, reverse. Get θ = −180° and r = −0.5 turns.

    Need a hint?

    n = 100 → θ = −180°; r = −0.5

  3. Solve it · Solve the challenge

    Set n = 200 and direction 0, forward. Get θ = 360° and r = 1 turn.

    Need a hint?

    n = 200 → θ = +360°; r = +1

Extra reading and circuit recipes

Turn counted steps into motion

A printer can request small moves by counting steps. The command has an amount and a direction, while the driver must turn that request into winding currents.

θ = ±n × 1.8°; r = θ / 360°

Multiply the count by the full-step angle, then apply the direction sign. Divide by 360° to express the result in turns. The driver sequences magnetic fields; the arithmetic alone does not simulate that motion.

A useful pattern

For a 1.8° full-step example, 200 steps make 360°. Other motor step angles exist; 200 is not a universal motor constant.

Beyond the model

A commanded count cannot prove actual position. If a physical motor cannot follow its load, a step can be missed even though the command was sent.

A useful trap to avoid

Changing the count from 25 to 100 selects a new 100-step preview; it does not add 100 to the old 25. Forward and reverse are conventions chosen for this diagram.

Keep n = 50 and switch from forward to reverse. What changes?

  1. only the sign: +90° becomes −90°
  2. the angle magnitude doubles
  3. the count becomes 100
Read more

The count and 1.8° step size stay fixed. The direction changes the sign of the same 90° command.

Build it

Set n = 25, direction 0. Twenty-five full steps command one eighth of a turn.

n = 25; θ = 45°; r = 0.125

Change the command

Set n = 100, direction 1. The preview commands half a turn in reverse.

n = 100; θ = −180°; r = −0.5

Try another path

Compare 25 forward with 25 reverse, then 200 forward with zero. One whole turn returns a shaft to the same orientation, but is a different motion command.

ww1.microchip.com

Temu affiliate offers

Find your next electronics project

Explore these do-it-yourself project kits. Check the selected option, included parts and instructions on each offer.

Tricky Circuit may earn a commission if you buy through these Temu affiliate links. These are product ideas; they have not been bench-tested by Tricky Circuit and are not verified lesson parts lists.

Supplier photo of an assembled infinity mirror light cube illuminated on a dark background.

Supplier product photo

Build an infinity light cube

Listing specifies 5-volt direct current. Soldering required; battery and glue not included.

View kit on Temu

Supplier photo of a breadboard, jumper wires and assorted electronic components in a plastic storage case.

Supplier product photo

Try breadboard experiments

Breadboard, wires and assorted parts. Arduino controller board not included.

View kit on Temu

Supplier photo of an assembled blue surface-mount soldering practice board with a circular ring of small lights.

Supplier product photo

Solder a chasing-light board

Surface-mount soldering practice. Battery and battery holder not included.

View kit on Temu