Stepper Motors with...
Clear all

Stepper Motors with Arduino - Controlling Bipolar & Unipolar stepper motors

DroneBot Workshop
Workshop Guru Admin
Joined: 2 years ago
Posts: 1022
Topic starter  

Learn how to use stepper motors with the Arduino.

Full Article with Code at

Today we will be working with stepper motors, a versatile yet often misunderstood electromechanical component used in a variety of devices.

After examining how stepper motors work and what the difference is between a “Bipolar” and “Unipolar” stepper is I will show you how three methods of controlling a stepper motor with an Arduino:

1 - A common 28YBJ-48 Unipolar Stepper with a ULN2003 driver board. These inexpensive stepper and driver combinations are very common and are available on eBay, Amazon, and probably in your local electronics store. I’ll show you two different ways to use these with two different Arduino libraries.

2 - A NEMA 17 Bipolar stepper motor with an L298N dual H-Bridge driver board. We’ve used the L298N driver board in another video to control a pair of brushed DC motors but it also makes a good driver for a bipolar stepper motor.

3 - The same NEMA 17 Bipolar stepper motor controlled by an A4988 stepper driver. This common driver board is used in many 3D printers and CNC machines and simplifies the control of one or several stepper motors with an Arduino.

I’ll also discuss concepts like microstepping and I will show you how to understand some of the many parameters that are included on stepper motor specification sheets.

If you’d like to jump ahead to a particular section in the video here is the table of contents:

00:00 - Introduction
01:34 - Stepper Motor Theory
04:21 - Bipolar vs Unipolar Steppers
08:18 - Common Stepper Specifications
11:32 - NEMA motor sizes
13:41 - 28YBJ-48 Unipolar Stepper with ULN2003
28:16 - NEMA 17 Bipolar with L298N
36:41 - NEMA 17 Bipolar with A4988

As always you can get all of the code I use in this video by visiting the DroneBot Workshop website and looking at the article at You’ll find code listings and hookup diagrams and well as a convenient ZIP file containing all of the Arduino sketches.

Hopefully, this video will inspire you to start using stepper motors in your own designs.

Now let's get stepping!

"Never trust a computer you can’t throw out a window." — Steve Wozniak

Active Member
Joined: 2 years ago
Posts: 6

Hi every one,

I am not very good at using a forum.  My question is how can I add a reverse switch to this sketch.  Also how would I know if some one have replied and where can I see the response.

Thanks every one