Smart Control: Stepper Motor with ESP32
🔍 What is the 28BYJ-48 Stepper Motor?
The 28BYJ-48 is a 5V unipolar stepper motor with a built-in reduction gearbox. This makes it ideal for applications requiring precise control at low speed.
🧾 Specifications
| Specification | Value |
|---|---|
| Motor Type | Unipolar Stepper |
| Rated Voltage | 5V DC |
| Number of Phases | 4 |
| Coil Resistance | ~50Ω per coil |
| Step Angle (before gearbox) | 11.25° |
| Gear Reduction Ratio | ~64:1 (actually ~63.68395:1) |
| Steps Per Revolution (output shaft) | 2048 steps |
| Holding Torque | ~300 gf·cm |
| Wires | 5 |
| Max Current | ~240mA (safe at ~100–200mA) |
🔁 How Does It Work?
- The motor has 4 coils and a common wire (VCC).
- Coils are energized in a sequence to rotate the internal rotor.
- The gearbox slows down output but increases torque and precision.
⚙️ Full Output Shaft Rotation:
- Internal motor steps: 32 steps/rev (11.25° each)
- Gearbox: 63.68395:1 ratio
- Result:
32 × 63.68395 ≈ 2048 steps/rev
That’s 0.176° per step – very precise!
🎯 Advantages of 28BYJ-48
✅ Low voltage (5V) – safe for microcontrollers
✅ High torque due to gearbox
✅ Fine step resolution (2048 steps/rev)
✅ Cheap and widely available
✅ Compatible with ULN2003 board
🧲 Wiring Details
5 Wires (typically colored):
| Color | Function | ULN2003 IN Pin |
|---|---|---|
| Red | VCC (common) | Motor power (not IN) |
| Blue | Coil 1 (A) | IN1 |
| Pink | Coil 2 (B) | IN2 |
| Yellow | Coil 3 (C) | IN3 |
| Orange | Coil 4 (D) | IN4 |
🧪 Test & Troubleshooting
- Motor not rotating? Check wiring and ULN2003 power.
- Wrong direction? Reverse coil order (e.g., IN1 ↔ IN4).
- Skipping steps? Add delay or check power supply.
- Weak torque? Use a stronger 5V supply (≥500mA).
🛠 Advanced Tips
- Use AccelStepper library for smoother motion.
- Gearbox introduces backlash – not ideal for fast direction changes.
- Not suitable for high-speed applications.
- Use microcontroller sleep or disable pins to reduce heat when idle.
🔧 Real-Life Applications
- Robot arms and legs (slow, accurate movement)
- Camera sliders
- Smart blinds/curtains
- Automatic locks
- Hobby CNC or XY plotters (light-duty)
HOW TO OPERATE
#include <Stepper.h>
const int stepsPerRevolution = 2048; // or the actual steps per revolution
#define IN1 19
#define IN2 18
#define IN3 5
#define IN4 17
Stepper myStepper(stepsPerRevolution, IN1, IN3, IN2, IN4);
void setup() {
Serial.begin(115200);
myStepper.setSpeed(15); // Set speed in RPM
}
void loop() {
Serial.println("Clockwise");
myStepper.step(stepsPerRevolution);
delay(1000);
Serial.println("Counterclockwise");
myStepper.step(-stepsPerRevolution);
delay(1000);
}

Leave a Reply
You must be logged in to post a comment.