MyRoboPathOpen Robotics Lab
Arduino Uno #15 of 35
Est. 0.75 Hours
Budget: $4 - $6
Beginner

28BYJ-48 Stepper Motor & ULN2003 Driver Control

Command exact sub-degree angular rotations using a 64:1 geared unipolar stepper motor and ULN2003 Darlington array.

Step into precision open-loop motion control with the 28BYJ-48 5V stepper motor and ULN2003 driver board. Learn how sequential 4-coil energization moves the rotor by exact discrete increments (2048 full steps per revolution) for CNC axes, camera pan rigs, and clock hands.

Arduino Uno R328BYJ-48 StepperULN2003 DriverStepper.h LibraryPrecision Angular Motion
28BYJ-48 Stepper Motor & ULN2003 Driver Control Blueprint
28BYJ-48 Stepper Motor & ULN2003 Driver ControlCAD Blueprint

Key Learning Objectives & Robotics Concepts

By building and programming this project, you will master the following core engineering skills:

1Understand unipolar 4-phase coil energization and why Arduino Stepper.h expects pin order (8, 10, 9, 11).
2Calculate angular resolution: 360° / 2048 steps ≈ 0.176° per full step.
3Use the ULN2003's four onboard phase LEDs (A, B, C, D) to diagnose coil sequencing visually.
4De-energize motor coils during standby to eliminate motor warmth and save battery energy.

Power Architecture & Voltage Staging

5V / 3.3V Regulated Power

The 28BYJ-48 draws ~200–240mA continuously across two energized stator coils. For reliable torque without stressing Arduino's onboard regulator, power the ULN2003 5V-12V jumper header from an external 5V supply with GND tied to Arduino GND. ULN2003 includes internal flyback clamping diodes for coil inductance; de-energize coils when idle to prevent unnecessary heating.

28BYJ-48 Stepper Motor & ULN2003 Driver Control Power Architecture Schematic
Figure: Regulated Arduino Uno supply rails, current budget, and component protection.Power Schematic

Bill of Materials (BOM) & Hardware Components

Bill of Materials for 28BYJ-48 Stepper Motor & ULN2003 Driver Control
ComponentSpecifications & AlternativeQtyApprox Cost
Arduino Uno R3ATmega328P @ 16MHz1$8.00
28BYJ-48 5V Unipolar Stepper Motor64:1 internal gearbox, 2048 full steps/rev1$2.50
ULN2003 Stepper Driver Board7-channel Darlington sink array + 4 phase LEDs1$1.50
External 5V Supply / Jumper Wires5V 1A power + 6 jumper leads1$2.00

Electrical & System Architecture

Plug the 5-wire 28BYJ-48 JST connector into the ULN2003 board. Wire ULN2003 IN1→D8, IN2→D9, IN3→D10, IN4→D11, plus 5V and common GND.

Figure: Complete Arduino Uno R3 pin-to-pin wiring schematic for 28BYJ-48 Stepper Motor & ULN2003 Driver Control.
Figure: Complete Arduino Uno R3 pin-to-pin wiring schematic for 28BYJ-48 Stepper Motor & ULN2003 Driver Control.Wiring Schematic

Autonomous Behavior & Finite State Machine (FSM)

Deterministic Arduino loop handling 28BYJ-48 5V Stepper + ULN2003 Driver Board acquisition, filtering, and real-time output updates.

Figure: Firmware execution flow and state transitions for 28BYJ-48 Stepper Motor & ULN2003 Driver Control.
Figure: Firmware execution flow and state transitions for 28BYJ-48 Stepper Motor & ULN2003 Driver Control.Control Algorithm

Step-by-Step Physical Assembly & Wiring Tutorial

Follow each of the 5 sequential milestone stages with technical photos, wiring checks, and pre-flight tests.

1

Inspect ULN2003 Power Jumper & JST Socket

Duration: 5 Mins

Confirm the small 2-pin jumper cap next to the power header is installed (enables motor power).

28BYJ-48 Stepper Motor & ULN2003 Driver Control hardware layout diagram
Stage 1: 28BYJ-48 5V Stepper + ULN2003 Driver Board hardware inspection & pinout overview.Stage 1 Diagram
Step Action Checklist:
  • Plug the white 5-pin JST cable from the 28BYJ-48 into the ULN2003 socket (keyed one way).
  • Confirm the yellow/black power-enable jumper cap sits across the two pins beside the +/- header.
  • Attach a small flag of tape to the motor shaft so rotation angle is easy to see.
Engineering & Tuning Tip: The 4 red LEDs (A, B, C, D) on the ULN2003 board show live coil activation—invaluable for debugging!
2

Wire IN1–IN4 to Pins D8–D11

Duration: 5 Mins

Connect control inputs sequentially and establish a clean common ground.

28BYJ-48 Stepper Motor & ULN2003 Driver Control breadboard wiring check diagram
Stage 2: Breadboard layout & Arduino Uno pin-to-pin wiring audit.Stage 2 Diagram
Step Action Checklist:
  • Connect ULN2003 IN1→D8, IN2→D9, IN3→D10, IN4→D11.
  • Connect ULN2003 (-) to Arduino GND (and external 5V PSU negative if used).
  • Connect ULN2003 (+) to 5V power rail.
Engineering & Tuning Tip: Even though wiring is sequential (8,9,10,11), notice the Stepper constructor passes (8, 10, 9, 11) for proper 28BYJ-48 phasing!
3

Run Slow Phase-LED Diagnostic

Duration: 5 Mins

Verify ULN2003 LEDs A→B→C→D illuminate one by one in smooth sequence.

28BYJ-48 Stepper Motor & ULN2003 Driver Control power rail protection diagram
Stage 3: Supply rail check (External 5V 1A Recommended (Common GND with Uno)) and circuit protection verification.Stage 3 Diagram
Step Action Checklist:
  • Upload the diagnostic sketch below.
  • Watch LEDs A, B, C, D chase smoothly while the shaft crawls forward.
  • If the motor vibrates in place without turning, check the (8, 10, 9, 11) pin sequence.
Engineering & Tuning Tip: The 28BYJ-48 maxes out near 14–15 RPM on 5V; commanding 30 RPM simply stalls the rotor.
4

Upload Full Revolution CW/CCW Firmware

Duration: 10 Mins

Flash the precision angular controller and observe exact 360° clockwise and 180° counter-clockwise turns.

28BYJ-48 Stepper Motor & ULN2003 Driver Control serial telemetry verification diagram
Stage 4: Firmware upload & 115200 baud Serial Monitor verification.Stage 4 Diagram
Step Action Checklist:
  • Upload the production sketch below.
  • Watch your tape flag rotate an exact full circle (+360°), pause coolly, then return half a turn (-180°).
  • Check Serial Monitor for live step count and angle logs.
Engineering & Tuning Tip: Calling releaseCoils() sets D8–D11 LOW during pauses so the motor stays cool instead of drawing 240mA holding torque.
5

Tune RPM & Torque Balance

Duration: 5 Mins

Test speeds between 5 RPM (highest torque) and 13 RPM (fastest reliable slew).

28BYJ-48 Stepper Motor & ULN2003 Driver Control live operational logic diagram
Stage 5: Live operational logic flow & calibration verification.Stage 5 Diagram
Step Action Checklist:
  • Try setSpeed(6) vs setSpeed(12) and observe quiet smoothness.
  • Confirm motor casing remains comfortably warm after 2 minutes of operation.
  • Verify shaft returns accurately to its starting tape mark.
Engineering & Tuning Tip: For non-blocking multi-stepper control with smooth acceleration ramps, upgrade later to the AccelStepper library.

Subsystem Benchtop Verification Scripts

Test each hardware subsystem independently before deploying the full autonomous firmware.

1Bench Diagnostic: 28BYJ-48 5V Stepper + ULN2003 Driver Board Hardware Check

Subsystem Diagnostic

Minimal standalone sketch to verify pin wiring and signal response for 28BYJ-48 5V Stepper + ULN2003 Driver Board before running the full project firmware.

Arduino IDE Diagnostic ScriptC++ / Arduino
// Diagnostic: ULN2003 Coil Phase LED Chase Check
void setup() { for (int p=8; p<=11; p++) pinMode(p, OUTPUT); }
void loop() {
  for (int p=8; p<=11; p++) { digitalWrite(p, HIGH); delay(250); digitalWrite(p, LOW); }
}
Expected Output: ULN2003 onboard LEDs A, B, C, D blink sequentially one by one.

Complete Production Firmware

Full working C++ source code with pin mappings, non-blocking timers, and FSM avoidance routines.

arduino_uno_28byj48_stepper_motor_uln2003.ino
arduino_uno_28byj48_stepper_motor_uln2003.inoArduino C++
/**
 * Project 15: 28BYJ-48 Stepper Motor Precision Controller
 * Board: Arduino Uno R3 | ULN2003: IN1=D8, IN2=D9, IN3=D10, IN4=D11
 */
#include <Stepper.h>

const int STEPS_PER_REV = 2048; // 64:1 gear ratio full-step mode
// Note: 28BYJ-48 requires IN1-IN3-IN2-IN4 order for Arduino Stepper.h
Stepper motor(STEPS_PER_REV, 8, 10, 9, 11);

void releaseCoils() {
  for (uint8_t p = 8; p <= 11; p++) digitalWrite(p, LOW);
}

void rotateDegrees(float deg) {
  long steps = (long)((deg / 360.0f) * STEPS_PER_REV);
  Serial.print(F("Rotating ")); Serial.print(deg, 1);
  Serial.print(F(" deg (")); Serial.print(steps); Serial.println(F(" steps)"));
  motor.step(steps);
  releaseCoils();
}

void setup() {
  Serial.begin(115200);
  motor.setSpeed(11); // Optimal smooth RPM for 5V 28BYJ-48
  Serial.println(F("28BYJ-48 Stepper Controller Ready"));
}

void loop() {
  rotateDegrees(360.0);
  delay(1500);
  rotateDegrees(-180.0);
  delay(1500);
}

Firmware Architecture Explanation:

  • Passes pin sequence (8, 10, 9, 11) so Stepper.h energizes the 28BYJ-48 stator coils in proper spatial order.
  • Converts human-friendly degree targets into exact integer steps using 2048 steps per revolution.
  • Calls releaseCoils() after every move to cut standby current to 0mA and keep the motor cool.

Operational Verification & Pin State Matrix

1Double-check all 5 Arduino Uno pin connections against the wiring schematic before plugging in USB.
2Upload the Bench Diagnostic sketch first and confirm Serial Monitor at 115200 baud matches: ULN2003 onboard LEDs A, B, C, D blink sequentially one by one.
3Upload the complete production sketch and verify every condition in the operational truth table below.

Input Signal vs. System Output Truth Table:

Operational truth table for 28BYJ-48 Stepper Motor & ULN2003 Driver Control
Input / StatePin / SignalDetected ConditionExpected Output
Positive StepsIN1→IN3→IN2→IN4Clockwise SequenceShaft Rotates CW
Negative StepsIN4→IN2→IN3→IN1Counter-ClockwiseShaft Rotates CCW
Idle PauseAll Pins LOWCoils Released0mA Cool Standby

Engineering Troubleshooting Matrix

Engineering troubleshooting matrix for 28BYJ-48 Stepper Motor & ULN2003 Driver Control
ProblemLikely CauseDiagnostic CheckEngineering Solution
Motor hums and vibrates without spinningPin order passed as (8,9,10,11) instead of (8,10,9,11) or RPM too highCheck Stepper constructor and setSpeed valueUse Stepper(2048, 8, 10, 9, 11) and keep speed ≤12 RPM.
Motor turns only in one direction (never reverses)One of the four coil pins disconnected or mis-orderedRun Phase LED diagnostic to verify all 4 LEDs lightRe-seat IN1–IN4 jumpers and check JST plug.
Motor feels very hot while stoppedCoils left continuously energized at standstillCheck if two ULN2003 LEDs stay lit during pauseCall releaseCoils() whenever holding torque is not needed.

Engineering Challenges & Upgrades

Take your build to the next level with these progressive engineering upgrades:

Level 1Rotary Encoder Dial Control

Pair with Project 16 (KY-040) so every click of the knob steps the motor 15° CW or CCW.

Level 2Automated Analog Clock Hand

Advance the shaft 6° (34 steps) every second synchronized with Project 18 (DS3231 RTC).

Level 3Serial Angle Indexing Turntable

Type any degree angle in Serial Monitor to rotate a 3D-scanning turntable smoothly.