A 5 V geared 28BYJ-48 stepper motor with a ULN2003 driver board, for precise turning with Arduino, ESP32 and Raspberry Pi Pico.
The 28BYJ-48 is a 4-phase unipolar stepper motor with a 1/64 gear reduction, and the ULN2003 board lets four microcontroller pins drive it. It suits small positioning jobs such as turning a pointer, dial or flap, and it is a good first stepper motor to learn with.
Why choose it
- Geared for fine positioning — 1/64 reduction gives 2048 full steps (4096 half-steps) per turn of the output shaft.
- Driver and motor in one set — the keyed 5-pin motor plug fits the driver’s white socket, and four LEDs show which phase is active.
- Works with 5 V and 3.3 V boards — drive IN1–IN4 from an Arduino UNO, an ESP32 or a Raspberry Pi Pico.
Specifications
| 28BYJ-48 motor | |
|---|---|
| Motor type | Unipolar stepper motor, 4 phases, 5 wires |
| Rated voltage | 5 V DC |
| Gear reduction | 1/64 |
| Stride angle | 5.625° / 64 |
| Steps per output-shaft turn | 2048 (full-step) · 4096 (half-step) |
| Frequency | 100 Hz |
| Operating current | 240 mA (typical) |
| Pull-in torque | 300 gf·cm |
| Self-positioning torque | > 34.3 mN·m |
| Friction torque | 600–1200 gf·cm |
| Body diameter | 28 mm |
| Cable length | 25 cm |
| ULN2003 driver board | |
| Driver chip | ULN2003 Darlington transistor array |
| Control inputs | IN1, IN2, IN3, IN4 |
| Status LEDs | 4 (one per phase) |
| Motor socket | White keyed 5-pin socket |
| Power | + / − pins with ON/OFF jumper cap |
| Board size | 32 × 34 mm (from the product photo) |
Compatibility
| Platform | Works | Notes |
|---|---|---|
| Arduino UNO / Nano (5 V) | ✓ Yes | Four 5 V signal pins. Power the driver from a separate 5 V supply. |
| ESP32 / ESP8266 (3.3 V) | ✓ Yes | The ESP32 drives IN1–IN4 with 3.3 V signals. Power the driver from a separate 5 V supply. |
| Raspberry Pi Pico (3.3 V) | ✓ Yes | Drive IN1–IN4 with 3.3 V signals from MicroPython. Power the driver from a separate 5 V supply. |
| Software | ✓ Yes | Arduino IDE “Stepper” library (also AccelStepper by Mike McCauley) · MicroPython machine.Pin
|
In the box
- 1 × ULN2003 driver module board
- 1 × 28BYJ-48 5 V 4-phase stepper motor
Applications
- Turning a pointer, dial or small flap to a set position
- Learning how stepper motors and coil sequences work
- Slow, steady rotation in Arduino, ESP32 and Pico projects
Tutorial
What you'll build: Make the 28BYJ-48 turn one full turn forward, pause, then one full turn back, and print each move on your computer. · About 20 minutes.
Choose your board
| Board | Logic voltage | Pins used | Language | Best for |
|---|---|---|---|---|
| Arduino UNO | 5 V | D8, D9, D10, D11 | C++ (Arduino IDE) | First-timers |
| ESP32 | 3.3 V | GPIO19, 18, 17, 16 | C++ (Arduino IDE) | Projects that will use Wi-Fi later |
New to this? Start with the Arduino UNO.
How it works
A stepper motor turns in small, fixed steps instead of spinning freely. The ULN2003 board switches the motor’s four coils on and off in order, and your microcontroller tells it when, using four signal wires.
- IN1–IN4 — the four control inputs. Each one switches one coil.
- GND — the return path for electricity. The board, the driver and the 5 V supply must all share it.
- Steps per turn — the gearbox gives 2048 full steps (or 4096 half-steps) for one turn of the output shaft.
- Separate 5 V supply — the motor is rated 5 V DC and takes about 240 mA, so it gets its own supply instead of drawing power through a signal pin.
You need: Arduino UNO R3, USB cable, 5 V power supply for the driver, 5 jumper wires plus 2 for the supply
■ Power (5 V) ■ GND ■ Signal (IN1–IN4)
| # | Arduino UNO pin | Driver pin | Wire | Notes |
|---|---|---|---|---|
| 1 | D8 | IN1 | Green | Signal |
| 2 | D9 | IN2 | Green | Signal |
| 3 | D10 | IN3 | Green | Signal |
| 4 | D11 | IN4 | Green | Signal |
| 5 | GND | − (GND) | Black | Join to the external supply’s − as well, so all grounds are common |
| 6 | External 5 V supply + | + (5 V) | Red | Keep the ON/OFF jumper cap fitted |
Watch out: Unplug the USB cable and switch the 5 V supply off before you move any wire. Check the pin labels printed on your board and on the driver.
Download and install the Arduino IDE. Plug the UNO into your computer with a data USB cable.
The Stepper library comes with the Arduino IDE. If the compiler cannot find
Stepper.h, open Sketch → Include Library → Manage Libraries, search for “Stepper” by Arduino and click Install.Tools → Board → Arduino AVR Boards → Arduino Uno. Then Tools → Port and choose the port that appears when the UNO is plugged in.
Paste the sketch below into a new sketch, click Upload, then open Tools → Serial Monitor and set it to 115200 baud. Switch the 5 V supply on.
▸ Example 1 — One turn forward, one turn back (Arduino UNO)
// Wiring: IN1->D8, IN2->D9, IN3->D10, IN4->D11, GND->GND
// The driver's + and - pins go to an external 5 V supply (joined to Arduino GND)
#include <Stepper.h>
const int IN1 = 8; // D8 -> driver IN1
const int IN2 = 9; // D9 -> driver IN2
const int IN3 = 10; // D10 -> driver IN3
const int IN4 = 11; // D11 -> driver IN4
const int stepsPerRevolution = 2048; // one full turn of the output shaft
// The 28BYJ-48 needs the pins in the order IN1, IN3, IN2, IN4
Stepper myStepper(stepsPerRevolution, IN1, IN3, IN2, IN4);
void setup() {
Serial.begin(115200);
Serial.println("OK - epartners.co.nz test");
myStepper.setSpeed(5); // speed in RPM - you can change this
}
void loop() {
Serial.println("One turn forward");
myStepper.step(stepsPerRevolution); // forward
delay(1000);
Serial.println("One turn back");
myStepper.step(-stepsPerRevolution); // back
delay(1000);
}
✓ Check: The Serial Monitor (115200 baud) prints “OK - epartners.co.nz test” once, then “One turn forward” and “One turn back” in turn. The shaft makes one full turn each time and the four LEDs on the driver light in sequence.
You need: ESP32 DevKit board (ESP32-WROOM-32), USB cable, 5 V power supply for the driver, 5 jumper wires plus 2 for the supply
■ Power (5 V) ■ GND ■ Signal (IN1–IN4)
| # | ESP32 pin | Driver pin | Wire | Notes |
|---|---|---|---|---|
| 1 | GPIO19 | IN1 | Green | 3.3 V signal |
| 2 | GPIO18 | IN2 | Green | 3.3 V signal |
| 3 | GPIO17 | IN3 | Green | 3.3 V signal |
| 4 | GPIO16 | IN4 | Green | 3.3 V signal |
| 5 | GND | − (GND) | Black | Join to the external supply’s − as well, so all grounds are common |
| 6 | External 5 V supply + | + (5 V) | Red | Keep the ON/OFF jumper cap fitted |
Watch out: ESP32 pins are 3.3 V only. Never feed 5 V into a GPIO pin. The motor power comes from the separate 5 V supply, not from a GPIO pin. Check the pin labels printed on your board.
Download and install the Arduino IDE.
Open File → Preferences, paste
https://espressif.github.io/arduino-esp32/package_esp32_index.json into “Additional boards manager URLs” and click OK. Then open Tools → Board → Boards Manager, search for “esp32” and install esp32 by Espressif Systems (official install guide).Tools → Board → esp32 → ESP32 Dev Module. Then Tools → Port and choose the port that appears when the board is plugged in.
The Stepper library is used here too (see the Arduino UNO steps if the IDE cannot find it). Paste the sketch below and click Upload. If the upload fails, set Tools → Upload Speed to 115200 and upload again. Open Tools → Serial Monitor at 115200 baud and switch the 5 V supply on.
▸ Example 1 — One turn forward, one turn back (ESP32)
// Wiring: IN1->GPIO19, IN2->GPIO18, IN3->GPIO17, IN4->GPIO16, GND->GND
// The driver's + and - pins go to an external 5 V supply (joined to ESP32 GND)
#include <Stepper.h>
const int IN1 = 19; // GPIO19 -> driver IN1
const int IN2 = 18; // GPIO18 -> driver IN2
const int IN3 = 17; // GPIO17 -> driver IN3
const int IN4 = 16; // GPIO16 -> driver IN4
const int stepsPerRevolution = 2048; // one full turn of the output shaft
// The 28BYJ-48 needs the pins in the order IN1, IN3, IN2, IN4
Stepper myStepper(stepsPerRevolution, IN1, IN3, IN2, IN4);
void setup() {
Serial.begin(115200);
Serial.println("OK - epartners.co.nz test");
myStepper.setSpeed(5); // speed in RPM - you can change this
}
void loop() {
Serial.println("One turn forward");
myStepper.step(stepsPerRevolution); // forward
delay(1000);
Serial.println("One turn back");
myStepper.step(-stepsPerRevolution); // back
delay(1000);
}
✓ Check: The Serial Monitor (115200 baud) prints “OK - epartners.co.nz test” once, then “One turn forward” and “One turn back” in turn. The shaft makes one full turn each time.
Troubleshooting
| Board | Problem | Likely cause | Fix |
|---|---|---|---|
| All | Motor buzzes or shakes but does not turn | Pins are in the wrong order for the Stepper library | Use the order IN1, IN3, IN2, IN4 in the constructor, as in the example (the wires stay on IN1–IN4) |
| All | Driver LEDs stay off | Driver has no 5 V, or the ON/OFF jumper cap has been removed | Check the supply and its polarity (+ and −), and fit the jumper cap |
| All | LEDs flash but the shaft does not turn | Motor plug not fully in, or the supply is too weak | Push the keyed plug fully into the white socket and use a 5 V supply that can give at least 500 mA |
| All | Motor stalls or skips steps | Speed set too high | Lower the speed (for example setSpeed(5), or a larger DELAY_MS on the Pico) |
| All | Nothing moves and the board resets | Grounds not joined | Join the board GND, the driver − and the supply − together |
| ESP32 | Upload fails or stops part-way | Upload speed too high for the USB cable or USB chip | Tools → Upload Speed → 115200, then upload again |
| ESP32 | Stuck on “Connecting…” | Board not in upload mode | Hold the BOOT button until uploading starts |
| ESP32 | Port does not appear | Charge-only cable, or the USB driver for your board’s USB chip is missing | Use a data cable and install the driver for the USB chip printed on your board |
Try next: Change the speed (5 RPM in the example, 10 RPM is also used in the Last Minute Engineers guide), or install “AccelStepper” by Mike McCauley to add smooth acceleration.
Spotted a problem in this tutorial? Email support@epartners.co.nz and we'll check it and update the tutorial.
- Power the driver from a separate 5 V supply and join its ground to the board’s GND. The motor is rated 5 V DC; the board is marked 5–12 V, so do not use a higher voltage with this 5 V motor.
- This is a slow, geared motor (pull-in torque 300 gf·cm). The example sketches run at about 5 RPM, and the Stepper library’s
step()waits until the move finishes. - The ON/OFF jumper cap on the driver connects power to the motor. Remove it to cut motor power.
Video guide
Datasheet
Key figures from the manufacturer's datasheet for the ULN2003A, the Darlington driver chip on the driver board that switches the motor coils.
| ULN2003A Darlington transistor array | |
|---|---|
| Channels | 7 NPN Darlington pairs, common emitter |
| Collector-emitter voltage | 50 V (maximum) |
| Collector current per channel | 500 mA rated (single output) |
| Input compatibility | TTL or 5 V CMOS (2.7 kΩ series base resistor) |
| Input current at VI = 5 V | 0.35 mA typical, 0.5 mA maximum |
| Maximum input voltage | 30 V |
| Output clamp diodes | Built in, to the common (COM) pin, for inductive loads |
| Clamp diode current | 500 mA (maximum) |
| Operating free-air temperature | −40 °C to +70 °C (ULN200xA grade) |
| Package options | 16-pin SOIC, PDIP, SOP, TSSOP |
Download the ULN2003A datasheet (PDF, 1.8 MB)
▸ Preview the datasheet
If the preview does not load on your device, use the download link above.
Source: Texas Instruments, ULN200x, ULQ200x High-Voltage, High-Current Darlington Transistor Arrays, document SLRS027T.
Resources
- Last Minute Engineers — 28BYJ-48 stepper motor and ULN2003 with Arduino
- Random Nerd Tutorials — ESP32 with 28BYJ-48 and ULN2003
- Arduino Stepper library
- Arduino-ESP32 installation guide (Espressif)
- Raspberry Pi Pico datasheet (PDF)
FAQ
▸ Can I power the motor from the Arduino 5 V pin?
It is best not to. Last Minute Engineers and Random Nerd Tutorials both recommend a separate 5 V supply for the driver, with its ground joined to the board’s GND. The motor takes about 240 mA.
▸ Why does the code use the order IN1, IN3, IN2, IN4?
The 28BYJ-48 needs the pins in that order for the Arduino Stepper library to step correctly. The wires still go to IN1, IN2, IN3 and IN4 as shown in the tables.
▸ How many steps is one turn of the output shaft?
2048 in full-step mode, which is what the Stepper library examples use. In half-step mode it is 4096, which is what the Raspberry Pi Pico example uses.
▸ Does it work with 3.3 V boards such as the ESP32 and Pico?
Yes. The ESP32 and Pico examples drive IN1–IN4 with 3.3 V signals, and the driver is powered separately from 5 V.
▸ What does the ON/OFF jumper on the driver do?
With the jumper cap fitted, power reaches the motor. If you remove it, no power reaches the motor.
Technical question about this part? Email support@epartners.co.nz with your board and wiring, and we'll help you get it working.
Shipping: $5.99 urban, $9.99 rural. Free shipping on orders of $100 or more.
Order by 10:30am (NZT), Monday to Friday, and we dispatch the same day. Orders placed after 10:30am, on weekends or on public holidays are dispatched the next business day.
Delivery usually takes 1–2 business days after dispatch (2–3 for rural addresses). See our Shipping Policy for full details.