Stepping motor speed adjustment control algorithm based on photoelectric encoder

文档序号:833088 发布日期:2021-03-30 浏览:30次 中文

阅读说明:本技术 一种基于光电编码器的步进电机速度调整控制算法 (Stepping motor speed adjustment control algorithm based on photoelectric encoder ) 是由 顾晗 于 2020-12-04 设计创作,主要内容包括:本发明公开了一种基于光电编码器的步进电机速度调整控制算法,包括选取光电编码器,并已知光电编码盘的孔数为M;设定速度等级数S,并从中选取需要调控的当前速度V,建立当前速度V与光电编码盘的孔数M的关系:若孔数除以当前速度能够整除,则每过A个孔光电编码盘发脉冲驱动一次电机;不能整除,存在余数B,则每过A个孔光电编码盘发脉冲驱动电机的次数为V-B次,每过A+1个孔光电编码盘发脉冲驱动电机的次数为B次,且经过A个孔和经过A+1个孔光电编码盘发脉冲的频率均匀交替执行。本发明实现步进电机的输出速度从最高到最低等间距分割,而且调速范围更宽更灵活。(The invention discloses a stepping motor speed adjustment control algorithm based on a photoelectric encoder, which comprises the steps of selecting the photoelectric encoder, wherein the number of holes of a photoelectric encoding disc is known as M; setting a speed grade number S, selecting a current speed V to be regulated and controlled from the speed grade number S, and establishing a relation between the current speed V and the hole number M of the photoelectric coding disc: if the number of holes can be divided by the current speed, the photoelectric coding disc sends a pulse to drive the motor once every A holes; and if the result is B, the number of times of pulse-emitting driving of the motor by the photoelectric coding disc passing through the hole A is V-B times, the number of times of pulse-emitting driving of the motor by the photoelectric coding disc passing through the hole A +1 is B times, and the pulse-emitting frequency of the photoelectric coding disc passing through the hole A +1 are uniformly and alternately executed. The invention realizes the equal-interval division of the output speed of the stepping motor from the highest to the lowest, and the speed regulation range is wider and more flexible.)

1. A stepping motor speed adjustment control algorithm based on a photoelectric encoder is characterized by comprising the following steps:

the method comprises the following steps: selecting a photoelectric encoder, wherein the number of holes of a photoelectric encoding disc is known as M;

step two: setting a speed grade number S, selecting a current speed V to be regulated and controlled from the speed grade number S, and establishing a relation between the current speed V and the hole number M of the photoelectric coding disc:

(a) the method comprises the following steps If it isWhen the photoelectric coding disc can be completely removed, the photoelectric coding disc sends pulse to drive the motor once every A holes;

(b) the method comprises the following steps If it isThe number of times of pulse-emitting driving motor of photoelectric coding disc passing through A holes is V-B times, the number of times of pulse-emitting driving motor of photoelectric coding disc passing through A +1 holes is B times, and the photoelectric coding disc passes through A holes and passes through B holesThe frequency of the A +1 hole photoelectric coding disk pulse is uniformly and alternately executed.

2. The algorithm for controlling the speed adjustment of the stepping motor based on the photoelectric encoder as claimed in claim 1, wherein the number M of the holes of the photoelectric encoder disk is 400,600 or 800.

3. The algorithm for controlling the speed adjustment of the stepping motor based on the photoelectric encoder as claimed in claim X, wherein the number M of holes of the photoelectric encoder disk and the number S of speed steps have the following relationship:

Technical Field

The invention relates to the technical field of industrial control, in particular to a stepping motor speed adjustment control algorithm based on a photoelectric encoder.

Background

In many industrial control and smart home fields, the application of driving an external execution device by a stepping motor is increasingly widespread. And many scenarios adjust the operating speed of the motor in a closed loop by means of external sensors. The photoelectric encoder sensor is a closed-loop speed regulation sensor which is widely applied in the industry at present. The motor driving device is low in cost and simple in control method, only one MCU is needed to control the motor driving device, the basic principle is as shown in figure 1, a rising edge pulse or a falling edge pulse is generated by an opening on an optoelectronic code disc through an optical coupler, and the pulse is used as a signal to be input to the MCU for subsequent execution judgment.

An algorithm for controlling a stepping motor by using an existing photoelectric encoder sensor is shown in fig. 2, the photoelectric encoder is virtually unfolded according to a straight line, the number of small holes is N, the M (M & ltN) small hole with the lowest speed grade drives a stepping motor in a pulse mode, the M-1 small holes drive the stepping motor in a pulse mode sequentially, the maximum number of the small holes is 1, the pulse mode drives the stepping motor, and the speed subdivision grade is M. Although the method can subdivide the grades of the driving stepping motor by using the number of the small holes of the photoelectric code disc, the span of the stepping motor between each grade is not uniform, namely is not equally divided.

Therefore, how to provide a stepping motor speed adjustment control algorithm based on a photoelectric encoder is an urgent problem to be solved by those skilled in the art.

Disclosure of Invention

In view of the above, the invention provides a speed adjustment control algorithm for a stepping motor based on a photoelectric encoder, which solves the problem of uneven span of speed output results realized by the current speed adjustment level of the control algorithm.

In order to achieve the purpose, the invention adopts the following technical scheme:

a stepping motor speed adjustment control algorithm based on a photoelectric encoder comprises the following steps:

the method comprises the following steps: selecting a photoelectric encoder, wherein the number of holes of a photoelectric encoding disc is known as M;

step two: setting a speed grade number S, selecting a current speed V to be regulated and controlled from the speed grade number S, and establishing a relation between the current speed V and the hole number M of the photoelectric coding disc:

(c) the method comprises the following steps If it isWhen the photoelectric coding disc can be completely removed, the photoelectric coding disc sends pulse to drive the motor once every A holes;

(d) the method comprises the following steps If it isNot divided exactly, if there is a remainder B, everyThe number of times of pulse-emitting driving of the motor by the photoelectric coding disc passing through the hole A is V-B, the number of times of pulse-emitting driving of the motor by the photoelectric coding disc passing through the hole A +1 is B, and the pulse-emitting frequency of the photoelectric coding disc passing through the hole A +1 are uniformly and alternately executed.

Preferably, the number of holes of the photoelectric coded disc is 400,600 or 800.

Preferably, the number M of holes of the photoelectric coded disk and the number S of speed grades have the following relationship:

compared with the prior art, the speed regulation control algorithm of the stepping motor based on the photoelectric encoder disclosed by the invention has the advantages that the output speed of the stepping motor is divided at equal intervals from the highest to the lowest, and the speed regulation range is wider and more flexible.

Drawings

In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.

FIG. 1 is a schematic diagram of a photoelectric encoder sensor control stepping motor.

FIG. 2 is a schematic diagram of an algorithm of a stepping motor controlled by a photoelectric encoder sensor in the prior art.

FIG. 3 is a schematic diagram of an algorithm of a photoelectric encoder sensor control stepping motor.

Detailed Description

The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

The embodiment of the invention discloses a stepping motor speed adjustment control algorithm based on a photoelectric encoder, which comprises the following steps as shown in figure 3:

step 1: selecting a photoelectric encoder, and knowing the number M of holes of the photoelectric encoding disk, wherein M is 400,600 or 800;

step 2: the number of speed steps S is set, wherein,setting a current selected speed V from the speed grades, and establishing a relation between the current speed V and the hole number M of the photoelectric encoding disk:

(a) the method comprises the following steps If it isWhen the photoelectric coding disc can be completely removed, the photoelectric coding disc sends pulse to drive the motor once every A holes;

(b) the method comprises the following steps If it isAnd if the result is B, the number of times of pulse-emitting driving of the motor by the photoelectric coding disc passing through the hole A is V-B times, the number of times of pulse-emitting driving of the motor by the photoelectric coding disc passing through the hole A +1 is B times, and the pulse-emitting frequency of the photoelectric coding disc passing through the hole A +1 are uniformly and alternately executed. For example, after the pulse frequency of the A hole passes through C times, the A +1 hole photoelectric coding disc is used for pulse once again, and the steps are repeated, so that the pulse frequency of the A hole and the pulse frequency of the A +1 hole photoelectric coding disc are uniformly alternated.

According to the method, S-1, S-2, 1 pulse is sequentially sent out according to the set speed grade in the number of the holes of the photoelectric code disc, the output speed of the stepping motor is divided at equal intervals from the highest to the lowest, and the problem that in the prior art, the span of the stepping motor is not uniform because the stepping pulse is sent out through every S, S-1.

The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.

The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

6页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:具有制动负载保护功能的供电故障快速隔离与保护装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!