Method and device for adjusting LED light source of photoelectric encoder, and photoelectric encoder

By real-time monitoring and dynamic adjustment of the PWM duty cycle of the LED light source of the photoelectric encoder, the signal quality problem caused by the inconsistency of the LED light source is solved, thereby improving the measurement accuracy and stability of the photoelectric encoder and adapting to various environmental changes.

CN122395775APending Publication Date: 2026-07-14SUZHOU WEICHUANG ELECTRICAL EQUIP TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SUZHOU WEICHUANG ELECTRICAL EQUIP TECH
Filing Date
2025-09-25
Publication Date
2026-07-14

Smart Images

  • Figure CN122395775A_ABST
    Figure CN122395775A_ABST
Patent Text Reader

Abstract

The application discloses an LED light source adjusting method and device of an optical encoder and the optical encoder, and relates to the technical field of optical encoders. The method comprises the following steps: acquiring the maximum signal amplitude of the optical encoder; judging whether the maximum signal amplitude is within a preset reasonable range; if the maximum signal amplitude is not within the preset reasonable range, dynamically adjusting the duty cycle of a PWM signal of an LED light source driving the optical encoder according to different stages of the optical encoder, so that the maximum signal amplitude is adjusted to be within the reasonable range. The application adjusts the PWM duty cycle of the LED light source dynamically by monitoring the maximum signal amplitude of the optical encoder in real time, so that the signal amplitude is always maintained within a reasonable range. The method can fundamentally solve the signal quality problem caused by inconsistent light intensity, and significantly improves the measurement accuracy, stability and environmental adaptability of the optical encoder in the whole life cycle.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of photoelectric encoder technology, and in particular to a method, device and photoelectric encoder for adjusting the LED light source of a photoelectric encoder. Background Technology

[0002] Absolute photoelectric encoders, as high-precision position detection devices, can output the absolute position information of shaft angles in real time and are widely used in industrial automation, robot control, precision measurement, and other fields. The core component of this photoelectric encoder is a grating code disk, whose surface is engraved with several concentric code tracks. Each code track consists of alternating light-transmitting and opaque fan-shaped areas. The number of lines on the grating code disk directly determines the resolution of the photoelectric encoder. To reduce possible bit errors during synchronous switching of multiple code tracks, binary or Gray code is typically used. An LED light source is set on one side of the grating disk, and a photoelectric sensor, such as a photodiode or phototransistor, is installed on the other side corresponding to each code track. When the grating disk rotates with the measured shaft, the photoelectric sensor detects the changes in light flux of each code track in real time and converts them into corresponding electrical signals. These analog electrical signals are converted into digital signals by an analog-to-digital converter, and finally processed by a decoding circuit or microprocessor to output absolute position data.

[0003] Although absolute photoelectric encoders theoretically possess high precision and reliability, their actual performance largely depends on the consistency of optical components, with the uniformity and stability of the LED light source being particularly critical. In practical applications, inherent differences in luminous efficiency and brightness exist between different LED devices. This inconsistency leads to uneven light intensity distribution across code tracks. Uneven light intensity can not only cause signal misinterpretation but also exacerbate optical crosstalk between adjacent code tracks, resulting in position detection errors. Furthermore, insufficient LED brightness or attenuation differences during use can significantly reduce signal contrast, making it difficult for subsequent signal processing circuits to accurately distinguish between bright and dark states. This not only reduces the system's effective resolution but also increases the risk of bit errors during Gray code decoding.

[0004] In the long run, the inconsistent aging rate and temperature characteristics of LEDs will further affect the stability of photoelectric encoders. Under conditions of temperature variation or long-term operation, the drift in LED performance may cause fluctuations in the output signal, leading to a decrease in the control accuracy of the servo system or even jitter. In severe cases, it may cause temporary or permanent loss of absolute position information. In more extreme cases, the premature failure of individual LEDs may cause the entire decoding process to fail completely, directly threatening the functional reliability of the photoelectric encoder. Therefore, how to ensure the output consistency and stability of the LED light source throughout the entire life cycle of the photoelectric encoder has become a key technical problem that urgently needs to be solved in this field. Summary of the Invention

[0005] This invention provides a method, apparatus, and photoelectric encoder for adjusting the LED light source of a photoelectric encoder, aiming to solve the problem of how to ensure the output consistency and stability of the LED light source throughout the entire life cycle of the photoelectric encoder.

[0006] In a first aspect, embodiments of the present invention provide a method for adjusting the LED light source of a photoelectric encoder, comprising:

[0007] Obtain the maximum signal amplitude of the photoelectric encoder;

[0008] Determine whether the maximum signal amplitude is within a preset reasonable range;

[0009] If the maximum signal amplitude is not within the preset reasonable range, the duty cycle of the PWM signal driving the LED light source of the photoelectric encoder is dynamically adjusted according to the different stages of the photoelectric encoder, so that the maximum signal amplitude is adjusted to the reasonable range.

[0010] A further technical solution is that, if the photoelectric encoder is in the offline calibration stage, the reasonable range is a preset first range, and the dynamic adjustment of the duty cycle of the PWM signal driving the LED light source of the photoelectric encoder to adjust the maximum signal amplitude to the reasonable range includes:

[0011] The duty cycle is adjusted with a preset first adjustment period and a first adjustment step size. After each adjustment of the duty cycle, the process moves to the step of obtaining the maximum signal amplitude of the photoelectric encoder until the maximum signal amplitude is within a preset reasonable range.

[0012] A further technical solution is that, if the photoelectric encoder is in the offline calibration stage, the method further includes:

[0013] If the maximum signal amplitude is within a preset reasonable range, the duty cycle of the PWM signal of the LED light source is obtained as the target duty cycle, the target duty cycle is kept constant, and a preset number of the maximum signal amplitudes are continuously collected.

[0014] If the maximum deviation between the maximum amplitudes of the preset number of acquired signals is less than a preset deviation threshold, the target duty cycle is written as the initial duty cycle into the storage unit of the photoelectric encoder.

[0015] A further technical solution is that, if the photoelectric encoder is in the vernier decoding stage, the reasonable range is a preset second range, and the dynamic adjustment of the duty cycle of the PWM signal driving the LED light source of the photoelectric encoder to adjust the maximum signal amplitude to the reasonable range includes:

[0016] The duty cycle is adjusted with a preset second adjustment period and a second adjustment step size. After each adjustment of the duty cycle, the process moves to the step of obtaining the maximum signal amplitude of the photoelectric encoder until the maximum signal amplitude is within a preset reasonable range.

[0017] A further technical solution is that the method further includes: if the maximum signal amplitude is within a preset reasonable range, then the current duty cycle of the LED light source is locked unchanged, and ADC acquisition and position calculation are started.

[0018] A further technical solution is that, if the photoelectric encoder is in the incremental decoding stage, and the reasonable range is a preset third range, the dynamic adjustment of the duty cycle of the PWM signal driving the LED light source of the photoelectric encoder to adjust the maximum signal amplitude to the reasonable range includes:

[0019] If the maximum signal amplitude is not within the third range but is within a preset fourth range, the duty cycle is adjusted with a preset third adjustment period and a third adjustment step size. After each adjustment of the duty cycle, the process returns to the step of obtaining the maximum signal amplitude of the photoelectric encoder until the maximum signal amplitude is within a preset reasonable range.

[0020] A further technical solution is that the dynamic adjustment of the duty cycle of the PWM signal driving the LED light source of the photoelectric encoder, so that the maximum signal amplitude is adjusted to the reasonable range, further includes:

[0021] If the maximum signal amplitude is not within the fourth range but is within a preset fifth range, the duty cycle is adjusted with a preset fourth adjustment period and a fourth adjustment step size. After each adjustment of the duty cycle, the process returns to the step of obtaining the maximum signal amplitude of the photoelectric encoder until the maximum signal amplitude is within a preset reasonable range, wherein the fourth adjustment period is less than the third adjustment period.

[0022] A further technical solution is that, if the photoelectric encoder is in the incremental decoding stage, the method further includes:

[0023] If the maximum signal amplitude is not within the fifth range, a preset fault type information is issued.

[0024] Secondly, embodiments of the present invention also provide an LED light source adjustment device for an optical encoder, which includes a unit for performing the above-described method.

[0025] Thirdly, embodiments of the present invention also provide an optoelectronic encoder, including a main control MCU chip, an LED light source, a communication module, and a storage module. The main control MCU chip is connected to the LED light source, the communication module, and the storage module, respectively. The main control MCU chip is used to execute the method described in the first aspect.

[0026] This invention provides a method, apparatus, and photoelectric encoder for adjusting the LED light source of a photoelectric encoder. The method includes: acquiring the maximum signal amplitude of the photoelectric encoder; determining whether the maximum signal amplitude is within a preset reasonable range; if the maximum signal amplitude is not within the preset reasonable range, dynamically adjusting the duty cycle of the PWM signal driving the LED light source of the photoelectric encoder according to the different stages of the photoelectric encoder, so that the maximum signal amplitude is adjusted to the reasonable range. This invention monitors the maximum signal amplitude of the photoelectric encoder in real time and dynamically adjusts the PWM duty cycle of the LED light source to keep the signal amplitude within a reasonable range. This method can adaptively compensate for the performance degradation of the LED light source caused by aging, temperature changes, and individual differences, fundamentally solving the signal quality problem caused by inconsistent light intensity, and significantly improving the measurement accuracy, stability, and environmental adaptability of the photoelectric encoder throughout its entire life cycle. Attached Figure Description

[0027] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0028] Figure 1 This is a flowchart illustrating an LED light source adjustment method for an optical encoder according to an embodiment of the present invention.

[0029] Figure 2 This is a schematic diagram of the structure of an optical encoder provided in an embodiment of the present invention. Detailed Implementation

[0030] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0031] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.

[0032] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0033] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0034] As used in this specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrases "if determined" or "if [described condition or event] is detected" may be interpreted, depending on the context, as "once determined," "in response to determination," "once [described condition or event] is detected," or "in response to detection of [described condition or event]."

[0035] Please see Figure 1 This invention provides a method for adjusting the LED light source of a photoelectric encoder, the method comprising the following steps:

[0036] S1, obtain the maximum signal amplitude of the photoelectric encoder.

[0037] In practice, the photoelectric encoder includes an LED light source, a grating code disk, and a photoelectric sensor, with the signal acquired by the photoelectric sensor. The photoelectric encoder comprises multiple code tracks, and the signal amplitude of each track is acquired. The maximum signal amplitude is determined from the acquired signal amplitudes, and one maximum signal amplitude can be acquired per signal cycle. When the photoelectric encoder rotates, the photoelectric sensor of each code track outputs a periodically changing electrical signal; for any given code track, one maximum signal amplitude can be acquired within one complete cycle of its electrical signal.

[0038] Furthermore, if the photoelectric encoder is in the vernier decoding stage, the maximum signal amplitude acquired needs to be processed by offset value; if the photoelectric encoder is in the incremental decoding stage, the maximum signal amplitude acquired needs to be processed by bias value. The offset value and the bias value can be determined by calibration and preset in the photoelectric encoder. This invention does not specifically limit the specific application of these values.

[0039] In this invention, by acquiring the maximum signal amplitude of the photoelectric encoder in real time, key status feedback information is provided to the system. This enables the system to continuously monitor the current optical signal quality, laying a data foundation for subsequent intelligent adjustment.

[0040] S2, determine whether the maximum signal amplitude is within a preset reasonable range.

[0041] In specific implementation, the reasonable range can be set by those skilled in the art according to actual needs, and this invention does not specifically limit it. By determining whether the maximum signal amplitude is within a preset reasonable range, the system can accurately assess the degree of deviation between the current working state and the ideal state. This judgment process provides a clear basis for adjustment decisions, ensuring the pertinence and effectiveness of the adjustment.

[0042] S3. If the maximum signal amplitude is not within the preset reasonable range, the duty cycle of the PWM signal driving the LED light source of the photoelectric encoder is dynamically adjusted according to the different stages of the photoelectric encoder, so that the maximum signal amplitude is adjusted to the reasonable range.

[0043] In practice, when the maximum signal amplitude deviates from the reasonable range, the system activates a dynamic adjustment mechanism. This mechanism adjusts the duty cycle of the PWM signal driving the LED light source to change the output intensity of the light source. This adjustment process is adaptive, automatically determining the amplitude and direction of adjustment based on the magnitude and direction of the deviation. This allows for precise control of the signal amplitude. For example, if the maximum signal amplitude exceeds the maximum value within the reasonable range, the duty cycle is reduced; if the maximum signal amplitude is less than the minimum value within the reasonable range, the duty cycle is increased. This dynamic adjustment mechanism effectively addresses light intensity variations caused by various factors, including LED light source aging and degradation, performance drift due to temperature changes, the impact of power supply fluctuations, and reduced transmission efficiency caused by optical component contamination.

[0044] This invention ensures that the photoelectric encoder maintains a stable optical signal output throughout its entire lifespan. In the initial stage, this method compensates for inherent performance differences between different LED components, improving product consistency. During use, it compensates in real time for performance degradation caused by aging and environmental changes, extending the equipment's lifespan. Under harsh operating conditions, it maintains signal stability, guaranteeing the photoelectric encoder's decoding accuracy. This continuous performance assurance enables the photoelectric encoder to consistently provide accurate and reliable position information, providing high-quality feedback signals for subsequent control systems.

[0045] In some preferred embodiments, if the photoelectric encoder is in the offline calibration stage, the reasonable range is a preset first range. The above step "dynamically adjusting the duty cycle of the PWM signal of the LED light source driving the photoelectric encoder so that the maximum signal amplitude is adjusted to the reasonable range" specifically includes the following steps: adjusting the duty cycle with a preset first adjustment period and a first adjustment step size, and after each adjustment of the duty cycle, returning to the step of obtaining the maximum signal amplitude of the photoelectric encoder until the maximum signal amplitude is within the preset reasonable range.

[0046] In this embodiment, the first range, first adjustment period, and first adjustment step size can be set by those skilled in the art, and the present invention does not specifically limit them. For example, the first range is [1400-1700], the first adjustment period is 25ms, and the first adjustment step size is 1%. During the offline calibration stage of the photoelectric encoder (before it is put into operation at the factory), the duty cycle of the PWM signal of the LED light source of the photoelectric encoder is first set to a preset initial value, such as 40%. The meaning of adjusting the duty cycle with the preset first adjustment period and first adjustment step size is: if the maximum signal amplitude is greater than the maximum value of the reasonable range, the duty cycle is reduced by the first adjustment step size after each first adjustment period; if the maximum signal amplitude is less than the minimum value of the reasonable range, the duty cycle is increased by the first adjustment step size after each first adjustment period.

[0047] During the offline calibration phase, a relatively long first adjustment period (e.g., 25ms) and an appropriate first adjustment step size (e.g., 1%) can be used, allowing the system to acquire sufficient data samples within each adjustment interval, ensuring the accuracy and representativeness of the amplitude measurement. This design effectively avoids parameter oscillations caused by insufficient sampling time or overly rapid adjustment, making the calibration process smoother and more reliable.

[0048] For example, during initial calibration after the photoelectric encoder is installed, the system runs the code disk at a low speed (e.g., 10 rpm), acquiring the maximum signal amplitude in each first adjustment cycle. The duty cycle is then gradually adjusted with a first adjustment step size, iterating until the optimal duty cycle is found. The advantage of this method is that it can overcome the inherent performance differences between different LED light sources, establishing a unified signal reference level for newly installed photoelectric encoders and laying a solid foundation for subsequent online adjustment.

[0049] Furthermore, if the photoelectric encoder is in the offline calibration stage, the method further includes the following steps: if the maximum signal amplitude is within a preset reasonable range, obtain the duty cycle of the PWM signal of the LED light source as the target duty cycle, maintain the target duty cycle unchanged, and continuously acquire a preset number of the maximum signal amplitudes; if the maximum deviation between the preset number of acquired maximum signal amplitudes is less than a preset deviation threshold, write the target duty cycle as the initial duty cycle into the storage unit of the photoelectric encoder. The deviation threshold can be set by those skilled in the art, and this invention is not specifically limited; for example, the deviation threshold can be set to 10.

[0050] In this embodiment, after initial adjustment, the parameter (current duty cycle) is not immediately confirmed. Instead, the system is verified to have truly reached a stable state by continuously monitoring signal fluctuations over multiple sampling periods (e.g., two). This design effectively eliminates accidental optimization results caused by transient interference or measurement noise, ensuring that the initial duty cycle written to the storage unit has high reliability. Furthermore, by permanently storing the verified current duty cycle in a non-volatile storage unit, the photoelectric encoder can quickly operate according to the offline-learned LED duty cycle after a power outage and restart, improving the encoder's ease of use and reliability.

[0051] In some preferred embodiments, if the photoelectric encoder is in the vernier decoding stage, the reasonable range is a preset second range. The above step "dynamically adjusting the duty cycle of the PWM signal of the LED light source driving the photoelectric encoder so that the maximum signal amplitude is adjusted to the reasonable range" specifically includes the following steps: adjusting the duty cycle with a preset second adjustment period and a second adjustment step size, and after each adjustment of the duty cycle, returning to the step of obtaining the maximum signal amplitude of the photoelectric encoder until the maximum signal amplitude is within the preset reasonable range.

[0052] In this embodiment, the second range, the second adjustment period, and the second adjustment step size can be set by those skilled in the art, and the present invention does not specifically limit this. For example, the second range is [1400-1700], the second adjustment period is 25ms, and the second adjustment step size is 1%. Adjusting the duty cycle with the preset second adjustment period and second adjustment step size means that: if the maximum signal amplitude is greater than the maximum value of the reasonable range, the duty cycle is reduced by the second adjustment step size every second adjustment period; if the maximum signal amplitude is less than the minimum value of the reasonable range, the duty cycle is increased by the second adjustment step size every second adjustment period.

[0053] When the photoelectric encoder is powered on, during the vernier decoding stage, temperature changes may cause the LED light source brightness to differ from its offline calibration state. At this point, the system quickly detects the maximum signal amplitude using a second adjustment cycle and adjusts the duty cycle with a second adjustment step size, rapidly converging the maximum signal amplitude within a reasonable range. This rapid fine-tuning capability ensures that the photoelectric encoder receives high-quality signal input during startup, providing a reliable guarantee for absolute position decoding. This method effectively solves the problem of decreased startup performance caused by changes in environmental factors, enabling the photoelectric encoder to maintain consistent performance under different operating conditions, thus improving the adaptability and reliability of the equipment.

[0054] Furthermore, if the maximum signal amplitude is within a preset reasonable range, the current duty cycle of the LED light source is locked and unchanged, and ADC acquisition and position calculation begin.

[0055] In some preferred embodiments, if the photoelectric encoder is in the incremental decoding stage, the reasonable range is a preset third range. The above step "dynamically adjusting the duty cycle of the PWM signal of the LED light source driving the photoelectric encoder so that the maximum signal amplitude is adjusted to the reasonable range" specifically includes the following steps:

[0056] If the maximum signal amplitude is not within the third range but is within a preset fourth range, the duty cycle is adjusted with a preset third adjustment period and a third adjustment step size. After each adjustment of the duty cycle, the process returns to the step of obtaining the maximum signal amplitude of the photoelectric encoder until the maximum signal amplitude is within a preset reasonable range.

[0057] If the maximum signal amplitude is not within the fourth range but is within a preset fifth range, the duty cycle is adjusted with a preset fourth adjustment period and a fourth adjustment step size. After each adjustment of the duty cycle, the process returns to the step of obtaining the maximum signal amplitude of the photoelectric encoder until the maximum signal amplitude is within a preset reasonable range. The fourth adjustment period is shorter than the third adjustment period to meet the need for rapid response when the signal deviates significantly.

[0058] In this embodiment, the third range, fourth range, fifth range, third adjustment period, third adjustment step size, fourth adjustment period, and fourth adjustment step size can all be set by those skilled in the art, and the present invention does not specifically limit this. The fourth adjustment period is shorter than the third adjustment period. For example, the third range is [1450-1650], the fourth range is [1400-1700], the fifth range is [500-2000], the third adjustment period is 25ms, the third adjustment step size is 1%, the fourth adjustment period is 1ms, and the fourth adjustment step size is 1%. Further, the maximum range of LED duty cycle adjustment is 100%, and the minimum is 5%.

[0059] In this invention, adjusting the duty cycle with a preset third adjustment period and a third adjustment step means that: if the maximum signal amplitude is greater than the maximum value within a reasonable range, the duty cycle will be reduced by the third adjustment step after each third adjustment period; if the maximum signal amplitude is less than the minimum value within a reasonable range, the duty cycle will be increased by the third adjustment step after each third adjustment period.

[0060] Furthermore, adjusting the duty cycle with the preset fourth adjustment period and fourth adjustment step means that: if the maximum signal amplitude is greater than the maximum value of the reasonable range, the duty cycle will be reduced by the fourth adjustment step every fourth adjustment period; if the maximum signal amplitude is less than the minimum value of the reasonable range, the duty cycle will be increased by the fourth adjustment step every fourth adjustment period.

[0061] In this invention, the incremental decoding stage typically corresponds to the high-speed operation of the photoelectric encoder, where the signal changes frequently and is potentially subject to more interference. Therefore, a different adjustment strategy is required compared to other stages. By setting a fourth range as a buffer region and employing a relatively moderate third adjustment cycle, gentle adjustment can be initiated when the signal deviates to some extent but has not yet seriously affected the decoding quality. This design creates good anti-interference performance and avoids frequent adjustments due to instantaneous fluctuations.

[0062] Furthermore, when the maximum signal amplitude exceeds the fourth range and enters the fifth range, it indicates a significant deviation, which may seriously affect decoding accuracy. In this case, a shorter fourth adjustment cycle is used to intervene more aggressively, striving to bring the signal back to the normal range in the shortest possible time, thereby improving decoding accuracy.

[0063] Furthermore, if the photoelectric encoder is in the incremental decoding stage, the method further includes the following step: if the maximum signal amplitude is not within the fifth range, issue a preset fault type information.

[0064] In this embodiment, when the maximum signal amplitude exceeds the fifth range—the widest safety boundary—it indicates a serious fault in the system that cannot be resolved through conventional adjustments, such as complete LED failure, damaged photoelectric sensors, or severe contamination of the optical channel. At this point, automatic adjustment attempts cease, and a preset fault type message is issued to promptly notify the host system or operator for intervention. The fault type message, for example, is "Fault Set 1," which means that the current amplitude cannot guarantee decoding reliability. This design prevents the system from continuing to operate blindly when it cannot recover, and avoids misjudgments by the control system due to incorrect location information.

[0065] When the system receives a fault signal from the photoelectric encoder, it can issue a corresponding abnormal alarm signal, which may be, for example, an audible and visual alarm signal. This invention does not specifically limit the type of alarm signal.

[0066] See Figure 2 This invention proposes a photoelectric encoder, which includes a main control MCU chip 2, an LED light source, a communication module, and a storage module 1. The main control MCU chip 2 is connected to the LED light source, the communication module, and the storage module 1. The main control MCU chip 2 is used to execute the method described in any of the above embodiments. The communication module can be a 485 communication module, and the storage module 1 can be an EEPROM. The storage module 1 stores the LED duty cycle learned during offline calibration. After the photoelectric encoder is powered on, it operates according to this duty cycle to enter the online adjustment stage. The storage module 1 can be a non-volatile memory unit (FLASH) in the MCU or an EEPROM storage module in the peripheral circuit, which can be set by those skilled in the art, and this invention does not specifically limit it.

[0067] Specifically, the main control MCU chip 2 of the photoelectric encoder can realize functions such as ADC signal acquisition, LED duty cycle adjustment, and position decoding calculation through configuration registers; the two pins 4 of the LED light source are soldered to the PCB board of the photoelectric encoder, and the grating code disk is located between the PCB board and the LED light source. When working normally, the LED lights up, the light passes through the light-transmitting area of ​​the grating, and then the photosensitive chip outputs the corresponding signal to the main control MCU chip 2, which is used by the main control MCU chip 2 for ADC sampling and position calculation; the power supply and RS485 communication terminal 3 of the photoelectric encoder are connected to the driver to enable data interaction between the driver and the photoelectric encoder, and to provide the 5V operating power supply voltage for the photoelectric encoder.

[0068] This invention proposes a method for adjusting the LED light source of an optical encoder. The method includes: acquiring the maximum signal amplitude of the optical encoder; determining whether the maximum signal amplitude is within a preset reasonable range; if the maximum signal amplitude is not within the preset reasonable range, dynamically adjusting the duty cycle of the PWM signal driving the LED light source of the optical encoder according to the different stages of the optical encoder, so that the maximum signal amplitude is adjusted to the reasonable range. This invention monitors the maximum signal amplitude of the optical encoder in real time and dynamically adjusts the PWM duty cycle of the LED light source to keep the signal amplitude within a reasonable range. This method can adaptively compensate for the performance degradation of the LED light source caused by aging, temperature changes, and individual differences, fundamentally solving the signal quality problem caused by inconsistent light intensity, and significantly improving the measurement accuracy, stability, and environmental adaptability of the optical encoder throughout its entire life cycle.

[0069] Corresponding to the above-described LED light source adjustment method for photoelectric encoders, the present invention also provides an LED light source adjustment device for photoelectric encoders. This LED light source adjustment device for photoelectric encoders includes a unit for executing the above-described LED light source adjustment method for photoelectric encoders, and includes:

[0070] A sampling unit is used to obtain the maximum signal amplitude of the photoelectric encoder;

[0071] The judgment unit is used to determine whether the maximum signal amplitude is within a preset reasonable range;

[0072] An adjustment unit is used to dynamically adjust the duty cycle of the PWM signal driving the LED light source of the photoelectric encoder according to the different stages of the photoelectric encoder if the maximum signal amplitude is not within a preset reasonable range, so as to adjust the maximum signal amplitude to the reasonable range.

[0073] The write unit is used to write the duty cycle of the PWM signal of the LED light source, which has been learned in advance and meets the preset requirements, into the storage module.

[0074] In some preferred embodiments, if the photoelectric encoder is in the offline calibration stage, the reasonable range is a preset first range, and the dynamic adjustment of the duty cycle of the PWM signal driving the LED light source of the photoelectric encoder to adjust the maximum signal amplitude to the reasonable range includes:

[0075] The duty cycle is adjusted with a preset first adjustment period and a first adjustment step size. After each adjustment of the duty cycle, the process moves to the step of obtaining the maximum signal amplitude of the photoelectric encoder until the maximum signal amplitude is within a preset reasonable range.

[0076] If the maximum signal amplitude is within a preset reasonable range, the duty cycle of the PWM signal of the LED light source is obtained as the target duty cycle. The target duty cycle is kept constant, and a preset number of maximum signal amplitudes are continuously collected. If the maximum deviation between the preset number of maximum signal amplitudes collected is less than a preset deviation threshold, the target duty cycle is written as the initial duty cycle into the storage module of the photoelectric encoder.

[0077] In some preferred embodiments, if the photoelectric encoder is in the vernier decoding stage, the reasonable range is a preset second range. The dynamic adjustment of the duty cycle of the PWM signal driving the LED light source of the photoelectric encoder, so that the maximum signal amplitude is adjusted to the reasonable range, includes:

[0078] The duty cycle is adjusted with a preset second adjustment period and a second adjustment step size. After each adjustment of the duty cycle, the process moves to the step of obtaining the maximum signal amplitude of the photoelectric encoder until the maximum signal amplitude is within a preset reasonable range.

[0079] In some preferred embodiments, if the photoelectric encoder is in the incremental decoding stage, the reasonable range is a preset third range. The dynamic adjustment of the duty cycle of the PWM signal driving the LED light source of the photoelectric encoder, so that the maximum signal amplitude is adjusted to the reasonable range, includes:

[0080] If the maximum signal amplitude is not within the third range but is within a preset fourth range, the duty cycle is adjusted with a preset third adjustment period and a third adjustment step size. After each adjustment of the duty cycle, the process returns to the step of obtaining the maximum signal amplitude of the photoelectric encoder until the maximum signal amplitude is within a preset reasonable range.

[0081] In some preferred embodiments, the step of dynamically adjusting the duty cycle of the PWM signal driving the LED light source of the photoelectric encoder to adjust the maximum signal amplitude to the reasonable range further includes:

[0082] If the maximum signal amplitude is not within the fourth range but is within a preset fifth range, the duty cycle is adjusted with a preset fourth adjustment period and a fourth adjustment step size. After each adjustment of the duty cycle, the process returns to the step of obtaining the maximum signal amplitude of the photoelectric encoder until the maximum signal amplitude is within a preset reasonable range, wherein the fourth adjustment period is less than the third adjustment period.

[0083] In some preferred embodiments, the LED light source adjustment device of the photoelectric encoder further includes:

[0084] An alarm unit is used to issue a preset fault type information if the maximum signal amplitude is not within the fifth range.

[0085] It should be noted that those skilled in the art can clearly understand that the specific implementation process of the LED light source adjustment device and each unit of the above-mentioned photoelectric encoder can be referred to the corresponding description in the foregoing method embodiments. For the sake of convenience and brevity, it will not be repeated here.

[0086] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of each unit is merely a logical functional division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.

[0087] The steps in the method of this invention can be adjusted, merged, or reduced in order according to actual needs. The units in the device of this invention can be merged, divided, or reduced according to actual needs. Furthermore, the functional units in the various embodiments of this invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0088] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0089] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Since these modifications and variations fall within the scope of the claims and their equivalents, this invention also intends to include these modifications and variations.

[0090] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for adjusting the LED light source of a photoelectric encoder, characterized in that, The method includes: Obtain the maximum signal amplitude of the photoelectric encoder; Determine whether the maximum signal amplitude is within a preset reasonable range; If the maximum signal amplitude is not within the preset reasonable range, the duty cycle of the PWM signal driving the LED light source of the photoelectric encoder is dynamically adjusted according to the different stages of the photoelectric encoder, so that the maximum signal amplitude is adjusted to the reasonable range.

2. The LED light source adjustment method for the photoelectric encoder according to claim 1, characterized in that, If the photoelectric encoder is in the offline calibration stage, the reasonable range is a preset first range. The dynamic adjustment of the duty cycle of the PWM signal driving the LED light source of the photoelectric encoder, so that the maximum signal amplitude is adjusted to the reasonable range, includes: The duty cycle is adjusted with a preset first adjustment period and a first adjustment step size. After each adjustment of the duty cycle, the process moves to the step of obtaining the maximum signal amplitude of the photoelectric encoder until the maximum signal amplitude is within a preset reasonable range.

3. The LED light source adjustment method for the photoelectric encoder according to claim 2, characterized in that, If the photoelectric encoder is in the offline calibration stage, the method further includes: If the maximum signal amplitude is within a preset reasonable range, the duty cycle of the PWM signal of the LED light source is obtained as the target duty cycle, the target duty cycle is kept constant, and a preset number of the maximum signal amplitudes are continuously collected. If the maximum deviation between the maximum amplitudes of the preset number of acquired signals is less than a preset deviation threshold, the target duty cycle is written as the initial duty cycle into the storage unit of the photoelectric encoder.

4. The LED light source adjustment method for the photoelectric encoder according to claim 1, characterized in that, If the photoelectric encoder is in the vernier decoding stage, the reasonable range is a preset second range. The dynamic adjustment of the duty cycle of the PWM signal driving the LED light source of the photoelectric encoder, so that the maximum signal amplitude is adjusted to the reasonable range, includes: The duty cycle is adjusted with a preset second adjustment period and a second adjustment step size. After each adjustment of the duty cycle, the process moves to the step of obtaining the maximum signal amplitude of the photoelectric encoder until the maximum signal amplitude is within a preset reasonable range.

5. The LED light source adjustment method for the photoelectric encoder according to claim 4, characterized in that, The method further includes: if the maximum signal amplitude is within a preset reasonable range, then locking the current duty cycle of the LED light source unchanged, and starting ADC acquisition and position calculation.

6. The LED light source adjustment method for the photoelectric encoder according to claim 1, characterized in that, If the photoelectric encoder is in the incremental decoding stage, and the reasonable range is a preset third range, the dynamic adjustment of the duty cycle of the PWM signal driving the LED light source of the photoelectric encoder to adjust the maximum signal amplitude to the reasonable range includes: If the maximum signal amplitude is not within the third range but is within a preset fourth range, the duty cycle is adjusted with a preset third adjustment period and a third adjustment step size. After each adjustment of the duty cycle, the process returns to the step of obtaining the maximum signal amplitude of the photoelectric encoder until the maximum signal amplitude is within a preset reasonable range.

7. The LED light source adjustment method for the photoelectric encoder according to claim 6, characterized in that, The method of dynamically adjusting the duty cycle of the PWM signal driving the LED light source of the photoelectric encoder to adjust the maximum signal amplitude to the reasonable range further includes: If the maximum signal amplitude is not within the fourth range but is within a preset fifth range, the duty cycle is adjusted with a preset fourth adjustment period and a fourth adjustment step size. After each adjustment of the duty cycle, the process returns to the step of obtaining the maximum signal amplitude of the photoelectric encoder until the maximum signal amplitude is within a preset reasonable range, wherein the fourth adjustment period is less than the third adjustment period.

8. The LED light source adjustment method for the photoelectric encoder according to claim 7, characterized in that, If the photoelectric encoder is in the incremental decoding stage, the method further includes: If the maximum signal amplitude is not within the fifth range, a preset fault type information is issued.

9. An LED light source adjustment device for a photoelectric encoder, characterized in that, Includes a unit for performing the method as described in any one of claims 1-8.

10. A photoelectric encoder, characterized in that, It includes a main control MCU chip, an LED light source, a communication module, and a storage module. The main control MCU chip is connected to the LED light source, the communication module, and the storage module, respectively. The main control MCU chip is used to execute the method as described in any one of claims 1-8.