This circuit is designed to control a bipolar stepper motor using an Arduino UNO and an SN754410 quadruple half-H driver. The Arduino UNO is programmed to rotate the stepper motor one revolution in one direction, pause, and then rotate one revolution in the opposite direction. The SN754410 driver is used to amplify the control signals from the Arduino and drive the stepper motor. A 2.1mm Barrel Jack with Terminal Block is included to provide power to the motor.
/*
Sketch to control a stepper motor with Arduino UNO.
The motor should revolve one revolution in one direction, then one revolution in the other direction.
The code will cause the stepper motor to rotate clockwise for one revolution, pause for half a second,
and then rotate counterclockwise for one revolution.
*/
#include <Stepper.h>
const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);
void setup() {
// set the speed at 60 rpm:
myStepper.setSpeed(60);
// initialize the serial port:
Serial.begin(9600);
}
void loop() {
// step one revolution in one direction:
Serial.println("clockwise");
myStepper.step(stepsPerRevolution);
delay(500);
// step one revolution in the other direction:
Serial.println("counterclockwise");
myStepper.step(-stepsPerRevolution);
delay(500);
}
This code is designed to be uploaded to the Arduino UNO. It initializes the stepper motor with the specified number of steps per revolution and sets the motor speed. The loop
function then controls the motor to rotate in one direction, pause, and rotate in the opposite direction, with serial output indicating the direction of rotation.