How to Use the 28BYJ-48 Stepper Motor with Arduino and the ULN2003 Driver

28BYJ-48 stepper motor wired to an Arduino with a ULN2003 driver board

The 28BYJ-48 is the motor almost every maker meets first. It is cheap, it is geared, and it will hold a position all day without complaining. Here is how to wire it, code it, and fix the one mistake that catches nearly everybody.

What is the 28BYJ-48?

The 28BYJ-48 is a small, geared unipolar stepper motor. It has become the go-to first motion project for makers, students and hobbyists because it is cheap, hard to damage, and precise enough for a surprising range of builds, from robotic arms and camera sliders to automated blinds and clocks.

Unlike a plain DC motor that just spins when you give it power, a stepper moves in small, repeatable steps. You can tell it to turn an exact amount and it will stay there. That is the whole appeal: controlled, accurate movement you can trust.

It is almost always sold with the ULN2003 driver board, the little green board that sits between your Arduino and the motor. An Arduino pin cannot supply enough current to drive a motor coil directly, so the ULN2003 does the heavy lifting while the Arduino just tells it when to switch.

  • 2048Steps per turn
  • 0.176°Per full step
  • 5VSupply
  • ~240 mACurrent draw
Close-up of the ULN2003 driver board showing the IN1 to IN7 input pins, the white motor connector and the 5 to 12V power terminals
The two halves of the kit. The motor's 5-wire plug goes into the white connector, and IN1 to IN4 down the left edge are the control inputs your Arduino drives.

What's in the kit

  • 1x 28BYJ-48 stepper motor, 5V, with a 150mm lead and plug
  • 1x ULN2003 driver board with matching 5-pin connector
  • Add your own jumper wires and an Arduino or ESP32 board and you are ready to go

Specs at a glance

Spec Value
Motor type Unipolar stepper, 4-phase, 5-wire
Rated voltage 5V DC
Gear reduction ratio ~1/64 (approx. 63.68:1)
Step angle (after gearing) 0.176° full-step, 0.088° half-step
Steps per revolution 2048 (full-step) / 4096 (half-step)
Stride angle 5.625° / 64
Current draw ~240 mA
Holding torque ~34 mN·m (approx. 300 gf·cm)
Driver board ULN2003 (IN1 to IN4 inputs, 4 status LEDs)

That heavy gear reduction is the 28BYJ-48's superpower. It buys you fine positioning and decent torque for the size, and the trade is top-end speed. This motor is built for accuracy, not racing.

Dimension drawing of the 28BYJ-48 motor and ULN2003 board: 28mm motor body, 35mm across the mounting tabs, 40x30mm driver board, 150mm cable
Handy if you are designing a bracket: the motor body is 28mm across, 35mm over the mounting tabs, and the driver board is 40 x 30mm.

Wiring it up (Arduino Uno)

There is not much to get wrong here. The motor plugs into the board one way only, and the board takes four signal wires plus power.

  1. Push the motor's white plug into the connector on the ULN2003 board. It is keyed, so it only fits one way.
  2. Run four jumper wires from IN1, IN2, IN3 and IN4 to Arduino pins 8, 9, 10 and 11.
  3. Connect the board's + and - terminals to Arduino 5V and GND, then plug in the USB cable.
ULN2003 board Arduino Uno
IN1 Pin 8
IN2 Pin 9
IN3 Pin 10
IN4 Pin 11
+ (5V) 5V
- (GND) GND
28BYJ-48 stepper motor and ULN2003 driver board wired to an Arduino Uno with coloured jumper wires
Four signal wires and a power pair. That is the whole build.

Powering it. One motor doing light work is happy running off the Arduino's 5V pin. If it stutters, skips, or resets your board mid-move, that is the USB port running out of current. Give the board its own 5V supply on the +/- terminals and join the grounds together.

Want the full picture, including which coil each colour goes to? This one is worth saving.

28BYJ-48 and ULN2003 pinout diagram showing motor wire colours, coil order, board inputs IN1 to IN7 and the 5 to 12V power header
Full pinout: motor wire colours to coils, board inputs, and the power header.

The code

This sketch uses the Stepper library that ships with the Arduino IDE, so there is nothing to install. It turns one full revolution each way, forever.

#include <Stepper.h>

const int stepsPerRevolution = 2048;  // 28BYJ-48 in full-step mode

// IMPORTANT: pin order is 8, 10, 9, 11 - NOT 8, 9, 10, 11
// The middle two are swapped to match the motor's coil sequence.
Stepper myStepper(stepsPerRevolution, 8, 10, 9, 11);

void setup() {
  myStepper.setSpeed(10);   // RPM (keep it low - this motor is geared)
}

void loop() {
  myStepper.step(stepsPerRevolution);    // one full turn clockwise
  delay(1000);
  myStepper.step(-stepsPerRevolution);   // one full turn anti-clockwise
  delay(1000);
}

The number one gotcha. If your motor buzzes, vibrates, or rocks back and forth instead of turning, it is the pin order almost every time. The coils are wired so you must list the pins as 8, 10, 9, 11 in the Stepper constructor, even though they physically connect to IN1 to IN4 in order. Swapping the middle two fixes it about 90% of the time.

If it buzzes but will not turn, swap the middle two pin numbers.

Once you are past the basics, install AccelStepper (Sketch → Include Library → Manage Libraries, then search AccelStepper). You get acceleration, non-blocking movement so your code can do other things while the motor turns, and proper position targeting. Well worth the five minutes.

Troubleshooting

Nearly every problem with this motor lands somewhere in this table.

Problem Likely fix
Buzzes but will not turn Wrong pin order. Use 8, 10, 9, 11 in the constructor
Runs rough or skips steps Lower the speed with setSpeed(), or move to an external 5V supply
Nothing happens at all Check the motor plug is fully seated, and check 5V and GND
Board LEDs stay dark No power reaching the board. Recheck the +/- wiring
Arduino keeps resetting The motor is pulling too much through USB. Power the board separately
Turns the wrong way Reverse the sign in step(), or swap the pin order

Project ideas

Once it is turning on command, the fun part starts:

  • Automated curtains or blinds on a timer
  • Pan and tilt mount for a camera or sensor
  • A rotating turntable for product photography
  • Analog-style clock movements
  • Robotic arm joints
  • A dividing head for a mini lathe or a 3D-printed jig

Just getting started? Our breadboard basics guide walks through building a first circuit, and if you would rather drive this from a Wi-Fi capable board, see getting started with the ESP32-WROOM-32.

28BYJ-48 stepper motor and ULN2003 driver board kit from NZN Electronics

Get the kit

Motor and driver board together, ready to wire up. Grab a single to get started, or a multi-pack at a lower per-unit price for bigger builds.

Shop the 28BYJ-48 Stepper Kit

Stuck on your build?

We are New Zealand based and happy to help. Tell us what the motor is doing and we will point you at the fix.