Circuit Documentation
Summary
This circuit is designed to control a 28BYJ-48 stepper motor using an Arduino UNO and a ULN2003A breakout board. The Arduino UNO sends control signals to the ULN2003A, which in turn drives the stepper motor. The circuit allows for precise control of the stepper motor's position and speed.
Component List
28BYJ-48 Stepper Motor
- Description: A small, inexpensive stepper motor commonly used in various applications for precise control of rotation.
- Pins: BLUE, PINK, YELLOW, ORANGE, RED
ULN2003A Breakout Board
- Description: A Darlington transistor array used to drive the stepper motor. It receives control signals from the Arduino and powers the stepper motor.
- 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. It is used to send control signals to the ULN2003A breakout board.
- 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 BLUE wire on ULN2003A breakout board
- PINK wire connected to PINK wire on ULN2003A breakout board
- YELLOW wire connected to YELLOW wire on ULN2003A breakout board
- ORANGE wire connected to ORANGE wire on ULN2003A breakout board
- RED wire connected to RED wire on ULN2003A breakout board
ULN2003A Breakout Board
- BLUE wire connected to BLUE wire on 28BYJ-48 Stepper Motor
- PINK wire connected to PINK wire on 28BYJ-48 Stepper Motor
- YELLOW wire connected to YELLOW wire on 28BYJ-48 Stepper Motor
- ORANGE wire connected to ORANGE wire on 28BYJ-48 Stepper Motor
- RED wire connected to RED wire on 28BYJ-48 Stepper Motor
- In 1 connected to D8 on Arduino UNO
- In 2 connected to D9 on Arduino UNO
- In 3 connected to D10 on Arduino UNO
- In 4 connected to D11 on Arduino UNO
- 0V connected to GND on Arduino UNO
- +5V connected to 5V on Arduino UNO
Arduino UNO
- D8 connected to In 1 on ULN2003A breakout board
- D9 connected to In 2 on ULN2003A breakout board
- D10 connected to In 3 on ULN2003A breakout board
- D11 connected to In 4 on ULN2003A breakout board
- GND connected to 0V on ULN2003A breakout board
- 5V connected to +5V on ULN2003A breakout board
Code Documentation
Arduino UNO 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);
}
}
Description:
- Libraries: The code includes the
Stepper
library to control the stepper motor.
- Definitions: The number of steps per revolution is defined as 32.
- Stepper Initialization: The stepper motor is initialized with the control pins D8, D9, D10, and D11.
- Setup Function: Initializes the serial communication at 9600 baud rate and sets the speed of the stepper motor to 200 RPM.
- Loop Function: Continuously checks for available serial input. If input is available, it reads the integer value, moves the stepper motor by that number of steps, and prints the value to the serial monitor.