Arduino Projects

UniPolar and Bipolar Stepper Motors Speed and Position Control

Description:

 

UniPolar and Bipolar Stepper Motors Speed and Position ControlStepper Motors are used for precise positioning and that’s why they are used in Printers, CNC machines, CD ROMs, Robotics, Telescopes, toys and so on. There are mainly two types of Stepper motors

  1. UniPolar stepper Motors
  2. Bipolar stepper motors.

Unipolar Stepper motors are further divided into two groups

  1. 5 wires UniPolar stepper motors
  2. 6 wires UniPolar stepper motors.

Bipolar stepper motors come with 4 wires.

Regardless of the type and size of the stepper motors, the basic working principle of all the steppers motors are exactly the same, In this Tutorial, I will practically show you how to use the same programs to control all the three stepper motors.

This tutorial covers

  1. Constant speed and constant limits
  2. Variable speed and constant limits
  3. Precise manual positioning


Amazon Links:

Arduino Nano USB-C Type (Recommended)

12v Adaptor:

L298N motor driver:

Arduino CNC Shield V3.0

A4988 Stepper Motor Driver

Hybrid Stepper Motor Nema17:

12v UniPolar stepper motor:

CD ROM bipolar stepper motor:

24BYJ48 5V DC unipolar stepper motor:

Other Tools and Components:

ESP32 WiFi + Bluetooth Module (Recommended)

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

Stepper Motor Arduino Circuit Diagram:

Stepper Motor

This is the complete circuit diagram, designed in cadsoft eagle 9.1.0 version. if you want to learn how to make a schematic and PCB then watch my tutorial on the schematic designing and PCB designing, the video is available on my YouTube channel “Electronic Clinic”.

As I said earlier regardless of the type and size of the stepper motors 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 the 3 stepper motors. As the stepper motors, 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.

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.

L2989N Motor Driver Pinout:

Stepper Motor

This is the L298N dual H-bridge motor driver. This motor driver can be used to control Dc motors that have voltages between 5 and 35volts, with a peak current of up to 2amps. As this is a dual H-Bridge motor driver, it can be used to control the speed and direction of two DC motors at the same time.

As you a stepper motor has 4 wires, so it means we can use the L298N motor driver to control one stepper motor. The UniPolar and BiPolar Stepper motor coil wires are connected with the OUT1, OUT2, OUT3, and OUT4.

Now let’s take a closer look at the pinout of L298N module, this module has three terminal blocks, two-terminal blocks are labeled with OUT1, OUT2, OUT3, and OUT4. This is where we connect the wires of the Stepper Motor.

This terminal block is labeled with +12v, GND, and +5v. The external power supply is connected with the +12v and GND contacts. This is not important that we always connect 12 volts, it depends on the voltage rating of the Stepper motor. If you are using a 5v Stepper motor then you can connect a 5-volt power supply with the +12v and GND contacts. In this tutorial, I will use 12-volt power supply and a 5-volt power supply. The +5 volt contact is connected with the Arduino’s 5 volts.


Stepper Motor

As you can see this motor driver also have some male headers and are clearly labeled with  ENA, IN1, IN2, IN3, IN4, and ENB. The ENA and ENB are used to enable both the motors. jumper caps means that both the motors are enabled by default, and the motors will rotate at maximum speed. if the jumper caps are removed and the ENA and ENB pins are connected with the PWM pins of the Arduino, the motors speed can be controlled using the pulse width modulation.

But in this Tutorial, we are not using Pulse Width Modulation. We will use the enables pins only to turn ON and turn OFF the stepper motors. The connections are already explained in the circuit diagram.

If you do not know about the wires of the 6 wires Stepper Motor and you face problem in finding the coil wires and common wires then refer to the video at the end of this Article.


Arduino Stepper Motors Programming:

Program 1:

Program number 2 of Stepper Motors:

Program 3 of Stepper Motors:

Watch Video Tutorial:

Stepper Motor Related Project:

Joystick controlled CD ROM Stepper Motor:

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

Your email address will not be published. Required fields are marked *

Back to top button