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 Potentiometer Speed Control

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

Circuit Documentation

Summary

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

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 driver module for controlling 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.
  5. 8 Push Button Board PCB

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

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

    • Pins: GND, 5V, SIG
    • Description: A potentiometer module for analog input.
  8. OLED Display 2.42"

    • Pins: GND, VCC, SCK, SDA, RES, DC, CS
    • Description: An OLED display for visual output.
  9. Battery 38.5V 24Ah

    • Pins: Out +ve, Out -ve
    • Description: A battery for powering the circuit.

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(AccelStepper::DRIVER, 4, 5);
AccelStepper stepper3(AccelStepper::DRIVER, 6, 7);

// Define button pins
const int buttonPins[8] = {8, 9, 10,