Maker.io main logo

Controlling a 28BYJ-48 Stepper Motor Using ULN2003 and Arduino

183

2026-02-09 | By Rachana Jain

License: Attribution-Share Alike Stepper Arduino

Stepper motors are commonly used in applications that require accurate position and speed control. Unlike standard DC motors that rotate continuously, stepper motors rotate in fixed angular steps. This makes them suitable for systems such as CNC machines, robotic mechanisms, automated devices, and positioning systems.

The 28BYJ-48 is a low-cost and beginner-friendly stepper motor that is widely used in Arduino-based projects. This article explains how a stepper motor works and how the 28BYJ-48 stepper motor can be driven using a ULN2003 driver module with an Arduino Uno.

How a Stepper Motor Works

A stepper motor is a brushless synchronous motor that operates using electromagnetic principles. It consists of two main parts: a rotor (the rotating section) and a stator (the stationary section). The stator contains multiple coils arranged in a circular pattern.

When current is applied to a coil, it generates a magnetic field that interacts with the permanent magnet rotor. By energizing the coils in a specific sequence, the rotor moves step by step in a controlled direction. Each electrical pulse sent from a controller corresponds to one mechanical step of the motor, allowing precise motion control.

Changing the order in which the coils are energized determines the direction of rotation, while changing the pulse frequency controls the speed.

Stepper Motor Operating Modes

Stepper motors can be operated using different stepping methods depending on torque, precision, and smoothness requirements.

Full-Step Mode (Single-Phase ON / Wave Drive):
Only one coil is energized at a time. This mode consumes less power but provides lower torque.

Full-Step Mode (Two-Phase ON):
Two coils are energized simultaneously, producing higher torque at the cost of increased power consumption and vibration.

Half-Step Mode:
This mode alternates between single-phase and dual-phase excitation, effectively doubling the number of steps per revolution. It improves smoothness and positioning accuracy.

Microstepping Mode:
Microstepping divides each full step into smaller steps by controlling the current through the coils. This results in smoother motion, reduced vibration, and higher precision.

Overview of the 28BYJ-48 Stepper Motor

The 28BYJ-48 is a 5V unipolar stepper motor that includes an internal gear reduction mechanism. This gearbox increases torque output while maintaining a compact size and low power consumption.

The motor uses a five-wire interface: four wires for the individual coils and one common power wire. By activating the coils in sequence, precise rotational movement can be achieved.

Key Specifications

  • Rated Voltage: 5V

  • Motor Type: Unipolar Permanent Magnet

  • Gear Reduction Ratio: 1:64

  • Stride Angle: 5.625°

  • Steps per Revolution:

    • Half-step mode: 4096

    • Full-step mode: 2048

  • Number of Phases: 4

28BYJ-48 Stepper Motor Pinout

28BYJ-48 Stepper Motor Pinout

ULN2003 Stepper Motor Driver Module

ULN Driver Board

Stepper motors draw more current than a microcontroller pin can supply directly. To safely drive the 28BYJ-48 motor, a ULN2003 driver module is used.

The ULN2003 IC contains multiple high-current Darlington transistor pairs that amplify control signals from the Arduino and provide adequate current to the motor coils. The module also includes protection diodes to prevent damage from inductive voltage spikes.

ULN2003 Pin Description

ULN Pinout

  • IN1–IN4: Control inputs connected to Arduino digital pins

  • VCC: Motor power supply (typically external 5V)

  • GND: Ground connection

  • Motor Connector: Interface for the stepper motor cable

An onboard jumper must be connected to enable power to the driver IC.

Interfacing 28BYJ-48 with Arduino Uno

To control the motor, the ULN2003 driver module is connected between the Arduino and the stepper motor. The Arduino sends step sequences through digital pins, while the driver handles current amplification and motor excitation.

An external 5V power supply is recommended for reliable motor operation, especially when the motor is under load.

Interfacing 28BYJ-48 with Arduino Uno

Hardware Requirements

  • 28BYJ-48 stepper motor

  • Arduino Uno R3

  • ULN2003 driver module

  • Jumper wires

  • USB cable for programming

  • External 5V power supply

Arduino Example Code

Copy Code
/* 
Interfacing Stepper Motor with Arduino UNO using Stepper Library using ULN 2003 Motor driver board by www.playwithcircuit.com 
*/
#include <Stepper.h>
//define Input pins of the Motor
#define OUTPUT1   7                // Connected to the Blue coloured wire
#define OUTPUT2   6                // Connected to the Pink coloured wire
#define OUTPUT3   5                // Connected to the Yellow coloured wire
#define OUTPUT4   4                // Connected to the Orange coloured wire
// Define the number of steps per rotation
const int stepsPerRotation = 2048;  // 28BYJ-48 has 2048 steps per rotation in full step mode as given in data sheet
// Initialize the stepper motor with the sequence of control pins OUTPUT1, OUTPUT3, OUTPUT2, IN4
// OUTPUT1 and OUTPUT3 are connected to one coil and OUTPUT2 and OUTPUT4 are connected to one Coil
Stepper myStepper(stepsPerRotation, OUTPUT1, OUTPUT3, OUTPUT2, OUTPUT4);  
void setup() {
  // Set the speed of the motor in RPM (adjust as needed)
  myStepper.setSpeed(15);  // 15 RPM
}
void loop() {
  // Rotate in One Direction and complete one complete rotation i.e 2048 steps
  myStepper.step(stepsPerRotation);  
  delay(1000);  // Delay between rotations
  // For Rotation in opposite direction provide the variable to the parameter with negative Sign
  myStepper.step(-stepsPerRotation);  
  delay(1000);  // Delay between rotations
}

To learn how to operate a stepper motor in full-step mode and half-step mode, check out: Control 28BYJ-48 Stepper Motor with ULN2003 Driver and Arduino

Mfr Part # MIKROE-1530
STEPPER MOTOR PM GEARED UNI 5V
MikroElektronika
Mfr Part # A000066
ARDUINO UNO R3 ATMEGA328P BOARD
Arduino
Mfr Part # MCD2003-01
EVAL BOARD FOR ULN2003
TAEJIN
Add all DigiKey Parts to Cart
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.