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

Arduino UNO Controlled Stepper Motor with Servo Integration

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

Circuit Documentation

Summary

This circuit involves an Arduino UNO microcontroller controlling a stepper motor. The Arduino provides the necessary control signals to the stepper motor to drive it in both directions. Additionally, a servo motor is controlled by the Arduino to move between specified angles.

Component List

Stepper Motor

Arduino UNO

Wiring Details

Stepper Motor One

Arduino UNO

Code Documentation

Arduino UNO Code

#include <Stepper.h>
#include <Servo.h>

#define OUTPUT1   4
#define OUTPUT2   5
#define OUTPUT3   6
#define OUTPUT4   7

Servo servo;
const int stepsPerRotation = 2048; // 
Stepper myStepper(stepsPerRotation, OUTPUT1, OUTPUT3, OUTPUT2, OUTPUT4);  

void setup() {
  servo.attach(8);
  servo.write(90);
  myStepper.setSpeed(15); // RPM (Round Per Minute)
}

void loop() {
  myStepper.step(stepsPerRotation);
  delay(500);
  servo.write(0);
  delay(500);
  myStepper.step(-stepsPerRotation);
  delay(500);
  servo.write(180);
  delay(500);
}

This code initializes a stepper motor and a servo motor. The stepper motor is controlled to rotate in both directions, while the servo motor moves between 0, 90, and 180 degrees. The setup() function initializes the servo motor to 90 degrees and sets the speed of the stepper motor. The loop() function continuously rotates the stepper motor and moves the servo motor between specified angles with delays in between.