Designing a Motor Driver Circuit for a Stepper Motor Using ULN2003ADR
by lorry in Circuits > Electronics
236 Views, 0 Favorites, 0 Comments
Designing a Motor Driver Circuit for a Stepper Motor Using ULN2003ADR

The ULN2003ADR is a high-voltage, high-current Darlington transistor array designed for driving inductive loads such as relays, stepper motors, and solenoids. It features seven open-collector Darlington pairs with common-emitter outputs, capable of driving currents up to 500 mA per channel. This makes it an ideal choice for controlling stepper motors in various applications, including robotics, automation, and CNC machines.
In this project, we will design a simple circuit to control a unipolar stepper motor using the ULN2003ADR. The circuit will interface with a microcontroller, such as an Arduino, to drive the motor through its step sequence, enabling precise control over position and speed.
Key Features of ULN2003ADR:
- Seven Darlington Transistor Pairs: Capable of driving up to 500mA per channel with low saturation voltage.
- High-voltage Output: Can handle up to 50V on the output pins.
- Built-in Flyback Diodes: For driving inductive loads like motors, relays, and solenoids, it includes internal protection against voltage spikes from inductive loads.
- Logic-level Inputs: Can directly interface with TTL or CMOS logic levels (e.g., microcontrollers like Arduino, Raspberry Pi).
Stepper Motor Types
- Unipolar Stepper Motors: This project focuses on driving a unipolar stepper motor, which has a center-tapped coil and requires four driving signals for proper operation.
- Bipolar Stepper Motors: While the ULN2003ADR can also be used for bipolar motors, the configuration would be different since they require two windings with current flowing in opposite directions.
Objective
The goal of this project is to control a 28BYJ-48 unipolar stepper motor using the ULN2003ADR driver IC. We will use an Arduino to generate the control signals, driving the stepper motor to rotate in both clockwise and counterclockwise directions. The motor will rotate in steps, and the speed and direction will be controlled via the Arduino code.
Supplies

- ULN2003ADR: Darlington transistor array for driving the stepper motor.
- Stepper Motor: A unipolar stepper motor (e.g., 28BYJ-48).
- Arduino: A microcontroller to generate control signals (e.g., Arduino Uno).
- External Power Supply: For the stepper motor (e.g., 5V for the 28BYJ-48 motor).
- Resistors: For current-limiting, as needed.
- Flyback Diodes: If not using the ULN2003ADR’s internal diodes (though these are included).
- Breadboard and Jumper Wires: For prototyping the circuit.
- Power Supply: 5V DC power supply to drive the stepper motor.
- Capacitors (optional): To smooth out power supply noise, especially for larger motors.
Circuit Design

The stepper motor will be controlled by four output pins from the Arduino. These pins will interface with the inputs of the ULN2003ADR, which will drive the stepper motor's coils through its open-collector outputs. The ULN2003ADR allows you to control larger currents and voltages to the motor, which is not directly possible with the Arduino.
Here’s the basic schematic for this setup:
+5V
|
[Motor]
|
Coil A | Coil B
------- -------
| | | |
Arduino ULN2003ADR Stepper Motor
Pin 8 --> IN1 OUT1 --> Coil 1
Pin 9 --> IN2 OUT2 --> Coil 2
Pin 10 --> IN3 OUT3 --> Coil 3
Pin 11 --> IN4 OUT4 --> Coil 4
Pin Connections
- Stepper Motor Pins: The stepper motor has four wires (or leads). These connect to the output pins (OUT1–OUT4) of the ULN2003ADR.
- Arduino Connections: Four pins from the Arduino (e.g., Pins 8, 9, 10, 11) are connected to the input pins (IN1–IN4) of the ULN2003ADR.
- Power Supply: The stepper motor is powered by an external 5V supply, while the Arduino can be powered through its own USB or a separate 5V DC supply.
ULN2003ADR Pinout
- IN1, IN2, IN3, IN4: These pins receive logic-level control signals (from the Arduino).
- OUT1, OUT2, OUT3, OUT4: These are the output pins that connect to the stepper motor coils.
- COM: Connect this pin to the positive supply voltage to enable the internal flyback diodes (optional).
- GND: Connect to the ground of the system.
Power Considerations
- Arduino Power: The Arduino Uno operates at 5V, which can be supplied through its USB port or an external 5V source.
- Motor Power: The 28BYJ-48 motor requires 5V. It should be powered independently from the Arduino to avoid overloading the microcontroller’s power supply.
Arduino Code

The Arduino will generate a control sequence to step the motor through its full range of motion. A simple sequence for a 4-step unipolar stepper motor is shown below.
Code to Control the Stepper Motor
// Define the Arduino pins connected to the ULN2003ADR inputs
int stepPin1 = 8;
int stepPin2 = 9;
int stepPin3 = 10;
int stepPin4 = 11;
void setup() {
// Initialize the stepper motor control pins as OUTPUT
pinMode(stepPin1, OUTPUT);
pinMode(stepPin2, OUTPUT);
pinMode(stepPin3, OUTPUT);
pinMode(stepPin4, OUTPUT);
}
void loop() {
// Rotate motor clockwise
stepMotor(1);
delay(1000); // Wait for 1 second
// Rotate motor counterclockwise
stepMotor(2);
delay(1000); // Wait for 1 second
}
// Function to control the stepper motor
void stepMotor(int direction) {
if (direction == 1) { // Clockwise rotation
digitalWrite(stepPin1, HIGH);
digitalWrite(stepPin2, LOW);
digitalWrite(stepPin3, HIGH);
digitalWrite(stepPin4, LOW);
delay(500); // Wait for half a step
digitalWrite(stepPin1, LOW);
digitalWrite(stepPin2, HIGH);
digitalWrite(stepPin3, HIGH);
digitalWrite(stepPin4, LOW);
delay(500);
digitalWrite(stepPin1, LOW);
digitalWrite(stepPin2, HIGH);
digitalWrite(stepPin3, LOW);
digitalWrite(stepPin4, HIGH);
delay(500);
digitalWrite(stepPin1, HIGH);
digitalWrite(stepPin2, LOW);
digitalWrite(stepPin3, LOW);
digitalWrite(stepPin4, HIGH);
delay(500);
} else if (direction == 2) { // Counterclockwise rotation
digitalWrite(stepPin1, HIGH);
digitalWrite(stepPin2, LOW);
digitalWrite(stepPin3, LOW);
digitalWrite(stepPin4, HIGH);
delay(500);
digitalWrite(stepPin1, LOW);
digitalWrite(stepPin2, HIGH);
digitalWrite(stepPin3, LOW);
digitalWrite(stepPin4, HIGH);
delay(500);
digitalWrite(stepPin1, LOW);
digitalWrite(stepPin2, HIGH);
digitalWrite(stepPin3, HIGH);
digitalWrite(stepPin4, LOW);
delay(500);
digitalWrite(stepPin1, HIGH);
digitalWrite(stepPin2, LOW);
digitalWrite(stepPin3, HIGH);
digitalWrite(stepPin4, LOW);
delay(500);
}
}
Explanation of the Code:
- Pin Setup: The Arduino pins (8, 9, 10, and 11) are set as outputs to control the inputs of the ULN2003ADR.
- Motor Control: The function stepMotor() controls the stepper motor by activating the appropriate sequence of outputs.
- Clockwise and Counterclockwise Rotation: The stepMotor() function rotates the motor either clockwise or counterclockwise by adjusting the pin states in a specific order.
Testing the System
)
- Verify Connections: Ensure that all wires are securely connected according to the schematic. Double-check the connections for the stepper motor, ULN2003ADR, and the Arduino.
- Upload Code: Upload the Arduino code to the microcontroller and open the Serial Monitor.
- Observe Motor Behavior: The stepper motor should rotate in both clockwise and counterclockwise directions based on the program’s delays and logic.
Conclusion
In this project, we successfully designed a motor driver circuit using the ULN2003ADR to control a 28BYJ-48 unipolar stepper motor with an Arduino. By leveraging the ULN2003ADR’s high-current driving capability and its internal flyback diodes, we were able to efficiently drive the motor and achieve precise control over its movement. The Arduino's simple control signals were translated into a stepper motor's step sequence, enabling both clockwise and counterclockwise rotations. This project not only demonstrates the utility of the ULN2003ADR in motor control applications but also provides a foundation for more advanced projects involving robotics, automation, and motion control systems. With further enhancements, such as adding speed control or integrating sensors, this system can be adapted to more complex tasks.