top of page

Interfacing Stepper Motor with Arduino

Updated: Apr 1

The Stepper Motor is an electromechanically controlled device that converts electrical power into mechanical power, mostly stepper motor is used for controlled stepping with accurate speed control and also with a change in the direction.


In this article, let us learn about how to #interface a stepper motor with Arduino along with its circuit diagram and coding part.


Hardware Requirements:


1. Breadboard


Breadboard
Breadboard

A breadboard is a rectangular board with small holes in it that are used for connecting elements. The connections are not fixed and can be varied. In a breadboard, the holes in one horizontal line are in series connection with each other. Breadboards are made from plastic and come in all shapes, sizes, and even different colors, the most commonly used sizes for circuit connections are "full-size," "half-size," and "mini" breadboards.


Buy Breadboard from here.


2. Arduino UNO R3


Arduino UNO_R3
Arduino UNO_R3

Arduino #UNO R3 is the most commonly used and latest version among the Arduino board. Arduino Board can address inputs such as light on a sensor, Twitter information, a finger on a button, and turn it to an output such as initiating a motor, turning on an LED, advertising something online. All of this can be done by transferring a set of instructions to the microcontroller on the board by the use of the Arduino programming language.


Buy Arduino UNO R3 from here.


3. 28BYJ48 - Stepper Motor

28BYJ48 Stepper Motor
28BYJ48 Stepper Motor

28-BYJ48 type is the most frequently used stepper #motor. The application of this stepper motor includes a 3D printer, Surveillance camera, DVD drivers, etc. The stepper motor consists of 5-leads in which 4-unipolar coil leads and one supply lead (5V). On working stepper motor consumes higher current and hence it is mandatory to connect a driver IC like #ULN2003 to it.


Buy 28BYJ48 Stepper Motor from here.


4. ULN2003A - Driver Board

ULN2003A - Driver Circuit
ULN2003A - Driver Circuit

ULN2003A Driver has a 16 pin Integrated Circuit. It has seven Darlington pairs in which each pair is capable of driving the output load up to 500mA, 50V. The Driver Circuit consists of 7-input and 7-output pins and 1-common and 1-ground pin.



5. MB102 Power Supply Module

MB102 Power Supply Module
MB102 Power Supply Module

MB102 #Power Supply Module is the most useful breadboard component to supply the operating voltage of 3.3V / 5V. It accepts 6.5-12V as an input voltage and produces an independent channel of output voltage that has 3.3V or 5V with a maximum output current of 700mA. It has 5-pins, those are left jumper, right jumper, 4-Berg header for Ground, and 2-Berg Header for 3.3/5V.



6. 9V Battery

9V Battery
9V Battery

This is the main component to provide power to the #stepper motor.


Buy 9V Battery from here.


7. Connecting Wires

These are the main components that are used to establish the connections between different devices of the circuit.


Connecting Wires
Connecting Wires

Buy Connecting Wires from here.


8. USB Cable

This cable is used to connect the Arduino to the computer/ laptop to upload the program. It also helps in the transmission of data.



USB Cable
USB Cable

Buy USB Cable from here.


Software Requirements:


1. Arduino IDE

Arduino IDE (Integrated Development Platform) which is used to interface the boards like #NodeMCU to run the desired code designed to interface hardware devices.



Arduino IDE LOGO
Arduino IDE LOGO

Circuit Connection:

Let us see how to interface #Arduino UNO- R3 with a 28-BYJ48 type stepper motor.



The 5-pins connector of the 28-BYJ48 type stepper motor is connected to the ULN2003A Driver board connector. The IN1, IN2, IN3, IN4 pins of the #ULN2003A Driver board are connected to the Arduino digital pins 8,9,10, and 11 respectively. There is an external power supply used because Arduino alone cannot handle the stepper motor. Then the power terminal (Vcc) of the Driver board is connected to the positive terminal of the breadboard which is further connected to the positive pin of the power supply module.


Similarly, connect the ground pin of the driver board to the negative terminal of the breadboard in which the negative pin of the power supply module is connected. Next, connect the Ground pin of the Arduino to the negative terminal of the breadboard to establish a common ground connection.


Code-



Working:

The Working of the Stepper Motor involves simple steps. The below image shows the picture of the circuit when the code is not applied.


Image Before insertion of value
Image Before insertion of Value

On uploading the program to the Arduino board by using a #USB cable. Open the Serial Monitor, and enter the number of steps the stepper motor is to be rotated. To make a half revolution enter 1024 for the clockwise direction and -1024 for the anticlockwise direction.


The below image shows the stepper motor rotation in an anticlockwise direction when the number of steps is entered has -512.

Image After Insertion of Value
Image After Insertion of Value

Video explanation with the practical implementation, for a more beneficial perception.


Video By - Anupama Koley

This article covers the basic interfacing of stepper motor with Arduino. With this essential concept, one can build many other projects as stepper motor finds numerous applications 3D printing, tape drives, floppy disc drives, printers, and electric watches, etc.


 

See Also:

Related Posts

See All
bottom of page