To control the 28BYJ-48 stepper motor using an Arduino and L293D module shield, you can follow these steps:
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.
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.
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
#include <AFMotor.h> // Number of steps per output rotation // Change this as per your motor's specification const int stepsPerRevolution = 48; // connect motor to port #2 (M3 and M4) AF_Stepper motor(stepsPerRevolution, 2); void setup() { Serial.begin(9600); Serial.println("Stepper test!"); motor.setSpeed(255); // 10 rpm } void loop() { Serial.println("Single coil steps"); motor.step(100, FORWARD, SINGLE); /*motor.step(100, BACKWARD, SINGLE); Serial.println("Double coil steps"); motor.step(100, FORWARD, DOUBLE); motor.step(100, BACKWARD, DOUBLE); Serial.println("Interleave coil steps"); motor.step(100, FORWARD, INTERLEAVE); motor.step(100, BACKWARD, INTERLEAVE); Serial.println("Micrsostep steps"); motor.step(100, FORWARD, MICROSTEP); motor.step(100, BACKWARD, MICROSTEP); */ } |