Home > Operation and Maintenance > Safety > How to achieve the transfer accuracy and in-depth analysis of 28BYJ-48 stepper motor

How to achieve the transfer accuracy and in-depth analysis of 28BYJ-48 stepper motor

WBOY
Release: 2023-05-26 11:53:37
forward
1359 people have browsed it

Yes, it has been transferred, but doesn’t it feel a little bit wrong? too slow? Don't worry, we'll keep going. According to the principle explained at the end of this chapter, in eight-beat mode, it takes 64 rhythms for the stepper motor to rotate once. In our program, each rhythm lasts 2ms, so one revolution should be 128ms, which is 1 second. There are more than 7 revolutions, but why does it look like it takes more than 7 seconds to complete one revolution?
So, it’s time to understand the concept of “acceleration” in the “permanent magnet acceleration stepper motor”. Figure 9-7 is a disassembly diagram of this 28BYJ-48 stepper motor. As you can see from the picture, the white pinion in the middle is the rotor input of the stepper motor. The 64 rhythms just make this pinion It rotates in a circle, and then it drives the large light blue gear. This is the first level of acceleration. Let’s take a look at the structure of the red gear on the upper right. Except for the motor rotor and the final input shaft, the three transmission gears may have such a structure, consisting of a layer of multiple teeth and a layer of small teeth, and each gear uses its own The small tooth layer of the next gear drives the multi-tooth layer of the next gear. In this way, every two gears form one level of acceleration, and there are 4 levels of acceleration in total. So what is the total acceleration ratio? That is, how many turns does it take for the rotor to turn before the input shaft turns once?

How to achieve the transfer accuracy and in-depth analysis of 28BYJ-48 stepper motor
Figure 9-7 Stepper motor external gear representation


Look back at the acceleration ratio parameter in the motor parameter table - 1:64 , the rotor rotates 64 times, and the input shaft will finally rotate once, that is, it takes 64*64=4096 rhythms for the input shaft to rotate once, 2ms*4096=8192ms, and it takes more than 8 seconds to rotate once. Is it the same as Are the results of the test just now consistent? 4096 rhythms rotate in one circle, so the angle of one rhythm rotation - the step angle is 360/4096. Take a look at the step angle parameter 5.625/64 in the table. If you do the math, you will know that these two values ​​​​are equal. Everything clicked.
The basic understanding of the principles should have been completed here. However, we hope that everyone can cultivate a way of thinking that "practice is the only criterion for testing the truth"! Recall, what is the biggest feature of stepper motors? Accurately grasp the migration volume! So should we test whether it is accurate? How accurate is it? How to practice? Turn it 90 degrees and measure it to see if it's forbidden? That's okay, but if it's only off by 1 degree or even less than 1 degree, can you accurately measure it? It's difficult without sophisticated instruments. Let's let it rotate a few more full circles to see if the position where it finally stopped is still not the original position. Correspondingly, we modify the program to facilitate the control of the motor turning any number of turns.

			#include <reg52.h> void TurnMotor(unsigned long angle); void main(){ TurnMotor(360*25); //360 度*25,即 25 圈 while (1); } /* 软件延时函数,延时约 2ms */ void delay(){ unsigned int i = 200; while (i--); } /* 步进电机迁移转变函数,angle-需转过的角度 */ void TurnMotor(unsigned long angle){ unsigned char tmp; //暂时变量 unsigned char index = 0; //节奏输入索引 unsigned long beats = 0; //所需节奏总数 //步进电机节奏对应的 IO 掌握代码 unsigned char code BeatCode[8] = { 0xE, 0xC, 0xD, 0x9, 0xB, 0x3, 0x7, 0x6 }; //盘算需求的节奏总数,4096 拍对应一圈 beats = (angle*4096) / 360; //判别 beats 不为 0 时履行轮回,然后自减 1 while (beats--){ tmp = P1; //用 tmp 把 P1 口以后值暂存 tmp = tmp & 0xF0; //用&操作清零低 4 位 tmp = tmp | BeatCode[index]; //用|操作把节奏代码写到低 4 位 P1 = tmp; //把低 4 位的节奏代码和高 4 位的原值送回 P1 index++; //节奏输入索引递增 index = index & 0x07; //用&操作完成到 8 归零 delay(); //延时 2ms,即 2ms 履行一拍 } P1 = P1 | 0x0F; //封闭电机一切的相 }
Copy after login

In the above program, we first wrote a function that controls the motor to rotate through a specified angle. This angle value is given by the method parameter of the function. Then in the main function, we can conveniently change the function when calling. Use the actual parameters to control the motor to rotate at any angle. We used 360*25, which is 25 circles. Of course, you can also change it to other values ​​to see what the consequences are. Our program will execute for 25*8=200 seconds. First note the initial position of the input shaft, then power on and wait patiently for it to complete. Take a look. Is there any error? What's going on? What's wrong? Isn't it possible to accurately control the transfer volume?
This problem actually comes from the acceleration ratio. Let’s take a look again. The acceleration ratio given by the manufacturer is 1:64. No matter which manufacturer produces the motor, as long as the model is 28BYJ-48, its nominal acceleration The ratio is 1:64. But what about in practice? Through our disassembly calculations, we found that the real and accurate acceleration ratio is not this value of 1:64, but 1:63.684! The method to obtain this data is also very complicated. Just count the number of teeth of each gear and then multiply the acceleration ratios at each level to get the result. The measured acceleration ratio is (32/9)*(22/ 11)*(26/9)*(31/10)≈63.684, thus the actual error is 0.0049, which is about 0.5%. If you turn 100 times, it will be half a turn. So we have just turned 25 times. Is it just one-eighth of a turn off, which is 45 degrees? Let's see if the error is 45 degrees. Then according to the actual acceleration ratio of 1:63.684, it can be concluded that the number of rhythms required to make one revolution is 64*63.684≈4076. Then change 4096 in the motor drive function in the program below to 4076 and try again. Can't you see the slightest error? But in fact, errors still exist, because the calculation results below are mostly approximate. The actual error is about 0.000056, which is 0.56 ten thousandths. It will only take 10,000 turns to make a difference of half a turn, so it can be ignored.

So why are there errors in the manufacturer's parameters? Don’t the manufacturers know? To explain this problem, we have to go back to practical use. The most common purpose of a stepper motor is to control the target to rotate through a certain angle, usually within 360 degrees. The final design goal of this 28BYJ-48 is to use To control the fan blades of the air conditioner, the movement range of the fan blades will not exceed 180 degrees, so in this use case, the manufacturer gives an approximate integer acceleration ratio of 1:64, which is accurate enough and reasonable. . However, just like our program, we do not necessarily need to use it to drive the air conditioning fan blades. We can let it rotate many times to do other things. At this time, more accurate data is needed, which is what we hope students will do. What everyone can understand and master, that is to say, we must be able to "design" the system ourselves and solve the problems found in it, and not be restricted by the so-called "ready-made plans".

The above is the detailed content of How to achieve the transfer accuracy and in-depth analysis of 28BYJ-48 stepper motor. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template