A signal conversion method for encoder reading
By dynamically adjusting the comparison level and using the average value of the high and low levels of the optical signal to calculate a 0.3 to 0.4 times difference for binarization, the problem of reading errors caused by changes in light intensity and uneven light sources in the photoelectric encoder is solved, improving It improves the stability and accuracy of encoder readings and reduces system complexity and cost.
Patent Information
- Application Number
- CN202410989856.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-07-23
AI Technical Summary
In existing photoelectric encoder technology, during the process of converting analog signals into digital signals, voltage comparison errors caused by changes in light intensity and uneven light emission of the light source affect the accuracy of encoder readings, and the existing methods increase the complexity of the system. sex and cost.
By converting the optical signal into a current signal, amplifying it and calculating the average high and low level of the voltage signal, dynamically adjusting the comparison level, and using a difference of 0.3 to 0.4 times as the comparison level for binarization, the value for encoder reading is obtained. M sequence, which reduces reading errors and improves system stability.
It effectively resists the influence of light intensity changes and light source characteristics, reduces reading errors, reduces system design and cost, improves measurement accuracy and reliability, adapts to different light intensity conditions, and improves the stability and versatility of encoder readings.
Smart Images

Figure CN118518139B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of encoder reading, and in particular provides a signal conversion method for encoder reading. Background Art
[0002] In the field of automation and precision manufacturing, photoelectric encoders are key components for measuring and controlling the position of equipment. Existing photoelectric encoder technology usually relies on converting analog light intensity signals into digital signals. The process of converting analog signals into digital signals involves the process of voltage comparison. Currently, the following two methods are commonly used for voltage comparison:
[0003] First, use the photocell to collect the light intensity signal, convert it into a voltage signal digital quantity, and use the voltage signal digital quantity to compare the voltage with the set comparison level. If it is higher than the comparison level, a high level is output, and if it is lower than the comparison level, a low level is output. In this method, the comparison level is a fixed value, and the fixed comparison level is easily affected by environmental factors. The voltage signal output by the photocell will affect the result of the voltage comparison with factors such as light intensity, light source luminous consistency, and window uniformity, resulting in errors in the output signal.
[0004] Second, use the photocell to collect the light intensity signal, convert it into a voltage signal digital quantity, and set the comparison level of the pass circle (the light received by the pass circle photocell window is 1 / 2 of the normal level signal window), and use the voltage signal to compare with the pass circle voltage signal. If it is higher than the pass circle voltage, a high level is output, and if it is lower than the pass circle voltage, a low level is output. The comparison level of this method changes with the change of the signal. Although this method solves the comparison error caused by the change of light intensity in method one to a large extent, the grating in this method requires additional code channels to be realized, and the grating code disk needs to be specially processed, which increases the complexity and cost of the system. For the solution with cramped grating space, additional code channels are also difficult to meet; and in the case of uneven light emission of the light source, voltage comparison errors may still occur. Summary of the invention
[0005] In order to solve the above problems, the present invention provides a signal conversion method for encoder reading, which dynamically adjusts the comparison level according to the specific situation of the analog signal, thereby avoiding the problem of binarization errors caused by changes in light intensity or uneven light source when using a fixed level, thereby affecting the reading.
[0006] The signal conversion method for encoder reading provided by the present invention comprises:
[0007] S1: converting the optical signal obtained by the indicator grating into a current signal, then converting the current signal into a voltage signal, and amplifying the voltage signal;
[0008] S2: collect the high level in the voltage signal, remove the maximum value of all high levels, and calculate the average value of the remaining high levels;
[0009] Collect the low level in the voltage signal, remove the minimum value of all low levels, and then calculate the average value of the remaining low levels;
[0010] Calculate the difference between the mean of the remaining high levels and the mean of the remaining low levels;
[0011] S3: Using the difference of 0.3 to 0.4 times as a comparison level, and using the comparison level to binarize the amplified voltage signal, to obtain an M sequence for encoder reading.
[0012] Preferably, in S1, a photoelectric sensor is used to collect a light signal emitted by a light source and passing through an indicating grating, and the light signal is converted into a current signal; and the current signal is converted into a voltage signal through a TIA.
[0013] Preferably, in S1, an OPA operational amplifier is used to amplify the voltage signal.
[0014] Preferably, two photoelectric sensors are set to respectively collect light signals emitted by the light source and passing through the indicator grating to obtain a first light signal and a second light signal, and two differences are calculated using the first light signal and the second light signal respectively, and a weighted average of the two differences is calculated, and 0.3 to 0.4 times the weighted average is used as a comparison level.
[0015] Preferably, in S3, a voltage signal higher than the comparison level is converted into a digital signal "1", and a voltage signal lower than the comparison level is converted into a digital signal "0".
[0016] Preferably, a time period is set, the voltage signal is divided into multiple segments according to the time period, and the comparison level is calculated segment by segment.
[0017] Compared with the prior art, the present invention can achieve the following beneficial effects:
[0018] The comparison level of the present invention is adjusted dynamically in real time according to the collected voltage simulation, can adapt to different light intensity conditions and light source characteristics, and reduce reading errors; and the M sequence used for encoder reading is obtained through a binarization method, which can effectively resist the influence of external environmental changes and improve the stability of the system; in addition, compared with the existing method of setting a comparison level of a through loop, the present invention only needs to set one code channel, which reduces the design and manufacturing costs of the system, reduces the requirements of the reading method for the encoder hardware, and improves the versatility of the method of the present invention.
[0019] The present invention also proposes setting up dual photoelectric sensors to collect two synchronous voltage signals, determining a comparison level by a weighted average method, and fusing data from multiple sensors to further improve measurement accuracy and reliability. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 is a flow chart of a signal conversion method for encoder readings provided according to an embodiment of the present invention;
[0021] Figure 2 It is a schematic diagram of comparing a comparison level with an amplified voltage signal according to an embodiment of the present invention. DETAILED DESCRIPTION
[0022] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. In the following description, the same modules are represented by the same reference numerals. In the case of the same reference numerals, their names and functions are also the same. Therefore, the detailed description thereof will not be repeated.
[0023] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and do not constitute a limitation of the present invention.
[0024] like Figure 1 As shown, an embodiment of the present invention proposes a signal conversion method for encoder reading, comprising the following steps:
[0025] S1: The reading process of the photoelectric encoder is realized by converting the mechanical displacement into an electrical signal. During the operation of the photoelectric encoder, the light-emitting element provides a collimated light source, which is irradiated onto the photoelectric sensor (PD) through the light-transmitting part of the code channel of the grating code disk. As the encoder spindle rotates, the light-transmitting and opaque lines on the grating code disk alternately block the light, causing the light flux received by the photoelectric sensor to change. The photoelectric sensor converts the collected light signal into a current signal, and then converts the received current signal into a proportional output voltage signal through TIA (transimpedance amplifier). However, the voltage signal obtained after TIA processing is relatively small, and the voltage signal must be amplified by the OPA operational amplifier for subsequent binarization and decoding. In the above process, the current signal and the voltage signal before and after amplification are both analog signals.
[0026] S2: During the encoder reading process, the analog signal needs to be converted into a digital signal. Binarization can be used as a simple encoding method to convert continuous analog signals into discrete digital signals for subsequent digital processing and transmission.
[0027] In the binarization process, all high levels in the amplified voltage signal are first collected. Affected by the uniformity and changes of the collimated light source, the amplified voltage signal becomes an approximate sine or cosine signal, with the peak of the signal being a high level and the trough being a low level. After obtaining all high levels, the maximum high level is removed, and then the remaining high level signals are added and divided by the number of remaining high levels to calculate the mean of the remaining high levels.
[0028] All low levels in the amplified voltage signal are collected in the same way, the minimum value of all low levels is removed, and then the remaining low level signals are added and divided by the number of remaining low levels to calculate the average value of the remaining low levels.
[0029] The difference between the remaining high level average obtained above and the remaining low level average is subtracted to obtain the difference between the two. The interpolation reflects the fluctuation of the collected optical signal caused by the uniformity and change of the collimated light source.
[0030] S3: After determining the fluctuation situation, it is necessary to determine the comparison level. After experimental testing and theoretical analysis, it is determined that the difference of 0.3 to 0.4 times is used as the comparison level, and the comparison level is used for binarization. Since the comparison level is calculated based on the received voltage signal and is dynamically adjusted under the influence of the received voltage signal, compared with the existing fixed value design, the comparison level selected in the embodiment of the present invention can avoid the problem of output signal errors caused by light source changes and uneven light emission.
[0031] After determining the comparison level, the amplified voltage signal is binarized, and the voltage signal above the comparison level is converted into a digital signal "1" according to the signal acquisition interval, and the voltage signal below the comparison level is converted into a digital signal "0". A string of M sequences for encoder readings can be obtained. When reading, the binarized digital signal needs to be decoded. The decoding process involves converting these digital signals into corresponding position information. In an absolute encoder, each position has a unique binary code, and finally, the decoded data can be used to output the absolute position.
[0032] The reason why the difference of 0.3 to 0.4 is used as the comparison level instead of the difference of 0.5 times the middle value is that in the process of voltage comparison, the waveform of the analog signal is not an ideal sine or cosine waveform due to the influence of the collimated light source, but has obvious fluctuations. Figure 2 As shown in the figure, the uneven intensity of the collimated light source or the contamination of the grating code channel may cause the following Figure 2 The three waveforms ①, ②, and ③ are shown. Among them, waveform ① is due to the change in the intensity of the collimated light source, which causes the amount of light entering this point to be too high, and the voltage signal is higher than the theoretical voltage , the waveform reflects that the peak is too high, but this waveform does not affect the use and can be read normally. Waveform ② is the waveform under normal conditions. Waveform ③ may be due to weak light intensity or contamination of the grating code disk corresponding to this point, resulting in a small voltage signal, which is reflected in the waveform as a low peak, which will seriously affect the reading. In the binarization process, for the normal waveform ②, two binary numbers are used to encode each half period, such as Figure 2 The width of A in the figure is 0.3 times the difference, or 0.5 times the difference. No reading error will occur. However, for waveform ③, width 1 is still needed as the comparison interval. At this time, if the comparison level is 0.5 times the difference, the width of width 2 will be insufficient, and the amount of light entering during this time will be insufficient. Only one binary number can be compared, which will result in data errors and subsequent data errors. If the comparison level is 0.3 times the difference, two values will be obtained. Figure 2 The width of 3 in the output can normally output two binary numbers. Similarly, if the comparison level value multiple is selected to be less than 0.3, the problem of being unable to accurately compare the low level will occur. After repeated practical verification, the difference of 0.3 to 0.4 times as the comparison voltage can almost cover all problems of too small analog signals caused by uneven light intensity of the light source or contamination of the grating. When more extreme situations occur, it is usually necessary to maintain and adjust the encoder hardware, which is difficult to overcome by the reading method.
[0033] As a preferred embodiment, the method proposed in the embodiment of the present invention can also be applied to the reading processing of the photoelectric encoder of the dual reading head, where the two photoelectric sensors of the two reading heads respectively collect the light signals emitted by the respective corresponding collimated light sources and passing through the indicating grating to obtain the first light signal and the second light signal respectively, and the first light signal and the second light signal are respectively used to calculate the two differences corresponding to the first light signal and the second light signal through the above-mentioned steps S1 and S2, and the weighted average of the two differences is calculated, and the weighted average of 0.3 to 0.4 times is used as the comparison level. Usually, the weighting coefficients of the two differences can be set to 0.5 for equal weight calculation, or different weighting coefficients can be assigned for calculation.
[0034] As a preferred embodiment, when the encoder runs for a long time, a time period T can also be set, and the voltage signal can be divided into multiple segments according to the time period T, and the comparison level can be calculated in segments, that is, from the start of the encoder operation, the comparison voltage is calculated once every time period T, and the comparison voltage is dynamically updated to avoid the problem that continuous extreme conditions cause the comparison voltage of the entire segment to be greatly affected by the extreme conditions, which can further improve the reading accuracy.
[0035] Although the embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and cannot be understood as limiting the present invention. Those skilled in the art may change, modify, replace and modify the above embodiments within the scope of the present invention.
[0036] The above specific implementations of the present invention do not constitute a limitation on the protection scope of the present invention. Any other corresponding changes and modifications made based on the technical concept of the present invention should be included in the protection scope of the claims of the present invention.
Claims
1. A signal conversion method for encoder reading, characterized in that: The following steps are involved: S1: two photoelectric sensors are set to respectively collect the light signals transmitted through the indicator grating by the corresponding light sources of the dual-reader photoelectric encoder, to obtain the first light signal and the second light signal, and the two light signals obtained by the indicator grating are respectively converted into two current signals, and then the two current signals are converted into two voltage signals through TIA, and the voltage signals are amplified; S2: collect the high level in the voltage signal, remove the maximum value of all high levels, and calculate the average value of the remaining high levels; Collect the low level in the voltage signal, remove the minimum value of all low levels, and then calculate the average value of the remaining low levels; Calculate the difference between the mean of the remaining high levels and the mean of the remaining low levels; Calculating the two differences using the first optical signal and the second optical signal respectively; S3: Calculate the weighted average of the two differences, use 0.3 to 0.4 times the weighted average as a comparison level, and use the comparison level to binarize the amplified voltage signal to obtain an M sequence for encoder reading.
2. The signal conversion method for encoder reading according to claim 1, characterized in that: In S1, an OPA operational amplifier is used to amplify the voltage signal.
3. The signal conversion method for encoder reading according to claim 1, characterized in that: In S3, the voltage signal higher than the comparison level is converted into a digital signal "1", and the voltage signal lower than the comparison level is converted into a digital signal "0".
4. The signal conversion method for encoder reading according to claim 1, characterized in that: A time period is set, the voltage signal is divided into multiple segments according to the time period, and the comparison level is calculated segment by segment.
Citation Information
Patent Citations
Multi-bit encoder signal conditioning circuit having common mode disturbance compensation
US5291133A
