Sub topic 7
Wiring the Motor and Powering the Driver
Assume you have an Arduino, a four-wire bipolar stepper motor, and a STEP/DIR driver such as an A4988 or DRV8825. You should already know basic Arduino wiring, voltage, current, resistance, and how to use an external power supply.
The driver is the power stage between the Arduino and the motor. The Arduino sends low-power logic signals. The driver switches the higher motor current through the coils.
Identify the motor coils
A four-wire bipolar motor has two separate coils. Each coil connects to one driver output:
- Coil A connects to
1Aand1B. - Coil B connects to
2Aand2B.
Use the motor datasheet when possible. If the wires are unknown, measure resistance with a multimeter:
- Measure between two wires.
- A low, similar resistance identifies two wires from the same coil.
- An open circuit means the wires belong to different coils.
- Repeat the test for the remaining pair.
The order within one pair controls direction. Reversing one pair reverses the motor's rotation. Reversing both pairs also reverses rotation. Do not connect a motor wire to a logic pin.
Some motors have six or eight wires. Their coils have taps or can be arranged in series or parallel. Use the motor datasheet to select a supported configuration. Do not guess.
Connect logic and motor power
A typical driver has separate logic and motor power connections:
| Connection | Connect to | Purpose |
|---|---|---|
| `STEP` | Arduino digital pin 3 | One pulse requests one step |
| `DIR` | Arduino digital pin 4 | Selects direction |
| `GND` | Arduino GND | Common signal reference |
| `VDD` | Arduino 5 V or driver-specified logic voltage | Powers driver logic |
| `VMOT` | External motor supply positive | Supplies motor energy |
| Motor GND | External supply negative | Completes motor power circuit |
| `1A`, `1B`, `2A`, `2B` | The two coil pairs | Drives the windings |
The motor supply must provide the voltage and current specified by the driver and motor system. Do not power the motor from the Arduino 5 V pin. The Arduino cannot safely supply the motor current.
Connect Arduino ground and the driver's logic ground unless the driver documentation specifies an isolated interface. This shared reference lets the driver interpret STEP and DIR correctly.
Place a bulk electrolytic capacitor near the driver's VMOT and motor ground pins. A capacitor in the range recommended by the driver datasheet, often 47 to 100 µF, helps absorb supply transients. Observe its polarity.
Test the wiring carefully
Before applying power, check that no motor output is shorted to ground or to another output. Confirm the supply polarity and verify that the motor wires are in two complete coil pairs.
const int STEP_PIN = 3;
const int DIR_PIN = 4;
void setup() {
pinMode(STEP_PIN, OUTPUT);
pinMode(DIR_PIN, OUTPUT);
digitalWrite(DIR_PIN, HIGH);
}
void loop() {
digitalWrite(STEP_PIN, HIGH);
delayMicroseconds(2000);
digitalWrite(STEP_PIN, LOW);
delayMicroseconds(2000);
}Do not plug or unplug the motor while the driver is powered. The inductive voltage produced by a disconnected coil can damage the driver.
Exercise
The motor hums but does not rotate after wiring. What should you check first?
Show answer
Turn off power, then verify that the four motor wires form two complete coil pairs and that each pair is connected to one driver output group. Also check the driver's supply polarity and current limit.