Stepper motor 28BYJ-48 introduction, drive and programming

Publisher:温馨的家庭Latest update time:2015-08-10 Source: 21ic Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

28BYJ-48 stepper motor:

[Reprint] Stepper Motor 28BYJ-48 Introduction, Drive and Programming

A stepper motor is an actuator that converts electrical pulses into angular displacement. In simple terms: when the stepper driver receives a pulse signal, it drives the stepper motor to rotate a fixed angle (and step angle) in the set direction. You can control the angular displacement by controlling the number of pulses to achieve accurate positioning; at the same time, you can control the speed and acceleration of the motor by controlling the pulse frequency to achieve speed regulation.

The stepper motor 28BYJ48 is a four-phase eight-beat motor with a voltage of DC5V-DC12V. When a series of continuous control pulses are applied to the stepper motor, it can rotate continuously. Each pulse signal corresponds to a change in the power-on state of one or two phases of the stepper motor winding, which corresponds to the rotor rotating a certain angle (a step angle). When the change in the power-on state completes a cycle, the rotor rotates one tooth pitch. The four-phase stepper motor can operate in different power-on modes. Common power-on modes include single (single-phase winding power-on) four beats (ABCDA...), double (two-phase winding power-on) four beats (AB-BC-CD-DA-AB-...), and eight beats (A-AB-B-BC-C-CD-D-DA-A...)

[Reprint] Stepper Motor 28BYJ-48 Introduction, Drive and Programming

The red wire is connected to the 5V power supply, the orange wire is connected to the P1.3 port, the yellow wire is connected to the P1.2 port, the pink wire is connected to the P1.1 port, and the blue wire is connected to the P1.0 port.

Since the signal from the microcontroller interface is not large enough, it needs to be amplified by ULN2003 and then connected to the corresponding motor interface, as follows:

[Reprint] Stepper Motor 28BYJ-48 Introduction, Drive and Programming
 

orange yellow pink blue Hexadecimal (P1 port)
1 0 0 0 0x08
1 1 0 0 0x0c
0 1 0 0 0x04
0 1 1 0 0x06
0 0 1 0 0x02
0 0 1 1 0x03
0 0 0 1 0x01
1 0 0 1 0x09

The order is exactly the opposite

So we can define the rotation phase sequence
uchar code CCW[8]={0x08,0x0c,0x04,0x06,0x02,0x03,0x01,0x09}; //Counter-clockwise rotation phase sequence table
uchar code CW[8]={0x09,0x01,0x03,0x02,0x06,0x04,0x0c,0x08}; //Forward-clockwise rotation phase sequence table

[Reprint] Stepper Motor 28BYJ-48 Introduction, Drive and Programming


C language code:

#include
#include
#define uchar unsigned char
#define uint unsigned int

uchar code CCW[8]={0x08,0x0c,0x04,0x06,0x02,0x03,0x01,0x09}; //Counter-clockwise rotation phase sequence table
uchar code CW[8]={0x09,0x01,0x03,0x02,0x06,0x04,0x0c,0x08}; //Forward-clockwise rotation phase sequence table


sbit K1=P3^2; //Reverse button
sbit K2=P3^3; //Forward button
sbit K3=P3^4; //Stop button
sbit FMQ=P3^6; // Buzzer


void delaynms(uint aa)
{
uchar bb;
while(aa--)
{
for(bb=0;bb<115;bb++) //1ms benchmark delay program
{
;
}
}

}

void delay500us(void)
{
int j;
for(j=0;j<57;j++)
{
;
}
}

void beep(void)
{
uchar t;
for(t=0;t<100;t++)
{
delay500us();
FMQ=!FMQ; //generate pulse
}
FMQ=1; //turn off the buzzer
}


void motor_ccw(void)
{
uchar i,j;
for(j=0;j<8;j++) //The motor rotates one circle, not the one you see from the outside, but the transmission wheel inside rotates one circle
{
if(K3==0)
{
break; //If K3 is pressed, exit this loop
}
for(i=0;i<8;i++) //Rotate 45 degrees
{
P1=CCW[i];
delaynms(10); //Adjust the speed
}
}
}


void motor_cw(void)
{
uchar i,j;
for(j=0;j<8;j++)
{
if(K3==0)
{
break; //If K3 is pressed, exit this loop
}
for(i=0;i<8;i++) //Rotate 45 degrees
{
P1=CW[i];
delaynms(2); //Adjust the speed
}
}
}



void main(void)
{
uchar r;
uchar N=64; //Because the stepper motor is a deceleration stepper motor, the deceleration ratio is 1/64 ,
//So when N=64, the stepper motor spindle rotates one
circlewhile(1)
{
if(K1==0)
{
beep();
for(r=0;r {
motor_ccw(); //Motor reversesif
(K3==0)
{
beep();
break;
}
}
}
else if(K2==0)
{
beep();
for(r=0;r {
motor_cw(); //Motor reversesif
(K3==0)
{
beep();
break;
}
}
}
else
P1=0xf0; //Motor stops
}


}

Appendix: Tips on stepper motors (reprinted)

1. What is a stepper motor?

A stepper motor is an actuator that converts electrical pulses into angular displacement. In simple terms: when the stepper driver receives a pulse signal, it drives the stepper motor to rotate a fixed angle (and step angle) in the set direction. You can control the angular displacement by controlling the number of pulses to achieve accurate positioning; at the same time, you can control the speed and acceleration of the motor by controlling the pulse frequency to achieve speed regulation.

2. What are the types of stepper motors?

There are three types of stepper motors: permanent magnet (PM), reactive (VR) and hybrid (HB).
Permanent magnet stepper motors are generally two-phase, with small torque and volume, and a step angle of 7.5 degrees or 15 degrees;
reactive stepper motors are generally three-phase, can achieve large torque output, and a step angle of 1.5 degrees, but the noise and vibration
are very large. They have been eliminated in developed countries such as Europe and the United States in the 1980s;
hybrid stepper motors refer to a combination of the advantages of permanent magnet and reactive. It is divided into two-phase and five-phase: the two-phase step
angle is generally 1.8 degrees and the five-phase step angle is generally 0.72 degrees. This type of stepper motor is the most widely used.

3.What is holding torque?

Holding torque refers to
the torque of the stator locking the rotor when the stepper motor is powered but not rotating. It is one of the most important parameters of the stepper motor. Usually, the torque of the stepper motor at low speed is close to
the holding torque. Since the output torque of the stepper motor decreases with the increase of speed, and the output power also
changes with the increase of speed, the holding torque has become one of the most important parameters for measuring stepper motors. For example,
when people say a stepper motor with a holding torque of 2N.m, it means
a stepper motor with a holding torque of 2N.m without special instructions.

4.What is DETENT TORQUE?

DETENT TORQUE refers to the torque of the stator locking the rotor when the stepper motor is not powered.
There is no unified translation method for DETENT TORQUE in China, which can easily lead to misunderstandings; since
the rotor of the reactive stepper motor is not made of permanent magnet material, it does not have DETENT TORQUE.

5.What is the accuracy of the stepper motor? Is it cumulative?

The accuracy of a general stepper motor is 3-5% of the step angle and is not cumulative.

6.What is the allowable surface temperature of the stepper motor?

If the temperature of the stepper motor is too high, the magnetic material of the motor will be demagnetized, which will cause the torque to drop or even lose steps.
Therefore, the maximum allowable temperature of the motor surface should depend on the demagnetization point of the magnetic material of the motor.
Generally speaking, the demagnetization point of the magnetic material is above 130 degrees Celsius, and some are even as high as 200 degrees Celsius
. Therefore, it is completely normal for the surface temperature of the stepper motor to be 80-90 degrees Celsius.

7.Why does the torque of a stepper motor decrease as the speed increases?

When the stepper motor rotates, the inductance of each phase winding of the motor will form a reverse electromotive force; the higher the frequency,
the greater the reverse electromotive force. Under its action, the motor phase current decreases as the frequency (or speed) increases, resulting in
a decrease in torque.

8.Why can the stepper motor run normally at low speed, but cannot start and makes a howling sound if it is higher than a certain speed?

The stepper motor has a technical parameter: no-load starting frequency, that is,
the pulse frequency at which the stepper motor can start normally under no-load conditions. If the pulse frequency is higher than this value, the motor cannot start normally and may lose steps or stall
. Under load conditions, the starting frequency should be lower. If the motor is to reach high-speed rotation, the pulse frequency
should have an acceleration process, that is, the starting frequency is low, and then it is increased to the desired high frequency at a certain acceleration (the motor
speed increases from low speed to high speed).

9. How to overcome the vibration and noise of the two-phase hybrid stepper motor when running at low speed?

The inherent disadvantages of stepper motors are that they produce large vibrations and noises when rotating at low speeds. Generally, the following solutions can be used to overcome them:

A. If the stepper motor happens to work in the resonance zone, the resonance zone can be avoided by changing the reduction ratio and other mechanical transmission methods;
B. Use a driver with subdivision function, which is the most commonly used and simplest method;
C. Replace with a stepper motor with a smaller step angle, such as a three-phase or five-phase stepper motor;
D. Replace with an AC servo motor, which can almost completely overcome vibration and noise, but the cost is higher;
E. Add a magnetic damper to the motor shaft. This product is already available on the market, but the mechanical structure changes significantly.

10. Can the number of subdivisions of a subdivision driver represent accuracy?

The subdivision technology of stepper motor is essentially an electronic damping technology (please refer to relevant literature). Its main purpose
is to reduce or eliminate the low-frequency vibration of stepper motor. Improving the running accuracy of motor is only a
subsidiary function of subdivision technology. For example, for a two-phase hybrid stepper motor with a step angle of 1.8°, if the
subdivision number of the subdivision driver is set to 4, the running resolution of the motor is 0.45° per pulse. Whether the accuracy of the motor can reach
or approach 0.45° also depends on other factors such as the subdivision current control accuracy of the subdivision driver. The accuracy of subdivision drivers from different manufacturers
may vary greatly; the larger the subdivision number, the more difficult it is to control the accuracy.

11.What is the difference between the series connection and the parallel connection between the four-phase hybrid stepper motor and the driver?

Four-phase hybrid stepper motors are generally driven by two-phase drivers. Therefore, when connecting,
the four-phase motor can be connected in series or in parallel to form two phases. The series connection is generally used in situations where the motor speed is relatively high.
At this time, the required driver output current is 0.7 times the motor phase current, so the motor heats up less; the parallel connection
is generally used in situations where the motor speed is relatively high (also known as high-speed connection), and the required driver output current is
1.4 times the motor phase current, so the motor heats up more.

12. How to determine the DC power supply for the stepper motor driver?

A. Determination of voltage

The power supply voltage of the hybrid stepper motor driver is generally in a wide range (for example,
the power supply voltage of IM483 is 12~48VDC). The power supply voltage is usually
selected according to the motor's operating speed and response requirements. If the motor's operating speed is high or the response requirement is fast, the voltage value is also high, but
note that the ripple of the power supply voltage cannot exceed the maximum input voltage of the driver, otherwise the driver may be damaged.

B. Determination of current

The power supply current is generally determined by the output phase current I of the driver. If a linear power supply is used,
the power supply current can generally be 1.1 to 1.3 times of I; if a switching power supply is used, the power supply current can generally
be 1.5 to 2.0 times of I.

13. Under what circumstances is the offline signal FREE of the hybrid stepper motor driver generally used?

When the offline signal FREE is low, the current output from the driver to the motor is cut off, and the motor rotor is in
a free state (offline state). In some automation equipment, if
the motor shaft is required to be rotated directly without powering off the driver (manual mode), the FREE signal can be set low to make the motor offline for manual
operation or adjustment. After the manual operation is completed, the FREE signal is set high to continue automatic control.

14. How to use a simple method to adjust the rotation direction of a two-phase stepper motor after it is powered on?

Just swap the A+ and A- (or B+ and B-) of the motor and driver wiring.

Reference address:Stepper motor 28BYJ-48 introduction, drive and programming

Previous article:C language program for I2C communication
Next article:Introduction to FranklinC51, a high-level programming language for single-chip microcomputers

Recommended ReadingLatest update time:2024-11-16 13:31

Driver design of nRF24L01 under ARM and WinCE6.0
introduction nRF24L01 is a single-chip wireless transceiver chip that works in the 2.4-2.5 GHz universal ISM frequency band. It is used in wireless data communications, wireless access control, remote sensing, industrial sensors and toys. With the development of measurement and control technology, there ar
[Microcontroller]
Driver design of nRF24L01 under ARM and WinCE6.0
Driver of Universal Data Acquisition Card Based on LabVIEW
This paper introduces a method of calling a dynamic link library (DLL) through the Call Library Function Node provided by LabVIEW, completing the driver of a universal data acquisition card and realizing the combination of LabVIEW and a universal data acquisition card. Baoding 071003, China) There are three ways to
[Test Measurement]
Driver of Universal Data Acquisition Card Based on LabVIEW
EPC Launches 400 W Motor Drive Demonstration Board Based on GaN Integrated Power Stage
EPC launches 400 W motor drive demonstration board based on GaN integrated power stage Demonstrates how to achieve more efficient, quieter and smaller motors The EPC9146 demo board showcases how the EPC2152 ePower™ power stage enables high-performance and low-cost BLDC motors, enabling solution
[Power Management]
EPC Launches 400 W Motor Drive Demonstration Board Based on GaN Integrated Power Stage
A 24V DC motor driver design
  There are many traditional DC motor speed control methods, such as voltage regulation, weak magnetic field speed control, etc., which have the disadvantages of slow speed control response, poor accuracy, and complex speed control devices. With the development of fully controlled power electronic device technology,
[Microcontroller]
A 24V DC motor driver design
Feature-rich LED driver ICs for high-power automotive LEDs
 Background Information The market for high brightness (HB) LEDs is expected to reach $20.2 billion by 2015 (Source: Strategies Unlimited). One of the key application areas driving this growth is LEDs used in automotive designs. Applications include headlights, daytime running and brake lights, instrument panel back
[Power Management]
Feature-rich LED driver ICs for high-power automotive LEDs
Molex Announces KickStart Connector System, the First All-in-One OCP-Compliant Boot Driver Connection Solution
Molex announces KickStart Connector System, the first all-in-one OCP- compliant boot drive connectivity solution with integrated power and signal circuitry A single, standardized cable assembly provides a common hardware solution that co
[Industrial Control]
Design Example of Motor Driving AUIR3330S in Automotive Applications
In automobiles , water pumps, oil pumps, and power steering pumps are still driven directly by the engine. Using motors to drive these loads can greatly simplify mechanical design, eliminating the need for belts and pulleys, while saving space in the engine compartment. AUIR3330S provides a solution that can drive any
[Power Management]
Design Example of Motor Driving AUIR3330S in Automotive Applications
Independently innovated adaptive constant current driver for mains LED lighting
Seeking innovation and change to promote independent research and development The author entered the field of large-scale LED products many years ago and witnessed the gradual improvement of quality of LED lighting devices, from low-quality and high-price products to high- brightness and ultra
[Power Management]
Independently innovated adaptive constant current driver for mains LED lighting
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号