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

Arduino UNO-Based Automatic Styrofoam Cutter with Dual Stepper Motor Control

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Automatic Styrofoam Cutter with Dual Stepper Motor Control

Circuit Documentation

Summary

This circuit is designed to control two stepper motors using an Arduino UNO. The circuit includes an A4988 driver for a bipolar stepper motor and a ULN2003 driver for a unipolar stepper motor. The Arduino UNO sends control signals to both drivers to manage the movement of the stepper motors. The power supply provides the necessary voltage for the components.

Component List

  1. Arduino UNO

    • Description: Microcontroller board based on the ATmega328P.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  2. A4988 on Breakout Board

    • Description: Stepper motor driver for bipolar stepper motors.
    • Pins: VIN (12-24V), GND, 2B, 2A, 1A, 1B, ENABLE, STEP, DIR, VDD (5V)
  3. ULN 2003

    • Description: Darlington transistor array for driving unipolar stepper motors.
    • Pins: IN1, IN2, IN3, IN4, IN5, IN6, IN7, GND, +, COIL1, COIL2, COIL3, COIL4, COIL5
  4. 28BYJ-48 Stepper Motor

    • Description: Unipolar stepper motor.
    • Pins: BLUE, PINK, YELLOW, ORANGE, RED
  5. Stepper Motor (Bipolar)

    • Description: Bipolar stepper motor.
    • Pins: D, B, C, A
  6. POWER SUPPLY 12V 5AMP

    • Description: Power supply providing 12V DC output.
    • Pins: 220V Positive Pole (AC), 220V Negative Pole (AC), GND, GND (DC), 12V-24V Output (DC)
  7. AC source

    • Description: AC power source.
    • Pins: +, -

Wiring Details

Arduino UNO

A4988 on Breakout Board

ULN 2003

POWER SUPPLY 12V 5AMP

Code Documentation

/*
 * Arduino Sketch for Automatic Styrofoam Cutter
 * This code controls two stepper motors using an A4988 driver and a ULN2003 driver.
 * The A4988 driver controls a bipolar stepper motor, while the ULN2003 driver
 * controls a unipolar stepper motor. The Arduino UNO is used to send control
 * signals to both drivers. The code initializes the pins and runs a simple
 * sequence to demonstrate the movement of the stepper motors.
 */

// Pin definitions for ULN2003 driver
#define IN1 8
#define IN2 9
#define IN3 10
#define IN4 11

// Pin definitions for A4988 driver
#define DIR_PIN 2
#define STEP_PIN 3
#define ENABLE_PIN 4

void setup() {
  // Initialize serial communication
  Serial.begin(9600);

  // Set ULN2003 pins as outputs
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);

  // Set A4988 pins as outputs
  pinMode(DIR_PIN, OUTPUT);
  pinMode(STEP_PIN, OUTPUT);
  pinMode(ENABLE_PIN, OUTPUT);

  // Enable A4988 driver
  digitalWrite(ENABLE_PIN, LOW);
}

void loop() {
  // Rotate unipolar stepper motor (ULN2003) one full cycle
  for (int i = 0; i < 512; i++) {
    stepUnipolar();
  }

  // Rotate bipolar stepper motor (A4988) one full cycle
  digitalWrite(DIR_PIN, HIGH); // Set direction
  for (int i = 0; i < 200; i++) {
    stepBipolar();
  }

  delay(1000); // Wait for 1 second
}

void stepUnipolar() {
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, LOW);
  delay(2);
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, HIGH);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, LOW);
  delay(2);
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, HIGH);
  digitalWrite(IN4, LOW);
  delay(2);
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, HIGH);
  delay(2);
}

void stepBipolar() {
  digitalWrite(STEP_PIN, HIGH);
  delayMicroseconds(1000);
  digitalWrite(STEP_PIN, LOW);
  delayMicroseconds(1000);
}

This code initializes the pins for the ULN2003 and A4988 drivers and runs a simple sequence to rotate both the unipolar and bipolar stepper motors. The stepUnipolar function controls the ULN2003 driver, while the stepBipolar function controls the A4988 driver. The main loop rotates each motor one full cycle and then waits for one second before repeating.