Codey OnlineBiblioteka komponentów Arduino i ESP32 › DRV8825 Driver Board
DRV8825 Driver Board
Aktuatory

DRV8825 Driver Board

Płytka DRV8825 Driver Board to sterownik silnika krokowego, który zamienia sygnały step/direction na prąd cewek dla dwóch faz silnika. Komunikuje się ze sterownikiem przez DIR i STEP (oraz EN/enable i sleep/reset) i zasila silnik przez VMOT, udostępniając wyjścia dla czterech zacisków silnika (1A/1B i 2A/2B). Mikrokrok zwykle ustawia się za pomocą M0/M1/M2, a stan błędu można odczytać przez FLT.

Szerokość: 16.8 mm

Pinout — DRV8825 Driver Board

Pin Sygnał Opis
DIR digital Direction control input; logic level selects stepper motor rotation direction.
STEP clock Step pulse input; each rising edge advances the motor one microstep/full step.
GND ground Logic ground reference; connect to controller ground.
EN enable Active-low enable input; low enables motor outputs, high disables them.
A1 power Stepper motor coil A output terminal 1.
A2 power Stepper motor coil A output terminal 2.
B1 power Stepper motor coil B output terminal 1.
B2 power Stepper motor coil B output terminal 2.
RST reset Active-low reset input; resets the translator and step position.
SLP enable Active-low sleep input; pull high for normal driver operation.
VMOT power Motor supply voltage input for the DRV8825 power stage.
M2 digital Microstep mode select input M2; used with M0/M1 to set step resolution.
M1 digital Microstep mode select input M1; used with M0/M2 to set step resolution.
M0 digital Microstep mode select input M0; used with M1/M2 to set step resolution.
FLT interrupt Fault output; indicates driver fault such as overcurrent or thermal shutdown.
GND.1 ground Motor power ground; connect to motor supply negative and controller ground.

Przykładowy schemat połączeń — DRV8825 Driver Board

Z Do Przewód
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:RST red
board:5V x1:SLP red
board:D5 x1:M0 purple
board:D6 x1:M1 cyan
board:D7 x1:M2 magenta
x1:A1 x2:1A brown
x1:A2 x2:1B pink
x1:B1 x2:2A teal
x1:B2 x2:2B lime

Przykładowy kod Arduino — DRV8825 Driver Board

Ten przykład został napisany i sprawdzony kompilacją dla arduino-uno. Codey Online dostosuje go do każdej innej obsługiwanej płytki.

// Canonical DRV8825 example for Arduino Uno
// This sketch steps a NEMA17 stepper motor forward and backward using the DRV8825 driver.

const int STEP_PIN = 2;
const int DIR_PIN  = 3;
const int EN_PIN   = 4;
const int M0_PIN   = 5;
const int M1_PIN   = 6;
const int M2_PIN   = 7;

const int STEP_DELAY_US = 800; // Lower = faster stepping
const int STEPS_PER_DIRECTION = 400;

void stepMotor(int steps) {
  for (int i = 0; i < steps; i++) {
    digitalWrite(STEP_PIN, HIGH);
    delayMicroseconds(4);
    digitalWrite(STEP_PIN, LOW);
    delayMicroseconds(STEP_DELAY_US);
  }
}

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

  Serial.begin(9600);
  while (!Serial) { }

  // Full-step mode: M0=M1=M2 LOW
  digitalWrite(M0_PIN, LOW);
  digitalWrite(M1_PIN, LOW);
  digitalWrite(M2_PIN, LOW);

  // Active-low enable: LOW turns the driver on
  digitalWrite(EN_PIN, LOW);

  // RESET and SLP are tied high in wiring, so the driver is awake.
  Serial.println("DRV8825 stepper demo starting...");
}

void loop() {
  Serial.println("Direction: clockwise");
  digitalWrite(DIR_PIN, HIGH);
  stepMotor(STEPS_PER_DIRECTION);
  delay(1000);

  Serial.println("Direction: counterclockwise");
  digitalWrite(DIR_PIN, LOW);
  stepMotor(STEPS_PER_DIRECTION);
  delay(1000);
}

Podobne komponenty

A4988 Stepper Driver

A4988 Stepper Driver

L298N Motor Driver Board

L298N Motor Driver Board

Left DC Motor

Left DC Motor

NEMA17 Stepper Motor

NEMA17 Stepper Motor

Zbuduj swój projekt Arduino lub ESP32 z pomocą AI

Opisz, co chcesz zbudować. Codey Online napisze kod, narysuje schemat połączeń, skompiluje projekt i wgra go na płytkę bezpośrednio z przeglądarki.

Zacznij za darmo