Logo

dev-resources.site

for different kinds of informations.

Controlling a 28BYJ-48 Stepper Motor with Arduino: A Step-by-Step Guide

Published at
7/10/2024
Categories
arduino
electronics
diyelectronics
electronicsprojects
Author
akshay_jain
Author
11 person written this
akshay_jain
open
Controlling a 28BYJ-48 Stepper Motor with Arduino: A Step-by-Step Guide

In this guide, we will walk you through controlling a 28BYJ-48 stepper motor using an Arduino and a ULN2003 driver. This tutorial aims to provide a hands-on experience for enthusiasts and beginners in the field of electronics and robotics. For a detailed explanation and additional resources, visit my blog post at Stepper Motor Control with Arduino.

Materials Needed

Arduino UNO
28BYJ-48 Stepper Motor
ULN2003 Driver Module
Jumper Wires
Breadboard (optional)
Power Supply (optional)

Understanding the Components

28BYJ-48 Stepper Motor: This stepper motor is known for its low cost and reliability. It has a 5-wire interface that connects to the ULN2003 driver.
ULN2003 Driver Module: The ULN2003 is a Darlington transistor array used to drive the stepper motor. It provides the necessary current and voltage to the motor from the Arduino signals.

Circuit Connections

Image description

Connecting the Motor to the Driver

Connect the 5-wire connector of the 28BYJ-48 stepper motor to the ULN2003 driver module.

Connecting the Driver to the Arduino

  • Connect the IN1 pin on the ULN2003 to the digital pin 7 on the Arduino.
  • Connect the IN2 pin on the ULN2003 to the digital pin 6 on the Arduino.
  • Connect the IN3 pin on the ULN2003 to the digital pin 5 on the Arduino.
  • Connect the IN4 pin on the ULN2003 to the digital pin 4 on the Arduino.
  • Connect the GND pin on the ULN2003 to a GND pin on the Arduino.
  • Connect the VCC pin on the ULN2003 to the 5V pin on the Arduino.

Arduino Code

Upload the following code to your Arduino

#include <Stepper.h>
//define Input pins of the Motor
#define OUTPUT1   7                // Connected to the Blue coloured wire
#define OUTPUT2   6                // Connected to the Pink coloured wire
#define OUTPUT3   5                // Connected to the Yellow coloured wire
#define OUTPUT4   4                // Connected to the Orange coloured wire
// Define the number of steps per rotation
const int stepsPerRotation = 2048;  // 28BYJ-48 has 2048 steps per rotation in full step mode as given in data sheet
// Initialize the stepper motor with the sequence of control pins OUTPUT1, OUTPUT3, OUTPUT2, IN4
// OUTPUT1 and OUTPUT3 are connected to one coil and OUTPUT2 and OUTPUT4 are connected to one Coil
Stepper myStepper(stepsPerRotation, OUTPUT1, OUTPUT3, OUTPUT2, OUTPUT4);  
void setup() {
  // Set the speed of the motor in RPM (adjust as needed)
  myStepper.setSpeed(15);  // 15 RPM
}
void loop() {
  // Rotate in One Direction and complete one complete rotation i.e 2048 steps
  myStepper.step(stepsPerRotation);  
  delay(1000);  // Delay between rotations
  // For Rotation in opposite direction provide the variable to the parameter with negative Sign
  myStepper.step(-stepsPerRotation);  
  delay(1000);  // Delay between rotations
}
Enter fullscreen mode Exit fullscreen mode
electronics Article's
30 articles in total
Favicon
AUIRS21814STR: Features, Specs & More
Favicon
Microgrid as a Service Market to Develop New Trend and Growth Story
Favicon
Troubleshooting Arduino Not Detected on COM Port in Windows
Favicon
Tech Helpr: Your Ultimate Destination for Gaming and Tech Products
Favicon
Biofeedback Instrument Market Share, Growth and Forecast by 2031
Favicon
Camera Accessories Market Regional Share, Trends, and Forecast by 2031
Favicon
Display Controller Market Size, Share and Forecast by 2031
Favicon
Emerging Trends in Automated Security Systems in Bangladesh
Favicon
The Rise of Automated Security Systems in Bangladesh: A New Era of Safety
Favicon
Shopping Way Pk
Favicon
Optimizing Workplace Safety with Addsoft’s Safety Training Kiosk and Secure PPE Lockers!
Favicon
Building the Micro Journal
Favicon
How Air Conditioner relay works
Favicon
Difference between firing and conduction angle of scr
Favicon
Embedded Systems 101: The Silent Powerhouses of Our Digital World
Favicon
Controlling a 28BYJ-48 Stepper Motor with Arduino: A Step-by-Step Guide
Favicon
Harnessing the Potential of Safety Training Kiosks: A Detailed Guide!
Favicon
Master-Slave Communication Between Two Arduino Boards
Favicon
Indirect Band Gap Semiconductor
Favicon
Understanding MicroPython: Python for Small Devices
Favicon
Afinal, o que são os 0's e 1's?
Favicon
Elevate Your Industrial Processes with Subhot Industrial Heater
Favicon
So Long Venerable Z80 and Thanks For All the Fish!
Favicon
Top Arduino Uno Projects for Beginners and Engineering Students
Favicon
Best Countries for Contract Electronics Manufacturing, Part 2: Malaysia, Thailand, Vietnam, and India
Favicon
Best Countries for Contract Electronics Manufacturing, Part 1: China, Taiwan, the USA, and Mexico
Favicon
Deep Drawn Components manufacturers
Favicon
Simple current load
Favicon
Exploring the Synergy of Robotics and Electronics: A Glimpse into the Future
Favicon
Navigating the Data-Driven Revolution: Big Data Analytics in Semiconductor and Electronics Market Trends

Featured ones: