ULN2003 Stepper Motor Driver Features
We usually use stepper motors when we need precise control of the motor shaft. These motors can be used in robot arm, 3D printers, CNC machines, etc. 28BJY-48 is a kind of stepper motor. In full step mode, these motors have a 1 to 64 speed reduction gearbox and eachfull 360 degree rotation consists of 32 steps. The ULN2003 driver is commonly used to control these motors.
ULN2003 IC consists of 7 pairs of Darlington transistors, each pair can withstand 500mA and 50V. There are 4 transistors in this module. This module has 4 LEDs to show the activity of 4 motor control pins.
You can download the datasheet of ULN2003 IC here.
ULN2003 Stepper Motor Driver Datahseet
ULN2003 Stepper Motor Driver Pinout
This Module has 7 pins:
- VIN: Module power supply – 5V to 12V
- GND: Ground
- IN1: Control pin 1
- IN2: Control pin 2
- IN3: Control pin 3
- IN4: Control pin 4
- MOTOR: Connected signals to motor
You can see the pinout of these modules in the image below.
Required Materials
Hardware Components
Software Apps
Interfacing ULN2003 Stepper Motor Driver with Arduino
Step 1: Circuit
The following circuit show how you should connect Arduino to ULN2003 module. Connect wires accordingly.
Note
Connect Arduino GND pin to power supply GND pin.
Warning
Be careful not to use power supply greater than 5V, because the motor voltage is 5V.
Step 2: Code
Upload the following code to your Arduino.
/*
ULN2003-Stepper-Motor-Driver
modified on 25 Nov 2020
by Amir Mohammad Shojaee @ Electropeak
Home
based on Arduino library Example
*/
#include <Stepper.h>
const int stepsPerRevolution = 2048;
const int rpm = 12;
Stepper stepper1 = Stepper(stepsPerRevolution, 8, 10, 9, 11);
void setup() {
stepper1.setSpeed(rpm);
}
void loop() {
stepper1.step(stepsPerRevolution);
delay(100);
stepper1.step(-stepsPerRevolution);
delay(100);
}
In the above code, at first the motor library is included. In the next step, the two variables of rotation step and motor speed are determined in terms of RPM. The 28BJY-48 motor has a 64:1 gear and 32 steps per revolution. To obtain the final number of steps, the gear ratio must be multiplied by the number of steps per revolution (32×64 = 2048). We also set its speed to 12 RPM. The control pins are then determined in the above order. Finally, the motor rotates clockwise for 5 seconds and counterclockwise for 5 seconds.
Comments (4)
Which pins in this line ” Stepper stepper1 = Stepper(stepsPerRevolution, 8, 10, 9, 11); ” must be used when it is an Arduino NANO?
Hi,
There is no significant difference between Arduino UNO and NANO. So, you can use the same pins for it.
can I use this controller to control a stepper motor no 17. If I can, which pins of the motor do I connect to which pins of the controller?
Thank you
Hello, my friend,
you can’t connect NEMA 17 to this driver.
You can use the A4988 driver