CD ROM Stepper motor Arduino L298n + Joystick controlled speed and Direction Control

(Last Updated On: July 17, 2019)

stepper motor


In this Tutorial, you will learn how to control the speed and direction of the CD ROM stepper motor using 2 axis joystick, L298N motor driver and Arduino. The stepper motor control system can be activated and deactivated using the joystick push button. The same program and circuit connections can be used for the other types of the stepper motors.

For the extreme basics, you can watch my getting started tutorials on the bipolar and unipolar stepper motors, 2 Axis Joystick and L298n motor driver. So I highly recommend first you should watch these tutorials and then you can resume from here. The Tutorials links are given below.

UniPolar and Bipolar Stepper Motors Basics:

2 axis joystick getting started Tutorial:


L298n getting started tutorial:

The components and tools used in this project can be purchased from Amazon, the components Purchase links are given below:

Arduino Uno:
Mega 2560:
L298N motor driver:
12v UniPolar stepper motor:
CD ROM bipolar stepper motor:
24BYJ48 5V DC unipolar stepper motor:
5v 2A adaptor:
2n2222 npn transistors:
10k Resistor:
lm7805 Voltage Regulator:
330-ohm resistors pack:
female DC power jack socket:
470 uf capacitors:
5×7 cm vero board:
female headers:
connection wires:
Super Starter kit for Beginners:
Jumper Wires:
Bread Board:
12v Adaptor:
PCB plate:
Variable Supply:
Digital Multimeter:
Vero Board / strip board:
Soldering iron kit: “best” You guys should definitely purchase this:
Solder wire:
Wire Stripper:
wire cutter:
PCB small portable drill machine:

Circuit Diagram:

stepper motor

Regardless of the type and size of the stepper motor the basic working principle of all the stepper motors is exactly the same. The circuit diagram as you can see on the screen will remain the same for all types of the stepper motors. As the stepper motor, I am using has current requirement less than 4amps so that’s why I decided to use the L298N motor driver. The L298N motor driver is basically designed for controlling simple dc motors; in my previous tutorials, I used this motor driver for controlling the Robot… As the L298N motor driver has the ability to control 2 dc motors at the same, and as you know a stepper motor has 4 wires, so it means we can use the L298N motor driver to control a Unipolar or bipolar stepper motor. You might be thinking what about the Unipolar motors as they have 6 wires. Well, the common wires are not connected. So the Unipolar stepper motor connection with the l298n motor driver is exactly the same as the bipolar stepper motor.

As you can see in the circuit diagram the four wires of the stepper motor are connected with the out1, out2, out3, and out4. While the input pins of the l298N motor driver are connected with Arduino’s Pin number 8, 9, 10 and 11.

The enables pins of the l298n motor driver by default comes with the jumper caps, so make sure you remove the jumper caps and connect the enable pins with the Arduino’s pin number 6 and pin number 7.

J1 is the DC female power jack, this is where we connect the external 12v or 5v power supply and finally connect the VCC of the L298N motor driver with the Arduino’s 5volts.

The vrx and vry pins of the joystick are connected with the analog pins A0 and A1. The Switch is connected with the Arduino’s pin number 4. The VCC pin of the joystick is connected with the Arduino’s pin number 5, while the ground is connected with the Arduino’s Ground.

Let me tell you once again if you are using stepper motors with current ratings greater than 4amps then never use the l298N motor driver. Now let’s have a look at the pinout of the L298N motor Driver.


Watch Video Tutorial:


Other Stepper Motor Related Tutorial:

UniPolar and Bipolar Stepper Motors Speed and Position Control



Recommended For You

About the Author: Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Leave a Reply