+21622886281
Arduino Stepper Motor

Control 28BYJ-48 stepper motor by Arduino and L293D

Purpose of this tutorial

To control the 28BYJ-48 stepper motor using an Arduino and L293D module shield, you can follow these steps:

  1. Connect the stepper motor to the L293D module shield. The motor has four wires, which should be connected to the module shield’s A+, A-, B+, and B- terminals, respectively. In the case of the 28BYJ-48 motor, the wiring sequence is usually as follows: red wire to A+, blue wire to A-, yellow wire to B+, and orange wire to B-.
  2. Connect the L293D module shield to the Arduino board. The module shield has a set of control pins that should be connected to the Arduino‘s digital output pins. The ENA and ENB pins should be connected to digital pins 3 and 9, respectively. The IN1, IN2, IN3, and IN4 pins should be connected to digital pins 4, 5, 6, and 7, respectively.
  3. Connect a power supply to the L293D module shield. The module shield requires a power supply with a voltage range of 4.5V to 36V. Connect the power supply’s positive and negative terminals to the module shield’s VM and GND terminals, respectively.
  4. Write a program to control the stepper motor using the Arduino board. You can use a stepper motor control library, such as the AccelStepper library or the Stepper library that comes with the Arduino IDE, to simplify the programming.

The necessary components

 Arduino UNO

Arduino Uno is an open-source microcontroller board based on the ATmega328P microcontroller chip. It is one of the most popular and widely used boards in the Arduino family. It has 14 digital input/output pins, 6 analog input pins, a 16 MHz quartz crystal, a USB connection, a power jack, and an ICSP header.

The digital input/output pins can be used to connect sensors, LEDs, motors, and other components that can be controlled using digital signals. The analog input pins can be used to read the values of analog sensors, such as temperature sensors, light sensors, and potentiometers.

The USB connection is used to program the board and to communicate with a computer. The power jack can be used to power the board using an external power supply, while the ICSP header can be used for in-circuit programming and debugging.

The Arduino Uno board is compatible with a wide range of sensors, shields, and modules, making it a versatile and flexible platform for building various electronic projects. The board can be programmed using the Arduino IDE, a free software development environment that supports a simplified version of the C++ programming language.

The Arduino Uno is a popular choice for hobbyists, students, and professionals who want to experiment with electronics and develop their own projects.

L293D Module

The L293D module shield is a motor driver board that can be used to control DC motors, stepper motors, and other motors using an Arduino or other microcontroller board. The board is based on the L293D motor driver IC, which can drive up to two DC motors or one stepper motor.

The L293D module shield has two H-bridge circuits, one for each DC motor, and can supply a voltage range of 4.5V to 36V DC, making it suitable for a wide range of motor applications. The board also has a built-in voltage regulator that can supply 5V or 3.3V to the connected microcontroller board.

The L293D module shield is easy to use and can be connected to the microcontroller board using just a few pins. The control pins can be connected to any available digital output pins of the microcontroller board, while the motor power supply can be connected to the board’s power input terminals.

The L293D module shield can be used for a variety of motor control applications, such as robotics, home automation, and industrial automation. The board is available in various form factors, including a breadboard-friendly version, making it easy to integrate into various projects.

Overall, the L293D module shield is a useful and cost-effective motor driver board that can be used to control different types of motors using an Arduino or other microcontroller board.

28BYJ-48 stepper motor

The 28BYJ-48 stepper motor is a small, low-cost, geared stepper motor that is commonly used in hobby projects and DIY electronics. It has a step angle of 5.625 degrees, which means that it takes 64 steps to complete a full rotation (360 degrees). The motor also has a gearbox that provides a 1/64 reduction ratio, which means that the output shaft rotates one revolution for every 64 steps taken by the motor.

The 28BYJ-48 stepper motor is a 4-phase motor, which means that it has four coils that are energized in a specific sequence to make the motor rotate. The motor has five wires, including four wires that are connected to the four coils (usually colored red, yellow, orange, and blue) and one common wire (usually colored white or black) that is connected to the motor’s ground.

To control the 28BYJ-48 stepper motor, you need to provide a sequence of signals to the motor’s coils in a specific order to make the motor rotate. This sequence is known as the stepping sequence, and there are several ways to generate it using an Arduino or other microcontroller. One common method is to use a stepper motor control library, such as the AccelStepper library or the Stepper library that comes with the Arduino IDE, which provides functions to generate the stepping sequence and control the motor’s speed and direction. Another method is to write your own code to generate the stepping sequence using digital output pins of the Arduino.

The 28BYJ-48 stepper motor is often used in small projects where precision and speed are not critical, such as robotics, automation, and motorized toys. It is also commonly used in projects that require low torque, since the gearbox provides additional mechanical advantage to the motor’s output shaft. However, if you need higher torque, speed, or precision, you may need to use a more powerful stepper motor with a higher step angle or a different type of motor altogether.

9V battery

A 9V battery is a type of alkaline or carbon-zinc battery that provides 9 volts of electrical power. It is commonly used to power small electronic devices, such as remote controls, smoke detectors, and small portable radios.

Connecting wires

Connecting wires are electrical wires that are used to connect different components in an electronic circuit. They are typically made of copper or aluminum and come in various gauges, lengths, and colors.

Assembly

1- We connect the L293D module to the Arduino UNO board

2- Connect the control pins of the 8BYJ-48 stepper motor (pin 1, 2, 3 and 4) to the two ports M3 and M4 of the L293D module

3- A 9V battery is used as a power source.

Arduino program

Here is the Arduino program that can control the 28BYJ-48 stepper motor by the Arduino UNO board and the L293D Shield module.

You have to import this library: AFMotor

 




0 commentaire


Leave a comment

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Scroll to Top