
What is a stepper motor?
When we take a typical DC motor, we can get two functions out of it. These include changing the direction of rotation by changing the anode and cathode and changing the supply potential to control the speed of the motor. But these motors cannot control the steps and volume of rotation. For that, we can use stepper motors. With these stepper motors, we can control the turning steps. See the picture below.


It has two coils. We can rotate this motor according to the pattern that supplies power to these coils. We can see a large number of stepper motors and the two main types are depending on the way the coils are wrapped.
Bipolar


Unipolar
There are different types of motors depending on how the wires are connected to these. The bipolar types of motors have four wires. Other stepper motors have wires 4,5,6 etc. This type of motor cannot be controlled by supplying power in the normal way. This requires a special circuit. That is, an H-bridge circuit must be used. This circuit has four transistors. I described the H-Bridge circuit in a previous post. Click this link and read it Click me. There are two main types of ICs that contain these h-bridges. Those are l298 and l293. We can make a stepper driver circuit using these ICs.But it is very heavy work. We will use a stepper driver board to purchase to carry out this project.


Today stepper motor we use consists of five wires. It can be controlled via a stepper driver board. This can be controlled by four digital pins on the Arduino board. These four pins must be connected to the IN1, IN2, IN3, and IN4 pins on the drive board. This board should be connected to a 5 to 12 v supply. Ok, let’s do this project practically. The required components are as follows.
Components
- Arduino Uno board — Amazon Our Store
- Stepper motor and driver board — Banggood / Amazon
- Jumper wires — Amazon Our Store
Let’s do this project step by step.
Step 1
Identify the components.
Arduino Uno board.

You can use any other Arduino board.
Stepper motor and driver board

This component is described above.
Jumper wires

This project requires six MALE to FEMALE jumper wires.
Step 2
Connect these components using the circuit diagram below.


Step 3
Let’s look at the code below.
The complete program of this project – Download
/*Stepper motor control.
*created by the SriTu Tech team.
*Read the code below and use it for any of your creations
*/
#include <Stepper.h>
#define STEPS 100
Stepper stepper(STEPS, 8, 9, 10, 11);
void setup() {
stepper.setSpeed(200);//set motor speed
}
void loop() {
stepper.step(200);
delay(1000);//delay
stepper.step(200);
}
We first need a library for this code. Put it into the Arduino IDE using the steps below.
#include <Stepper.h>


This code specifies the number of steps required to rotate the motor
#define STEPS 100
This code includes the digital PINs used and the number of steps.
Stepper stepper(STEPS, 8, 9, 10, 11);
The code in the void setup controls the speed of the motor.
void setup() {
stepper.setSpeed(200);//set motor speed
}
This code causes the motor to rotate. Change its values and try again.
void loop() {
stepper.step(200);
delay(1000);//delay
stepper.step(200);
}
Step 4
Select board and port.


Step 5
Upload this code and enjoy it.

The full video of this post is below. Please watch it. We will meet in the next post. Have a good day. Bye-bye.
Stepper motor control with Arduino.