Skip to content
E

Motor

Controlling Stepper 28BYJ48 Motor with ESP32

What is the Stepper 28BYJ48?

Stepper 28BYJ48 practical reference

A cheap 5V geared stepper motor bundled with the ULN2003 driver board, common in camera sliders and small CNC-style projects.

Key specifications

  • Motor type: 5-wire unipolar stepper with internal ~1:64 gear reduction
  • Step angle: 5.625°/64 per internal step — roughly 4096 half-steps per output-shaft revolution through the gearbox
  • Operating voltage: 5 V DC (matches the bundled ULN2003 driver board; a 12V-coil variant also exists)
  • Driver IC: ULN2003 Darlington transistor array, 4 inputs (IN1-IN4)
  • Current draw: ~240 mA per phase — low torque, not suited to driving loads heavier than light gears or small pointers

Pinout and connection notes

The motor connects to the driver board via its own keyed JST connector, not loose wires — only IN1-IN4 and the power terminal go to your microcontroller and supply.

  • IN1: Coil control input 1 — connect to a digital output pin
  • IN2: Coil control input 2 — connect to a digital output pin
  • IN3: Coil control input 3 — connect to a digital output pin
  • IN4: Coil control input 4 — connect to a digital output pin
  • -: Ground, on the driver board's power terminal
  • +: Power, 5V DC, on the driver board's power terminal — the motor's 5-pin JST plugs directly into the driver, no separate motor wiring needed

Integration checklist

  1. Confirm the exact part number and breakout-board revision.
  2. Verify supply voltage, current demand, logic levels, and signal direction against the datasheet.
  3. Check controller pin assignments and bus address or interface mode against the example code.
  4. Power up with external loads disconnected, then test signals before full integration.
  5. If readings or communication fail, check power and ground first, then pin mapping, interface settings, and library initialization.

Troubleshooting and reproducibility

Record the board used, wiring, library/version, supply arrangement, and measured behavior. Use the selected board-specific wiring example as the source of truth. Never assume visually similar modules share identical voltage tolerance or pin order.

Setting Up Stepper 28BYJ48 with ESP32

Library

AccelStepper by Mike McCauley

Arduino IDE → Tools → Manage Libraries → search "AccelStepper"

Wiring

Component pinESP32 pinNote
IN1GPIO14
IN2GPIO27
IN3GPIO26
IN4GPIO25
+5V (external supply recommended)The ULN2003 board's onboard regulation is minimal -- an external 5V supply avoids brownouts on the ESP32 when the motor is under load
-GNDCommon ground with the ESP32 is required even with an external supply

Swipe sideways to see every column →

C++

AccelStepper's HALF4WIRE mode expects pins in IN1-IN3-IN2-IN4 order, not IN1-IN2-IN3-IN4 -- get this wrong and the motor buzzes without turning. ~4096 half-steps make one full revolution on the standard 28BYJ-48 gearing.

Related Components

Related Guides & Projects