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

Arduino Mega 2560 Controlled Multi-Stepper Motor System with OLED Display and Push Buttons

View and Edit Project In Cirkit DesignerImage of Arduino Mega 2560 Controlled Multi-Stepper Motor System with OLED Display and Push Buttons

Circuit Documentation

Summary

This circuit is designed to control a system with three stepper motors, eight push buttons, two potentiometers, and an OLED display using an Arduino Mega 2560. The system has three modes of operation, each activated by a long press of a specific button. The potentiometers are used to control the speed of the motors, and the OLED display shows relevant information such as speed in RPM, motor angles, and operation count.

Component List

  1. Bipolar Stepper Motor (NEMA 17)

    • Pins: A-, A+, B+, B-
    • Description: A bipolar stepper motor used for precise control of rotational position.
  2. Stepper Motor (Bipolar)

    • Pins: D, B, C, A
    • Description: A bipolar stepper motor used for precise control of rotational position.
  3. A4988 Stepper Motor Driver (Red)

    • Pins: ENABLE, MS1, MS2, MS3, RESET, SLEEP, STEP, DIR, VMOT, GND, 2B, 2A, 1A, 1B, VDD
    • Description: A stepper motor driver used to control the bipolar stepper motors.
  4. Arduino Mega 2560

    • Pins: IOREF, RESET, 3V3, 5V, GND, VIN, A0-A15, D0-D53, AREF, SDA, SCL
    • Description: A microcontroller board based on the ATmega2560, used to control the entire system.
  5. 8 Push Button Board PCB

    • Pins: K1, K2, K3, K4, K5, K6, K7, K8, GROUND
    • Description: A PCB with 8 push buttons used for user input.
  6. Push Button Round

    • Pins: leg0, leg1
    • Description: A single round push button used for additional user input.
  7. MKE-M04 Potentiometer Module

    • Pins: GND, 5V, SIG
    • Description: A potentiometer module used to control the speed of the motors.
  8. OLED Display 2.42"

    • Pins: GND, VCC, SCK, SDA, RES, DC, CS
    • Description: An OLED display used to show relevant information such as speed in RPM, motor angles, and operation count.
  9. Battery 38.5V 24Ah

    • Pins: Out +ve, Out -ve
    • Description: A battery used to power the stepper motor drivers.

Wiring Details

Bipolar Stepper Motor (NEMA 17)

Stepper Motor (Bipolar)

A4988 Stepper Motor Driver (Red)

Arduino Mega 2560

8 Push Button Board PCB

Push Button Round

MKE-M04 Potentiometer Module

OLED Display 2.42"

Battery 38.5V 24Ah

Code Documentation

/*
 * This Arduino sketch controls a system with 3 stepper motors, 8 push buttons,
 * 2 potentiometers, and an OLED display. The system has 3 modes of operation,
 * each activated by a long press of a specific button. The potentiometers are
 * used to control the speed of the motors, and the OLED display shows relevant
 * information such as speed in RPM, motor angles, and operation count.
 */

#include <AccelStepper.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

// Define stepper motor connections and interface type
AccelStepper stepper1(AccelStepper::DRIVER, 2, 3);
AccelStepper stepper2