Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Controlled Stepper Motor System with Driver Integration

View and Edit Project In Cirkit DesignerImage of Arduino UNO Controlled Stepper Motor System with Driver Integration

Circuit Documentation

Summary

This circuit involves an Arduino UNO microcontroller, a 28BYJ-48 stepper motor, and a stepper motor driver. The Arduino UNO controls the stepper motor through the stepper motor driver, enabling precise control of the motor's rotation.

Component List

Arduino UNO

28BYJ-48 Stepper Motor

Stepper Motor Driver

Wiring Details

Arduino UNO

28BYJ-48 Stepper Motor

Stepper Motor Driver

Code Documentation

Arduino UNO Code

#define IN1_PIN 8 
#define IN2_PIN 9 
#define IN3_PIN 10 
#define IN4_PIN 11 

void setup() { 
    pinMode(IN1_PIN, OUTPUT); 
    pinMode(IN2_PIN, OUTPUT); 
    pinMode(IN3_PIN, OUTPUT); 
    pinMode(IN4_PIN, OUTPUT); 
} 

void loop() { 
    // Rotate in one direction 
    stepMotor(1); 
    delay(1000); 
    // Rotate in the other direction 
    stepMotor(0); 
    delay(1000); 
}

void stepMotor(int direction) { 
    int steps[8][4] = { 
        {1, 0, 0, 0}, // Step 1 
        {1, 1, 0, 0}, // Step 2 
        {0, 1, 0, 0}, // Step 3 
        {0, 1, 1, 0}, // Step 4 
        {0, 0, 1, 0}, // Step 5 
        {0, 0, 1, 1}, // Step 6 
        {0, 0, 0, 1}, // Step 7 
        {1, 0, 0, 1} // Step 8 
    }; 

    if (direction == 1) { 
        for (int i = 0; i < 8; i++) { 
            digitalWrite(IN1_PIN, steps[i][0]); 
            digitalWrite(IN2_PIN, steps[i][1]); 
            digitalWrite(IN3_PIN, steps[i][2]); 
            digitalWrite(IN4_PIN, steps[i][3]); 
            delay(100); // Speed control 
        } 
    } else { 
        for (int i = 7; i >= 0; i--) { 
            digitalWrite(IN1_PIN, steps[i][0]); 
            digitalWrite(IN2_PIN, steps[i][1]); 
            digitalWrite(IN3_PIN, steps[i][2]); 
            digitalWrite(IN4_PIN, steps[i][3]); 
            delay(100); // Speed control 
        } 
    } 
}

This code sets up the Arduino UNO to control the stepper motor through the stepper motor driver. The setup function initializes the pins as outputs, and the loop function alternates the motor's rotation direction every second. The stepMotor function handles the stepping sequence for the motor.