Method for fine code phase adjustment

文档序号:166645 发布日期:2021-10-29 浏览:55次 中文

阅读说明:本技术 精码相位调整的方法 (Method for fine code phase adjustment ) 是由 韩庆阳 于 2021-08-16 设计创作,主要内容包括:本发明涉及一种精码相位调整方法,具体为:使待采集的正弦路精码信号和余弦路精码信号的幅值相等;正向旋转光电编码器采集正弦路精码信号和余弦路精码信号,并获得粗码值;根据预设条件判断,以正弦路精码信号或余弦路精码信号作为基准信号,求得不产生偏差情况下的相位和实际采集相位间的相位差;根据相位差通过计算获得相位值后通过查细分表得精码细分值;将精码细分值和获得的粗码值进行粗精结合后,获得光电编码器的二进制角度值并输出。本发明公开的精码相位调整方法采用直接通过计算得到的相位差可量化,精度高数据可靠。且采用计算相位差的方式替代传统手动调整,在工作时仅需操作软件界面无需动手,大幅度提高调试效率。(The invention relates to a fine code phase adjustment method, which specifically comprises the following steps: the amplitudes of sine-path precise code signals to be collected and cosine-path precise code signals to be collected are equal; the method comprises the steps that a forward rotary photoelectric encoder collects sine-path precise code signals and cosine-path precise code signals and obtains coarse code values; judging according to preset conditions, and taking the sine-path precise code signal or the cosine-path precise code signal as a reference signal to obtain the phase difference between the phase and the actually acquired phase under the condition of no deviation; obtaining a fine code detail value by looking up a detail table after a phase value is obtained by calculation according to the phase difference; and after the fine code fineness value and the obtained coarse code value are combined coarsely and finely, a binary angle value of the photoelectric encoder is obtained and output. The fine code phase adjustment method disclosed by the invention has the advantages that the phase difference obtained by direct calculation can be quantized, the precision is high, and the data is reliable. And the traditional manual adjustment is replaced by a mode of calculating the phase difference, and the operation is only needed to operate a software interface during working without manual operation, so that the debugging efficiency is greatly improved.)

1. A fine code phase adjustment method is characterized by comprising the following steps:

s1, adjusting the resistance value of a digital potentiometer in the fine code phase adjustment system of the photoelectric encoder to enable the amplitudes of the sine-path fine code signal and the cosine-path fine code signal to be acquired to be equal;

s2, rotating the photoelectric encoder forward for a circle, acquiring the sine-path precise code signal and the cosine-path precise code signal through the precise code phase adjustment system of the photoelectric encoder, shaping the sine-path precise code signal or the cosine-path precise code signal into square waves, counting, and obtaining a coarse code value corresponding to the coarse code signal according to a counting result;

s3, judging the sine-path precise code signal and the cosine-path precise code signal according to preset conditions, taking one of the sine-path precise code signal and the cosine-path precise code signal as a reference signal, and subtracting the phase of the reference signal by 90 degrees from the phase of the other signal without deviation to obtain a phase difference;

Δθ=θ-θ' (1)

wherein, theta is the phase of the acquired signal, theta' is the phase under the condition of no deviation, and delta theta is the phase difference;

s4, obtaining the phase value theta of the fine code signal of the phase value after phase deviation correction through calculation according to the phase difference delta thetaΔObtaining fine code fine values by looking up a fine table after phase values are obtained;

and S5, after the fine code fineness value and the obtained coarse code value are combined coarsely and finely, obtaining a binary phase value of the photoelectric encoder and outputting the binary phase value.

2. The fine code phase adjustment method according to claim 1, wherein in step S3, the predetermined condition is that the phase of the cosine-way fine code signal is compared with the phase of the sine-way fine code signal, and a lagging or leading signal is determined as the reference signal.

3. The fine code phase adjustment method according to claim 2, wherein the predetermined condition in step S3 is whether the phase of the cosine-way fine code signal is ahead of the phase of the sine-way fine code signal;

if so, selecting the sine path precise code signal as a reference signal, adding 90 degrees to the phase of the sine path precise code signal, and then making a difference with the phase of the cosine path precise code signal to obtain a phase difference delta theta, wherein the delta theta meets the formula (2):

Δθ=arccos(A·cosθcosθ'+A·sinθsinθ') (2)

if not, selecting the cosine way fine code signal as a reference signal, adding 90 degrees to the phase of the cosine way fine code signal, and then making a difference with the phase of the sine way fine code signal to obtain a phase difference delta theta, wherein the delta theta meets a formula (3):

Δθ=arcsin(A·sinθcosθ'-A·cosθsinθ') (3)

wherein A.sin theta is the acquired sine-way fine code signal; a · cos theta is the collected cosine way fine code signal; a · cos theta' is the cosine way fine code signal under the condition of no deviation; and A.sin theta' does not generate the sine fine code signal under the condition of deviation.

4. The fine code phase adjustment method according to claim 3, wherein the formula (4) for calculating the phase value of the fine code signal after phase deviation correction according to the collected cosine-loop fine code signal in step S4 is:

in step S4, the formula (5) for calculating the phase value of the fine code signal after phase offset correction according to the acquired sinusoidal fine code signal is:

and A is the amplitude of the sine-path precise code signal and the cosine-path precise code signal.

Technical Field

The invention relates to the technical field of photoelectric encoders, in particular to a fine code phase adjustment method.

Background

The photoelectric encoder is also called photoelectric angular position sensor, and is a digital angle measuring device integrating light, machine and electricity into one body. The sensor realizes displacement-digital conversion by utilizing a grating diffraction principle and converts mechanical geometric displacement on an output shaft into pulse digital quantity through photoelectric conversion. The device has the advantages of small volume, high precision, reliable work, digital interface and the like. The angle detection device is widely applied to devices and equipment needing angle detection, such as numerical control machines, rotary tables, servo transmission, robots, radars, military target measurement and the like. From the principle of measurement, the spectral photoelectric encoder can be divided into: pictorial and moire patterns; the Moire fringe type photoelectric encoder has the advantages of fast frequency response, stable and reliable work, high precision and the like, and occupies a major position in the market share of the current photoelectric encoder.

The moire fringe type photoelectric encoder usually adopts discrete components of a light emitting photodiode and a receiving photodiode as a light source and a detector, and because the light emitted by the light emitting diode has a divergence angle and the like, the welding position of the light emitting diode or the receiving diode needs to be adjusted to meet the requirement of moire fringes, namely, the phase difference between sine and cosine precise codes is 90 degrees. The main adjustment means at present are manual adjustment, namely: the phase lissajous pattern is synthesized by fine coding using an observation device such as an oscilloscope. This approach is inefficient and unable to quantify phase synthesis with low accuracy.

Disclosure of Invention

The invention overcomes the defects of the prior art and provides a fine code phase adjustment method.

A fine code phase adjusting method comprises the following steps:

s1, adjusting the resistance value of the digital potentiometer in the fine code phase adjustment system of the photoelectric encoder to enable the amplitudes of the sine-path fine code signal and the cosine-path fine code signal to be acquired to be equal.

S2, rotating the photoelectric encoder forward for a circle, collecting the sine-path precise code signal and the cosine-path precise code signal through the photoelectric encoder precise code phase adjustment system, shaping the sine-path precise code signal or the cosine-path precise code signal into square waves, counting, and obtaining a coarse code value corresponding to the coarse code signal according to a counting result.

And S3, judging the sine-path precise code signal and the cosine-path precise code signal according to preset conditions, taking one of the sine-path precise code signal and the cosine-path precise code signal as a reference signal, and subtracting the phase of the reference signal after adding 90 degrees from the phase of the other signal without deviation to obtain a phase difference.

Δθ=θ-θ' (1)

Where θ is the phase of the acquired signal, θ' is the phase without any deviation, and Δ θ is the phase difference.

S4, obtaining the phase value theta of the fine code signal of the phase value after phase deviation correction through calculation according to the phase difference delta thetaΔ' obtaining the phase value and then obtaining the fine code fine value by looking up the fine table.

And S5, after the fine code fineness value and the obtained coarse code value are combined coarsely and finely, obtaining a binary phase value of the photoelectric encoder and outputting the binary phase value.

Further, in step S3, the preset condition is that the phase of the cosine-way fine code signal is compared with the phase of the sine-way fine code signal, and a lagging or leading signal is determined as the reference signal.

Further, the preset condition in step S3 is whether the phase of the cosine-way fine code signal is ahead of the phase of the sine-way fine code signal;

if so, selecting the sine path precise code signal as a reference signal, adding 90 degrees to the phase of the sine path precise code signal, and then making a difference with the phase of the cosine path precise code signal to obtain a phase difference delta theta, wherein the delta theta meets the formula (2):

Δθ=arccos(A·cosθcosθ'+A·sinθsinθ') (2)

if not, selecting the cosine way fine code signal as a reference signal, adding 90 degrees to the phase of the cosine way fine code signal, and then making a difference with the phase of the sine way fine code signal to obtain a phase difference delta theta, wherein the delta theta meets a formula (3):

Δθ=arcsin(A·sinθcosθ'-A·cosθsinθ') (3)

wherein A.sin theta is the acquired sine-way fine code signal; a · cos theta is the collected cosine way fine code signal; a · cos theta' is the cosine way fine code signal under the condition of no deviation; and A.sin theta' does not generate the sine fine code signal under the condition of deviation.

Further, in step S4, the formula (4) for calculating the phase value of the fine code signal after phase offset correction according to the collected cosine-way fine code signal is:

in step S4, the formula (5) for calculating the phase value of the fine code signal after phase offset correction according to the acquired sinusoidal fine code signal is:

and A is the amplitude of the sine-path precise code signal and the cosine-path precise code signal.

Compared with the prior art, the invention has the beneficial effects that:

1. the phase adjustment method provided by the invention adopts a mode of calculating the phase difference to replace the traditional manual adjustment, only a software interface needs to be operated during working without manual operation, and the debugging efficiency is greatly improved;

2. the phase adjusting method provided by the invention adopts the phase difference obtained by direct calculation to be quantifiable, and is more reliable than the high-precision data of a Lissajous figure viewed by an oscilloscope;

3. the precise code phase adjustment system of the photoelectric encoder provided by the invention adopts the digital potentiometer, so that the constant amplitude precision of sine and cosine precise code signals and the reliability and environmental adaptability of the precise code phase adjustment system of the photoelectric encoder can be improved.

Drawings

FIG. 1 is a schematic structural diagram of a fine code phase adjustment system of an optical-electrical encoder according to an embodiment of the present invention;

FIG. 2 is a first flowchart of a phase adjustment method according to an embodiment of the invention;

FIG. 3 is a second flow chart of a method of phase adjustment according to an embodiment of the present invention;

FIG. 4 is a schematic diagram of fine code phase difference of the optical-electrical encoder according to the embodiment of the present invention.

Detailed Description

The embodiments of the present invention will be described in further detail with reference to the drawings and examples. It should be noted that the embodiments and features of the embodiments may be combined with each other without conflict. 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.

Fig. 1 shows a schematic structural diagram of a fine code phase adjustment system of an optical-electrical encoder in an embodiment of the present invention, fig. 2 shows a first flow diagram of a fine code phase adjustment method in an embodiment of the present invention, and fig. 3 shows a second flow diagram of the fine code phase adjustment method in an embodiment of the present invention. The embodiment of the invention uses a precise code phase adjustment system of a photoelectric encoder to be matched with a precise code phase adjustment method.

The fine code phase adjustment system of the photoelectric encoder in the embodiment comprises: in the embodiment of the invention, when a photoelectric encoder rotates, the photoelectric receiving tube receives moire fringes and converts an optical signal into a current signal, the current signal is collected by the digital potentiometer and then converted into a voltage signal, the voltage signal is amplified by the amplifying circuit and then transmitted to the AD conversion chip for analog-to-digital conversion, and the voltage signal after digital-to-analog conversion is transmitted to the upper computer through a serial port for data processing.

The upper computer carries out phase judgment on the received voltage signals and calculates the phase difference, and the upper computer judges whether the collected sine and cosine way precise code signals are correct according to the following steps: the phase of the cosine-path fine code signal should be ahead or behind the phase of the sine-path fine code signal in forward rotation. Transmitting the phase difference to a micro control chip through a UART serial port, and calculating by the micro control chip according to the received phase difference to obtain a fine code detail value after phase adjustment; shaping a positive square wave signal according to a fine code signal to obtain a coarse code value corresponding to the coarse code signal; and combining the coarse code value and the fine code value after phase adjustment by the micro-control chip to obtain a binary phase value and outputting the binary phase value.

The optical signal of the photoelectric encoder is divided into a fine code signal and a coarse code signal. The fine code signal is divided into sine-path fine code signal and cosine-path fine code signal.

The present invention further provides a fine code phase adjustment method, as shown in fig. 2, including the following steps:

s1, adjusting the resistance value of the digital potentiometer in the fine code phase adjustment system of the photoelectric encoder to enable the amplitudes of the sine-path fine code signal and the cosine-path fine code signal to be acquired to be equal.

In the tangent subdivision operation, the sine-path precise code signal and the cosine-path precise code signal are theoretically required to be two paths of equal amplitudes and have a phase difference of 90 degrees, but actually, because light emitted by the light emitting diode has a divergence angle and is non-parallel light, the phase difference between the sine-path precise code signal and the cosine-path precise code signal is not 90 degrees, and therefore, the angle of deviation needs to be calculated for processing.

S2, rotating the photoelectric encoder forward for a circle, collecting the sine-path precise code signal and the cosine-path precise code signal through the photoelectric encoder precise code phase adjustment system, shaping the sine-path precise code signal and the cosine-path precise code signal into square waves, counting, and obtaining a coarse code value corresponding to the coarse code signal according to a counting result.

S3, judging the sine-path precise code signal and the cosine-path precise code signal according to preset conditions, taking one of the sine-path precise code signal and the cosine-path precise code signal as a reference signal, and subtracting the phase of the reference signal by 90 degrees from the phase of the other signal without deviation to obtain a phase difference;

Δθ=θ-θ' (1)

where θ is the phase of the acquired signal, θ' is the phase without any deviation, and Δ θ is the phase difference.

And S4, obtaining the phase value of the fine code signal under the condition of no deviation through calculation according to the phase difference delta theta, and obtaining the fine code fine value through looking up a fine division table after obtaining the phase value.

And S5, after the fine code fineness value and the obtained coarse code value are combined coarsely and finely, obtaining a binary angle value of the photoelectric encoder and outputting the binary angle value.

And combining the fine code value and the coarse code value to obtain a binary angle value of the photoelectric encoder and outputting the binary angle value. And the photoelectric encoder is adjusted according to the output binary angle value without readjustment.

The present invention provides a preferred embodiment, and the preset condition is that the phase of the cosine-way fine code signal is compared with the phase of the sine-way fine code signal, and a lagging or leading signal is determined as the reference signal.

The present invention provides a preferred embodiment, and the specific calculation method of the phase difference Δ θ in step S3 is as follows:

if the phase of the cosine-path precise code signal is ahead of that of the sine-path precise code signal, the sine-path precise code signal is selected as a reference signal, the phase of the sine-path precise code signal is added by 90 degrees and then is differed with the phase of the cosine-path precise code signal, and the phase difference delta theta is obtained.

In this embodiment, a sine-way fine code signal is selected as a reference signal for detailed description, the acquired sine-way fine code signal and cosine-way fine code signal are respectively marked as a · sin θ and a · cos θ and sent to an upper computer, the phase of a · sin θ is added by 90 °, and a · cos θ 'is obtained, and a · cos θ' is shown in formula (2).

As shown in fig. 4, when the tangent method is used for subdivision operation, theoretically, a · sin θ and a · cos θ are required to have two equal amplitudes and have a phase difference of 90 °, but actually, since light emitted by the light emitting diode has a divergence angle and is non-parallel light, the two phases of a · sin θ and a · cos θ have a phase difference of less than 90 °, and thus a phase difference Δ θ is generated between a phase value of an acquired signal and a theoretical value under the condition of no deviation, as shown in formula (1) and formula (2).

Δθ=θ-θ' (1)

A·cosθ'=A·sin(90°+θ) (2)

Where θ is the phase of the acquired signal, θ 'is the phase without deviation, Δ θ is the phase difference, and a · cos θ' is the cosine-way fine code signal without deviation.

A · cos Δ θ is developed and sorted by a trigonometric function to obtain a formula (3);

A·cosΔθ=A·cos(θ-θ')=A·cosθcosθ'+A·sinθsinθ' (3)

performing an inverse cosine operation on equation (3) can obtain Δ θ, as shown in equation (4):

Δθ=arccos(A·cosθcosθ'+A·sinθsinθ') (4)

wherein, A · cos θ is the collected cosine way fine code signal, A · sin θ is the collected sine way fine code signal, and A · sin θ' is the sine way fine code signal under the condition of no deviation.

If the phase of the cosine-path precise code signal lags behind that of the sine-path precise code signal, selecting the cosine-path precise code signal as a reference signal, adding 90 degrees to the phase of the cosine-path precise code signal, and then making a difference with the phase of the sine-path precise code signal to obtain a phase difference delta theta:

Δθ=θ-θ' (1)

A·sinθ'=A·cos(90°+θ) (5)

a · sin Δ θ is developed and sorted by trigonometric function to obtain formula (6):

A·sinΔθ=A·sin(θ-θ')=A·sinθcosθ'-A·cosθsinθ' (6)

performing an inverse cosine operation on equation (6) can obtain Δ θ, as shown in equation (7):

Δθ=arcsin(A·sinθcosθ'-A·cosθsinθ') (7)

in step S4, if the precision code signal is calculated according to the collected cosine-loop precision code signal, the collected actual cosine-loop precision code signal a · cos θ may be represented as: a · cos (theta' + delta theta), expanding and performing trigonometric function operation to obtain a formula (8);

A·cos(θ'+Δθ)=A·cosθ'cosΔθ-A·sinθ'sinΔθ (8)

wherein, A is the amplitude of sine-path precise code signal and cosine-path precise code signal.

The formula (9) can be obtained by collating the formula (8):

the phase value of the fine code signal after the phase deviation correction is calculated according to the following formula (10):

similarly, the actual sine-road fine code signal sin θ collected by the sampling unit can be expressed as: a · sin (theta' + delta theta), expanding and performing trigonometric function operation to obtain a formula (11);

A·sin(θ'+Δθ)=A·sinθ'cosΔθ+A·cosθ'sinΔθ (11)

formulating equation (11) yields equation (12):

the phase value of the fine code signal after the phase deviation correction is calculated according to the following formula (13):

the sine-way fine code signal or the cosine-way fine code signal can be selected as the reference signal to be calculated according to actual conditions, which is not limited by the invention.

And obtaining the fine code fine value adjusted by the phase adjustment method by looking up a fine table after the phase value of the fine code signal under the condition of no deviation is obtained.

The fine code phase adjusting method provided by the invention has the advantages that the encoder is only required to be rotated for one circle when the fine code phase adjusting method starts to work, the upper computer is analyzed and calculated for phase difference after the fine code signals are obtained, the phase value of the fine code signals is calculated through the obtained phase difference, and the fine code value is determined through table lookup, so that the fine code phase adjusting efficiency can be greatly improved. And the precision of the phase compensation obtained by the fine code phase adjustment method provided by the invention is higher than that obtained by experience.

The fine code phase adjusting method provided by the invention is also suitable for adjusting the fine code phase of the moire fringe type grating ruler.

In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.

While embodiments of the present invention have been shown and described above, it should be understood that the above embodiments are exemplary and should not be taken as limiting the invention. Variations, modifications, substitutions and alterations of the above-described embodiments may be made by those of ordinary skill in the art without departing from the scope of the present invention.

The above embodiments of the present invention should not be construed as limiting the scope of the present invention. Any other corresponding changes and modifications made according to the technical idea of the present invention should be included in the protection scope of the claims of the present invention.

12页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:基于光纤复合柔性传感器的人体姿态识别方法

网友询问留言

已有0条留言

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

精彩留言,会给你点赞!

技术分类