Stepper Motor (Bipolar)
A brushless DC electric motor that divides a full rotation into a number of equal steps, ideal for 3D printers and CNC machines.
Component Preview
A bipolar stepper motor has two internal coils. By energizing these coils in a specific sequence, the motor shaft turns one precise "step" at a time. It requires a dedicated stepper motor driver (like the A4988) to handle the complex sequencing and high currents.
Overview
Unlike a standard DC motor which spins continuously when power is applied, a stepper motor is commanded to move a specific number of steps. Standard hobby steppers often have 200 steps per revolution (1.8° per step).
Pin Reference
| Pin | Type | Description |
|---|---|---|
| A- | digital | Coil A End. Connects to stepper driver Output 1A. |
| A+ | digital | Coil A Start. Connects to stepper driver Output 1B. |
| B+ | digital | Coil B Start. Connects to stepper driver Output 2A. |
| B- | digital | Coil B End. Connects to stepper driver Output 2B. |
Configurable Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
| step_angle | number | 1.8 | Degrees of rotation per single step (e.g., 1.8 for 200 steps/rev). |
Wiring Diagram (With A4988 Driver)
You cannot connect a bipolar stepper directly to an Arduino. You must use a driver module like the A4988.

Example Arduino Code
This example uses the popular AccelStepper library to control an A4988 driver, which in turn controls the bipolar stepper motor.
#include <AccelStepper.h>
// Define stepper motor connections and motor interface type
// Interface type 1 means a stepper driver (with Step and Direction pins)
#define dirPin 4
#define stepPin 3
#define motorInterfaceType 1
AccelStepper stepper(motorInterfaceType, stepPin, dirPin);
void setup() {
Serial.begin(9600);
// Set the maximum speed in steps per second
stepper.setMaxSpeed(1000);
// Set acceleration in steps per second per second
stepper.setAcceleration(500);
Serial.println("Stepper Motor Ready.");
}
void loop() {
// If the motor has reached its target position
if (stepper.distanceToGo() == 0) {
// If it's at the starting point, go to position 200 (1 full rotation if 1.8 deg/step)
if (stepper.currentPosition() == 0) {
Serial.println("Moving Forward...");
stepper.moveTo(200);
}
// Otherwise, return to starting point
else {
Serial.println("Moving Backward...");
stepper.moveTo(0);
}
delay(1000); // Wait a second before moving again
}
// This must be called frequently to make the motor move
stepper.run();
}Simulation Notes
- In the simulator, the stepper motor visually rotates to match the calculated physical position based on the coil energization sequences. You can combine it with the A4988 driver module for a realistic CNC/3D-printer simulation stack.
