Home › Builds › Stepper dial: a pot sets the angle

Stepper dial: a pot sets the angle

Bench build · Embedded (Arduino) · Intermediate · about 35 minutes

The motor shaft follows the pot, like a remote dial. A stepper moves in fixed steps, so the sketch always knows where it is without a sensor: it counts. A NEMA 17 takes 200 steps a turn (1.8° each). Its two coils need their current reversed in turn, so each gets an H-bridge: the L298N has two, switched by IN1–IN4. The sketch turns the pot reading into a target step, moves one step every 30 ms until it gets there, and switches the bridges off half a second later to stop the coils heating. This bench runs at half speed, so the simulator sees every step. On the real thing: use a 12 V, about 0.4 A NEMA 17 (around 30 Ω a coil), like the one here. Most NEMA 17s sold are 1.5–2 A, 1–3 Ω motors: on an L298N at 12 V they draw far more than either is rated for, so use an A4988 or DRV8825 driver with its current limit set; the same sketch drives one with STEP and DIR instead of four pins.

Stepper dial: a pot sets the angle: the finished build running on the simulator's bench

Build it in the labGuided build, test sheet and fault finding, free in your browser.

Parts list

Test procedure

Each test has an expected value and a pass range, like a factory test sheet:

  1. Follows the pot
  2. Turns the other way too
  3. Where you put it, within 6°

How it works

What it does: The motor shaft follows the pot, like a remote dial.

Build it (guided or ready-made), then run its test procedure below. Every test has an expected value and a pass range, just like a factory test sheet.

Things to try

  1. Turn the pot fast: the motor follows at its own pace, 10 RPM.
  2. Watch the coil current drop to zero half a second after it stops: without that, the L298N and the motor run warm all the time.
  3. The L298N loses about 2 V in its transistors; a DRV8825 or A4988 driver loses almost nothing and adds microstepping for smooth motion.

Background

Gauges, camera focus, 3D-printer axes and telescope mounts are steppers counting steps.

More builds: embedded (arduino)