Codey OnlineArduino- & ESP32-Komponentenbibliothek › A4988 Stepper Driver
A4988 Stepper Driver
Aktoren

A4988 Stepper Driver

Der A4988 ist ein Schrittmotortreiber für bipolare Schrittmotoren, mit VMOT für die Motorversorgung und VDD für die Logikversorgung. Er nutzt digitale STEP- und DIR-Eingänge (mit EN zum Aktivieren) und unterstützt Mikroschritte über MS1, MS2 und MS3. Die Motorwicklungen werden an den Ausgängen (A/B-Klemmen) angeschlossen, und RESET/SLEEP steuern das Startverhalten und den Energiesparmodus des Controllers.

Breite: 15.4 mm

Pinbelegung — A4988 Stepper Driver

Pin Signal Beschreibung
DIR digital Direction input — logic level selects the stepper motor rotation direction.
VDD power Logic supply input for the A4988 control side, typically 3.3 V or 5 V.
STEP digital Step pulse input — each rising edge advances the motor by one selected microstep.
VMOT power-high Motor supply input for the A4988 power stage, typically 8–35 V.
EN enable Active-low driver enable input — low enables motor outputs, high disables them.
GND ground Motor supply ground return; connect to power supply ground and logic ground.
1A power Stepper motor coil 1 output A — connect to one wire of the first motor winding.
1B power Stepper motor coil 1 output B — connect to the other wire of the first motor winding.
2A power Stepper motor coil 2 output A — connect to the other wire of the second motor winding.
2B power Stepper motor coil 2 output B — connect to one wire of the second motor winding.
MS1 digital Microstep select input bit 1 for setting full, half, quarter, eighth, or sixteenth steps.
MS2 digital Microstep select input bit 2 for configuring the A4988 step resolution.
MS3 digital Microstep select input bit 3 for configuring the A4988 step resolution.
GND.1 ground Logic ground reference; connect to the controller ground and common motor ground.
RESET reset Active-low reset input — resets the translator; often tied to SLEEP for normal use.
SLEEP enable Active-low sleep input — low puts the driver into low-power sleep mode.

Beispielschaltplan — A4988 Stepper Driver

Von Nach Kabel
board:5V x1:VDD red
board:GND x1:GND black
board:GND.1 x1:GND.1 black
board:D2 x1:STEP green
board:D3 x1:DIR blue
board:D4 x1:EN yellow
board:5V x1:RESET red
board:5V x1:SLEEP red
board:GND.2 x1:MS1 black
board:GND.2 x1:MS2 black
board:GND.2 x1:MS3 black
board:VIN x1:VMOT red
board:GND.2 x1:GND black
x1:1A m1:1A purple
x1:1B m1:1B cyan
x1:2A m1:2A magenta
x1:2B m1:2B brown

Arduino-Beispielcode — A4988 Stepper Driver

Dieses Beispiel wurde für das arduino-uno geschrieben und kompiliergeprüft. Codey Online passt es für jedes andere unterstützte Board an.

// Canonical A4988 stepper driver example for Arduino Uno
// Moves a NEMA17 stepper motor back and forth using STEP/DIR.

const int STEP_PIN = 2;
const int DIR_PIN  = 3;
const int EN_PIN   = 4;

// With MS1/MS2/MS3 tied LOW, the driver is in full-step mode.
// Adjust this if you change microstepping wiring.
const int STEPS_PER_REV = 200;

void stepMotor(int steps, bool direction, int stepDelayMicros) {
  digitalWrite(DIR_PIN, direction ? HIGH : LOW);
  delayMicroseconds(5); // Direction setup time

  for (int i = 0; i < steps; i++) {
    digitalWrite(STEP_PIN, HIGH);
    delayMicroseconds(stepDelayMicros);
    digitalWrite(STEP_PIN, LOW);
    delayMicroseconds(stepDelayMicros);
  }
}

void setup() {
  pinMode(STEP_PIN, OUTPUT);
  pinMode(DIR_PIN, OUTPUT);
  pinMode(EN_PIN, OUTPUT);

  // A4988 enable is active-low.
  digitalWrite(EN_PIN, LOW);

  Serial.begin(9600);
  Serial.println("A4988 stepper driver demo starting...");
  Serial.println("Motor will rotate one revolution clockwise and counterclockwise.");
}

void loop() {
  Serial.println("Clockwise");
  stepMotor(STEPS_PER_REV, true, 800);
  delay(1000);

  Serial.println("Counterclockwise");
  stepMotor(STEPS_PER_REV, false, 800);
  delay(1000);
}

Ähnliche Komponenten

DRV8825 Driver Board

DRV8825 Driver Board

L298N Motor Driver Board

L298N Motor Driver Board

Left DC Motor

Left DC Motor

NEMA17 Stepper Motor

NEMA17 Stepper Motor

Bau dein Arduino- oder ESP32-Projekt mit AI

Beschreib einfach, was du bauen willst. Codey Online schreibt den Code, zeichnet den Schaltplan, kompiliert alles und flasht dein Board direkt aus dem Browser.

Kostenlos starten