A4988
A4988
2A per phase
1/16 step
5V
8-35V
-20C to 85C
15mm x 20mm x 5mm
Package Includes
1 x A4988 Stepper Motor Driver Module with Heat Sink
1 x Connection Cable
Applications
3D Printers
CNC Machines
Robotics
Automation Systems
Other applications requiring precise stepper motor control
A4988 Stepper Motor Driver Module with Heat Sink For 3D Printer (Red)
===============================================================
Overview
-----------
The A4988 Stepper Motor Driver Module with Heat Sink is a popular and widely used driver for stepper motors in 3D printers and other applications. This module is based on the A4988 microstepping driver IC from Allegro, which provides precise control over stepper motors. The module comes with a heat sink to dissipate heat generated by the driver.
Features
Microstepping: 16 microsteps per full step
Current rating: 1A per phase
Voltage range: 8V to 35V
5V logic compatible
Heat sink for improved thermal performance
Pinout
----------
The module has the following pins:
VDD: 5V power supply
GND: Ground
DIR: Direction input (high = clockwise, low = counter-clockwise)
STEP: Step input (rising edge triggers a step)
MS1, MS2, MS3: Microstep resolution selection inputs
ENABLE: Enable input (low = enabled, high = disabled)
RESET: Reset input (low = reset, high = normal operation)
Example 1: Basic Stepper Motor Control using Arduino
---------------------------------------------------
In this example, we will use the A4988 module to control a stepper motor using an Arduino Uno board.
Hardware Requirements
A4988 Stepper Motor Driver Module
Arduino Uno board
Stepper motor
Breadboard and jumper wires
Software Requirements
Arduino IDE
Code
```c++
const int dirPin = 2; // Direction pin
const int stepPin = 3; // Step pin
const int enablePin = 4; // Enable pin
void setup() {
pinMode(dirPin, OUTPUT);
pinMode(stepPin, OUTPUT);
pinMode(enablePin, OUTPUT);
digitalWrite(enablePin, LOW); // Enable the driver
}
void loop() {
// Set direction to clockwise
digitalWrite(dirPin, HIGH);
// Take 100 steps
for (int i = 0; i < 100; i++) {
digitalWrite(stepPin, HIGH);
delay(1);
digitalWrite(stepPin, LOW);
delay(1);
}
// Set direction to counter-clockwise
digitalWrite(dirPin, LOW);
// Take 100 steps
for (int i = 0; i < 100; i++) {
digitalWrite(stepPin, HIGH);
delay(1);
digitalWrite(stepPin, LOW);
delay(1);
}
}
```
Example 2: Microstepping Control using Raspberry Pi (Python)
-----------------------------------------------------------
In this example, we will use the A4988 module to control a stepper motor using a Raspberry Pi board and Python.
Hardware Requirements
A4988 Stepper Motor Driver Module
Raspberry Pi board
Stepper motor
Breadboard and jumper wires
Software Requirements
Python 3.x
RPi.GPIO library
Code
```python
import RPi.GPIO as GPIO
import time
# Set up GPIO mode
GPIO.setmode(GPIO.BCM)
# Define pin numbers
DIR_PIN = 17
STEP_PIN = 23
ENABLE_PIN = 24
# Set up pins as output
GPIO.setup(DIR_PIN, GPIO.OUT)
GPIO.setup(STEP_PIN, GPIO.OUT)
GPIO.setup(ENABLE_PIN, GPIO.OUT)
# Enable the driver
GPIO.output(ENABLE_PIN, GPIO.LOW)
try:
while True:
# Set direction to clockwise
GPIO.output(DIR_PIN, GPIO.HIGH)
# Take 100 microsteps
for i in range(100):
GPIO.output(STEP_PIN, GPIO.HIGH)
time.sleep(0.001)
GPIO.output(STEP_PIN, GPIO.LOW)
time.sleep(0.001)
# Set direction to counter-clockwise
GPIO.output(DIR_PIN, GPIO.LOW)
# Take 100 microsteps
for i in range(100):
GPIO.output(STEP_PIN, GPIO.HIGH)
time.sleep(0.001)
GPIO.output(STEP_PIN, GPIO.LOW)
time.sleep(0.001)
except KeyboardInterrupt:
# Clean up GPIO
GPIO.cleanup()
```
Note: In both examples, make sure to adjust the pin numbers and connections according to your specific setup. Additionally, consult the datasheet and documentation for the A4988 module and your microcontroller board for specific details on usage and configuration.