Arduino-Controlled 28BYJ-48 Stepper Motor with ULN2003 Driver
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to control a 28BYJ-48 Stepper Motor using an Arduino UNO microcontroller and a ULN2003A breakout board. The Arduino UNO is programmed to drive the stepper motor based on serial input commands, allowing for precise control of the motor's steps. The ULN2003A breakout board serves as an interface between the low-power Arduino output pins and the higher-power requirements of the stepper motor.
Component List
28BYJ-48 Stepper Motor
- Description: A small and inexpensive stepper motor suitable for a wide range of applications.
- Pins: BLUE, PINK, YELLOW, ORANGE, RED
Arduino UNO
- Description: A microcontroller board based on the ATmega328P, widely used for building digital devices and interactive objects.
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0-A5, SCL, SDA, AREF, D0-D13
ULN2003A Breakout Board
- Description: A breakout board for the ULN2003A Darlington transistor array, used for driving high-current loads.
- Pins: In 1-7, 0V, +5V, ON/OFF jumper switch, BLUE wire, PINK wire, YELLOW wire, ORANGE wire, RED wire
Wiring Details
28BYJ-48 Stepper Motor
- BLUE: Connected to ULN2003A breakout board (BLUE wire)
- PINK: Connected to ULN2003A breakout board (PINK wire)
- YELLOW: Connected to ULN2003A breakout board (YELLOW wire)
- ORANGE: Connected to ULN2003A breakout board (ORANGE wire)
- RED: Connected to ULN2003A breakout board (RED wire)
Arduino UNO
- 5V: Connected to ULN2003A breakout board (+5V)
- GND: Connected to ULN2003A breakout board (0V)
- D8: Connected to ULN2003A breakout board (In 1)
- D9: Connected to ULN2003A breakout board (In 2)
- D10: Connected to ULN2003A breakout board (In 3)
- D11: Connected to ULN2003A breakout board (In 4)
ULN2003A Breakout Board
- +5V: Connected to Arduino UNO (5V)
- 0V: Connected to Arduino UNO (GND)
- In 1: Connected to Arduino UNO (D8)
- In 2: Connected to Arduino UNO (D9)
- In 3: Connected to Arduino UNO (D10)
- In 4: Connected to Arduino UNO (D11)
- BLUE wire: Connected to 28BYJ-48 Stepper Motor (BLUE)
- PINK wire: Connected to 28BYJ-48 Stepper Motor (PINK)
- YELLOW wire: Connected to 28BYJ-48 Stepper Motor (YELLOW)
- ORANGE wire: Connected to 28BYJ-48 Stepper Motor (ORANGE)
- RED wire: Connected to 28BYJ-48 Stepper Motor (RED)
Documented Code
#include <Stepper.h>
#define STEPS 32
Stepper stepper(STEPS, 8, 9, 10, 11);
int val = 0;
void setup() {
Serial.begin(9600);
stepper.setSpeed(200);
}
void loop() {
if (Serial.available() > 0) {
val = Serial.parseInt();
stepper.step(val);
Serial.println(val);
}
}
Filename: sketch.ino
Description: This Arduino sketch is designed to control a stepper motor via serial commands. It initializes the stepper motor with a predefined number of steps and sets its speed. In the main loop, it listens for serial input and moves the stepper motor a number of steps based on the parsed integer value from the serial input.