Stepper motors are very accurate motors that are commonly used in computer disk drives, printers and clocks. Unlike dc motors, which spin round freely when power is applied, stepper motors require that their power supply be continuously pulsed in specific patterns. For each pulse, the stepper motor moves around one ‘step’, often 7.5 degrees (giving 48 steps in a full revolution).
There are two main types of stepper motors - Unipolar and Bipolar. Unipolar motors usually have four coils which are switched on and off in a particular sequence. Bipolar motors have two coils in which the current flow is reversed in a similar sequence.
Stepper Motor (bipolar)
Schematic
PCB
Move a bipolar stepper motor
Description
- Code Example:
-
let dirsB = %00001111 ; make pins output main: for b3 = 0 to 99 ; start a for...next loop gosub lstep ; call left step sub-procedure next b3 ; next loop for b3 = 0 to 99 ; start a for...next loop gosub rstep ; call right step sub-procedure next b3 ; next loop goto main ; repeat lstep: let b1 = b1 + 1 ; add 1 to variable b1 gosub stepit ; do the step return rstep: let b1 = b1 - 1 ; subtract 1 from variable b1 gosub stepit ; do the step return stepit: let b1 = b1 & %00000011 ; mask lower two bits of b1 lookup b1,(%1010,%1001,%0101,%0110),b2 ; lookup code into b2 let pinsB = b2 ; output b2 onto control lines return
Copy Code Submit an Example
Create Module

A bipolar stepper motor has 4 wires (2 pairs of coils). It can therefore be controlled by using two of the L293D motor driver create modules.
Bill of Materials
Description | Code | Qty | |
---|---|---|---|
Bipolar stepper motor | ? | 1 | Buy Now |
L293D motor driver | ICO030 | 1 | Buy Now |
16-pin 0.3" DIP IC Socket | ICH016 | 1 | Buy Now |
100nF Miniature Polyester Capacitor | CAP001 | 1 | Buy Now |
Simulation
Submit Your Own Code!
You must be logged in to submit code examples. Login now.
Share