Use ← → to move, Home / End to jump, and F for fullscreen.
Figure descriptions
Slide 2 · What turns, and what stays still
Which part turns. Brushed DC motor: fixed north and south magnets form the stator, the coil on the shaft is the rotor, and brushes on a commutator switch its current as it turns. Stepper motor: four fixed coil poles A, B, A-bar and B-bar form the stator, a bar magnet is the rotor, and the external driver switches the coils.
Slide 3 · The simplest stepper: four steps per turn
The simplest stepper in four states. A+: the A poles are energized and the rotor magnet's north end points to 0°. B+: the B poles are energized and it points to 90°. A−: to 180°. B−: to 270°. Four states, 90° each, four steps per revolution.
Slide 4 · A common 1.8° hybrid stepper
Hybrid stepper cutaway: toothed stator poles surround a 50-tooth permanent-magnet rotor. Offset north and south rotor cups enable 200 steps per revolution, or 1.8 degrees per step. © W. G. Marshall 2024.
Slide 5 · Each pole sits a quarter tooth off the last
Unrolled tooth alignment: each stator pole has six teeth at 7.2 degrees pitch, with pole positions separated by 45 degrees. The rotor tooth pitch is also 7.2 degrees. Successive poles are offset by 0, 1.8, 3.6 and 5.4 degrees relative to the rotor, giving quarter-tooth alignment changes.
Slide 6 · Why 1.8° and 200 steps
Opened stepper motor exposing the rotor and surrounding copper stator windings connected to colored leads.
Slide 7 · Eight poles, two coils, four wires
Eight stator poles around a 50-tooth rotor, alternately belonging to coil A (A, A-bar, A, A-bar) and coil B (B, B-bar, B, B-bar), 48 stator teeth in all. Coil A is its four poles wound in series between leads A1 (red) and A2 (yellow); coil B is its four poles in series between B2 (green) and B1 (gray). Two coils with two ends each give four wires.
Slide 8 · Each coil: plus, minus or off
Vector sum of the two coil fields: coil A alone points along 0°, coil B alone along 90°, and both together point along 45° with a magnitude 1.41 times either one.
Slide 9 · Full step: four states, two coils on
Four full-step states in a two-by-two grid with both coils energized. Coil A poles lie left and right, coil B poles top and bottom; the field arrow points along a diagonal: state 0 A+ B+ inputs 1 0 1 0 at 45°, state 1 A− B+ 0 1 1 0 at 135°, state 2 A− B− 0 1 0 1 at 225°, state 3 A+ B− 1 0 0 1 at 315°.
Slide 10 · Half step: eight states
Eight half-step states, the field arrow advancing 45° each time: 0 A+ 1 0 0 0; 1 A+ B+ 1 0 1 0; 2 B+ 0 0 1 0; 3 A− B+ 0 1 1 0; 4 A− 0 1 0 0; 5 A− B− 0 1 0 1; 6 B− 0 0 0 1; 7 A+ B− 1 0 0 1. Inputs are in the order AIN1 AIN2 BIN1 BIN2.
Slide 11 · The two coils run a quarter cycle apart
Coil current direction against state index over two electrical cycles. Full step: coil A and coil B are square waves of plus and minus, B lagging A by one state, a quarter cycle. Half step: each coil steps plus, zero, minus, zero in a staircase, B again a quarter cycle behind A.
Slide 12 · From step delay to RPM
Shaft speed against step delay from RPM = 60 / (S t_d). The full-step curve with S = 200 crosses 60 RPM at 5 ms; the half-step curve with S = 400 crosses 60 RPM at 2.5 ms. Both fall as the delay grows.
Slide 13 · Loop overhead makes the motor slower
Timeline of the stepping loop: each state begins with a short overhead block for the GPIO writes and loop bookkeeping, t_oh, followed by a long sleep t_d, so the real step period is t_d plus t_oh.
Slide 14 · How fast can it step?
Coil current rising toward its final value with time constant L/R of about 1.5 ms for 2.8 mH and 1.86 Ω: it reaches 49 % of final current after 1 ms and 96 % after 5 ms.
Illustration of missed steps. The software count rises one step every period to 360°. The actual shaft follows until a loaded or too-fast stretch where it stays still for two periods, then keeps stepping two steps behind, ending 72° short with nothing to detect the error.
Slide 17 · The lab motor's pinout
Lab NEMA 17 pinout. Inside the motor, coil A connects the red and yellow leads and coil B connects the green and gray leads, each a few ohms. The leads leave in the order red A1, yellow A2, green B2, gray B1 and go to DRV8833 outputs AOUT1, AOUT2, BOUT2 and BOUT1.
Slide 18 · Datasheets use other colors
17HS4401S datasheet connection diagram: one winding between the black and green leads, the other between the red and blue leads, beside the rotor.
Slide 19 · The DRV8833: two H-bridges in one chip
DRV8833 datasheet functional block diagram: logic inputs AIN1, AIN2, BIN1, BIN2 and nSLEEP with pulldown resistors feed control logic, which drives two four-transistor H-bridges through gate drivers with overcurrent protection. Bridge A drives AOUT1 and AOUT2, bridge B drives BOUT1 and BOUT2, each returning through a sense resistor on AISEN or BISEN; a charge pump, internal regulator, over-temperature monitor and nFAULT output are also shown.
Slide 20 · One bridge, four input states
Four input states of one DRV8833 H-bridge. IN1 1, IN2 0: high-side switch 1 and low-side switch 2 on, current flows from VM through the coil from OUT1 to OUT2 to ground. IN1 0, IN2 1: the other diagonal, current from OUT2 to OUT1. IN1 0, IN2 0: all four switches off, outputs high impedance, coast. IN1 1, IN2 1: both low-side switches on, the coil is shorted and its current circulates, brake.
Slide 21 · The breakout board pinout
DRV8833 breakout board pinout. Top header, left to right: AIN1, AIN2, SLP, BIN2, BIN1, FLT, GND, VM, colored as logic inputs, sleep enable, fault output and power. Bottom header: AOUT1, AOUT2, BOUT2, BOUT1 coil outputs, taking the red, yellow, green and gray motor leads, then AS and BS current-sense nodes. Two 0.20 Ω sense resistors marked R20, labeled A and B, sit left of the chip, and a VMotor screw terminal sits on the right.
Slide 22 · Current limit and protection
DRV8833 datasheet motor control circuitry: xIN1 and xIN2 enter a PWM block and predriver that switch four transistors between VM and the xISEN pin; a comparator compares the voltage across the optional sense resistor with a 200 mV reference and feeds back to the PWM block.
Slide 23 · Wiring in blocks
Block wiring for the stepper. Four Raspberry Pi GPIO outputs at 3.3 V drive AIN1, AIN2, BIN1 and BIN2. Bridge A drives coil A through the red and yellow leads; bridge B drives coil B through the green and gray leads. A separate motor supply feeds VM, and the Pi ground, the DRV8833 ground and the supply negative are joined.
Slide 24 · Part 2 · A servo is a DC motor that knows its angle
Opened hobby servo showing a DC motor, reduction gears, position potentiometer, and a small control circuit.
Slide 25 · The circuit inside the case
Inside a servo. The signal wire's pulse width is converted to a target voltage and fed to the plus input of an error amplifier. A potentiometer between V+ and ground turns with the output shaft; its wiper voltage goes to the minus input. The error drives an H-bridge powered from V+, which drives the DC motor, gears and horn, and the horn turns the potentiometer, closing the loop.
Slide 26 · Not a stepper at all
Open versus closed loop. Stepper: the Pi's step sequence goes to the DRV8833, the coils, the rotor and the shaft angle, with no path back, so software assumes every step happened. Servo: the Pi's pulse width goes to a controller, motor and gears, and shaft angle, and a potentiometer on the shaft feeds the angle back to the controller.
Slide 28 · PWM sets a target, not the power
Pulse width sets the target angle. A 1 ms pulse, 5 % duty, sets the horn to −60°; 1.5 ms, 7.5 % duty, to the center; 2 ms, 10 % duty, to +60°. The mapping is nominal and must be calibrated for each servo.
Slide 29 · Three pins: what goes where
MG996R servo pinout: orange carries a 50 Hz signal from a 3.3 V GPIO; red connects to a separate regulated 5–6 V bench supply; brown joins supply negative and Pi ground. Current figures shown are from the supplied reference sheet; verify the actual servo version.
Slide 30 · Calibrate against what you measure
Illustrative servo calibration: measured angle against measured pulse width from 0.8 to 2.2 ms, rising from about 0 to 180°, with a straight-line fit. A residual panel below shows scatter within about ±5° with a slight systematic curve.


























