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 sends control signals to the ULN2003A, which in turn drives the stepper motor. The circuit is powered by the Arduino's 5V output, and the ground is shared across the components. The stepper motor is controlled through a set of digital pins on the Arduino, which are interfaced with the input pins of the ULN2003A breakout board.
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
ULN2003A Breakout Board
- Description: A breakout board for the ULN2003A Darlington transistor array, used for driving high-current loads such as stepper motors.
- Pins: In 1, In 2, In 3, In 4, In 5, In 6, In 7, 0V, +5V, ON/OFF jumper switch, BLUE wire, PINK wire, YELLOW wire, ORANGE wire, RED wire
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, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
Wiring Details
28BYJ-48 Stepper Motor
- BLUE wire connected to ULN2003A breakout board BLUE wire
- PINK wire connected to ULN2003A breakout board PINK wire
- YELLOW wire connected to ULN2003A breakout board YELLOW wire
- ORANGE wire connected to ULN2003A breakout board ORANGE wire
- RED wire connected to ULN2003A breakout board RED wire
ULN2003A Breakout Board
- 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
- 0V connected to Arduino UNO GND
- +5V connected to Arduino UNO 5V
- 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
Arduino UNO
- 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
- GND connected to ULN2003A breakout board 0V
- 5V connected to ULN2003A breakout board +5V
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
Code Description
- The code includes the
Stepper
library, which is used to control stepper motors with the Arduino.
STEPS
is defined as 32, which is the number of steps per revolution for the 28BYJ-48 stepper motor.
- An instance of the
Stepper
class is created named stepper
, initialized with the number of steps and the pins connected to the ULN2003A inputs.
- In the
setup()
function, the serial communication is started at 9600 baud, and the stepper motor speed is set to 200 RPM.
- The
loop()
function continuously checks for available serial data. If data is available, it parses the data as an integer (val
), commands the stepper motor to step that number of steps, and then prints the value to the serial monitor.