A gear encoder signal error correction system and method
By combining signal acquisition, filtering, and error analysis modules, the signal error problem of gear encoders is solved, achieving high-precision signal compensation and stability improvement, and adapting to error correction in complex environments.
Patent Information
- Application Number
- CN202511162213.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-19
- Publication Date
- 2026-03-03
- Estimated Expiration
- 2045-08-19
AI Technical Summary
Traditional gear encoders suffer from low resolution, large signal errors, and poor environmental adaptability. In particular, when high subdivision is required, the measurement accuracy drops sharply, making it difficult to meet the feedback requirements of high-speed spindles and high-precision servo motors.
The system employs a signal acquisition module, a judgment and screening module, an error analysis module, and a monitoring and adjustment module. It converts signals through a differential receiving circuit, performs three levels of signal quality screening, error analysis, and compensation parameter calculation, and dynamically adjusts the monitoring cycle in conjunction with Lissajous curve closure verification and Z-pulse validity detection to achieve high-precision signal acquisition and error correction.
It improves the signal's noise immunity, ensures data quality, enables comprehensive measurement and accurate compensation of encoder signals, enhances measurement accuracy and system stability, and provides flexible fault response capabilities.
Smart Images

Figure CN120907586B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of gear encoder signal processing, specifically to a gear encoder signal error correction system. Background Technology
[0002] A gear encoder is a sensing device commonly used to measure the angle and speed of rotating machinery. It consists of a gear assembly, an encoding element, and a detection circuit. The gear assembly directly meshes with the shaft being measured, transmitting the rotational motion of the shaft to the encoder disk or magnet through the gear ratio. The encoding element and the detection circuit convert the photoelectric or magnetoelectric signals of the encoding element into a pulse sequence, outputting corresponding A and B phase signals (sometimes also including the zero-position Z phase). In a closed-loop servo control system, the encoder serves as a feedback element for the motor position and speed, and has a crucial impact on the control accuracy and dynamic performance of the system.
[0003] While traditional magnetic encoders offer high responsiveness and vibration resistance, they generally suffer from low resolution, large signal errors, and poor environmental adaptability. This is especially true in gear encoders based on the magnetoresistive effect, where variations in the meshing and gap between the gears and the magnetic sensing element introduce errors such as DC bias, amplitude inconsistency, and phase shift. These errors not only limit the subdivision factor of analog sine and cosine signals but also cause a sharp drop in measurement accuracy under high subdivision requirements, making it difficult to meet the feedback requirements of high-speed spindles and high-precision servo motors.
[0004] Existing error correction compensation typically employs analog circuit compensation and phase compensation. Analog circuit compensation adjusts the DC bias or gain through operational amplifiers, but it suffers from temperature drift and requires manual parameter matching, resulting in low efficiency. Traditional phase compensation (such as the Heydemann elliptic algorithm) only compensates for phase errors, failing to address DC and amplitude errors. Summary of the Invention
[0005] To address the problems in related technologies, this invention provides a gear encoder signal error correction system to overcome the aforementioned technical problems in existing related technologies.
[0006] To solve the aforementioned technical problem, the present invention is achieved through the following technical solution:
[0007] This invention provides a gear encoder signal error correction system, specifically including: a signal acquisition module, a judgment and screening module, an error analysis module, an error correction module, and a monitoring and adjustment module;
[0008] Based on the received error monitoring command, the signal acquisition module activates the differential receiving circuit channel to convert the encoder A-phase differential signal, B-phase differential signal and Z-phase zero-position reference signal into single-ended signals, and simultaneously acquires the above three signals to obtain signal data;
[0009] The judgment and screening module segments the collected signal data and performs three-level signal quality screening on each segment. The three-level signal quality screening includes high-frequency noise removal, Lissajous curve closure verification, and Z pulse validity detection. The signal data is retained only when all three signals, A, B, and Z, meet the standards within the same segment.
[0010] The error analysis module performs error analysis based on the filtered and retained signal data to generate error indicators. If any indicator exceeds the threshold, a correction instruction is generated; otherwise, the error correction module is skipped and the monitoring and adjustment module is executed directly. The error indicators include speed fluctuation ratio, zero-point deviation, and linearity.
[0011] The error correction module merges each segment of signal data after filtering to form a complete segment of signal data. It calculates the DC, amplitude, and phase compensation values based on the complete segment of signal data to obtain compensation parameters, writes them into a register, synchronously calibrates the phase of the Z pulse with the A and B waveforms, iteratively verifies the compensation effect, and records compensation events.
[0012] The monitoring and adjustment module dynamically adjusts the monitoring cycle based on the compensation events within the most recent fixed time period, and generates the next correction monitoring instruction based on the monitoring cycle, updating it to the signal acquisition module.
[0013] Preferably, the data is segmented based on the acquired signal data:
[0014] Obtain the encoder signal fundamental frequency f0, which is defined as the appearance of a complete sine or cosine cycle in the waveform for each tooth of the gear. Its frequency is determined by the rotational speed: f0 = rotational speed × number of teeth. Divide the sine and cosine waves into overlapping window segments of length L. Perform a discrete Fourier transform on each overlapping window segment to obtain a set of frequency domain coefficients and the amplitude of each frequency domain coefficient. The overlapping part of each window is 50%.
[0015] Preferred method: High-frequency noise removal
[0016] Extract the fundamental frequency f0, whose frequency is determined by the rotational speed: f0 = rotational speed × number of teeth; define a frequency greater than (N f The signal component of ×f0) is a high-frequency component, N f The harmonic coefficients for determining high-frequency components;
[0017] The total energy of the signal within the entire overlapping window segment is obtained by summing the squares of all amplitudes within the overlapping window segment. Spectral line parameters for each overlapping window segment are extracted, including sampling rate and length L. In the same Fourier transform, each spectral line corresponds to a frequency, taking values greater than (N...). fThe signal components of ×f0) are high-frequency components. The square of the amplitude of each high-frequency component is taken and summed to obtain the sum of the energy in the high-frequency band, which is then marked as high-frequency energy. The high-frequency energy is then divided by the total energy in the entire sampling window to obtain the proportion of high-frequency energy.
[0018] A preset high-frequency threshold is set. If the proportion of high-frequency energy of sine or cosine waves in the same overlapping window segment is greater than or equal to the high-frequency threshold, the signal data of this overlapping window segment is determined to be severely noisy and is removed. If the proportion of high-frequency energy of sine and cosine waves in the overlapping window segment at the same time is less than the high-frequency threshold, the signal data of this overlapping window segment is retained and Lissajous curve closure verification is performed.
[0019] Preferably, Lissajous curve closure verification:
[0020] Lissajous curves are plotted based on the overlapping window signal data retained after high-frequency noise removal, where the A digital value within the overlapping window is used as the horizontal axis and the B digital value is used as the vertical axis to construct the Lissajous curve; the coordinates of the first and last points are extracted from the Lissajous curve, and the closed distance d between the first and last points is calculated according to the two-dimensional Euclidean geometric distance formula, where N represents the index of the last point in the Lissajous curve, i.e., the tail point index.
[0021] Set a distance threshold. If the closing distance d ≥ the distance threshold, the curve closure is deemed unsuccessful, and the signal data of this window segment is discarded. If the closing distance d < the distance threshold, the curve closure is deemed successful, and the signal data of this overlapping window segment is retained, and Z-pulse validity detection is performed.
[0022] Preferred method: Z-pulse validity detection
[0023] 2-3-1, Pulse Count Detection: Extract the number of teeth of the gear encoder. The number of pulses M detected by the Z channel within the overlapping window segment should satisfy: M = k × number of teeth, where k is the subdivision factor, k = 2. n , where n=0,1,2,3……; count the number of pulses in the overlapping window. If the number of pulses ≠ k×number of teeth, then the number of pulses does not meet the requirement, and the signal data of this overlapping window is removed; otherwise, the signal data of the overlapping window is retained, and 2-3-2 is executed.
[0024] 2-3-2, Pulse Width Detection: For the i-th pulse, record the rising edge index. Falling edge index According to the formula Calculate pulse width Δm i ;where f sThe sampling frequency is set; a minimum pulse width threshold Tmin = 5μs is set. If either pulse width Δm of A or B within the overlapping window... i If the pulse is less than Tmin, the pulse is considered too narrow, and the signal data in this overlapping window segment is discarded; otherwise, continue executing 2-3-3.
[0025] 2-3-3, Pulse Width Consistency Detection: The actual pulse interval Δt is calculated by taking the time interval between two adjacent rising edges: Actual pulse interval = (Index of two adjacent rising edges) / (Differentiation of the difference between the indices of the two rising edges) / (Sampling frequency f). s The theoretical interval should be equal to the duration of a single tooth cycle at the sampling point. The interval deviation is obtained by calculating the difference between the actual pulse interval and the theoretical pulse interval and taking the absolute value. A maximum allowable deviation is set. If any interval deviation in the overlapping window is greater than the maximum allowable deviation, the interval is judged to be inconsistent and the signal data in this overlapping window is removed; otherwise, the signal quality is judged to be qualified.
[0026] Preferred error analysis:
[0027] 3-1, Speed Judgment: Calculate the instantaneous phase of the A and B phase voltages at each sampling point using atan2, then convert the instantaneous angular velocity using differential and sampling rate conversion. Calculate the average and standard deviation of the angular velocity within the window segment and calculate the fluctuation ratio. If the speed fluctuation ratio is greater than or equal to the fluctuation threshold, the speed fluctuation is considered too large; otherwise, the speed is considered normal.
[0028] 3-2, Zero-position repeatability judgment: Detect the phase corresponding to the rising edge of the Z pulse, and use the ring difference method to calculate the minimum angular deviation between it and the theoretical zero position as the zero-position deviation. If it exceeds the zero-position deviation threshold, it is judged as zero-position drift; otherwise, the zero-position repeatability is judged as qualified.
[0029] 3-3, Linearity judgment: Subtract the corresponding ideal angle of uniform velocity from the actual instantaneous phase of each sampling point and perform a circular processing to obtain the residual sequence. Take the maximum absolute residual and compare it with the linearity threshold. If it exceeds the limit, it is judged as linear deviation; otherwise, the linearity is qualified.
[0030] 3-4. Comprehensive judgment: Summarize the speed fluctuation ratio, zero deviation and linearity of each overlapping window segment. If any one of them exceeds the corresponding threshold, an error correction instruction is generated and sent to the error correction module; otherwise, the compensation is skipped and the monitoring and adjustment module is executed.
[0031] Preferred zero-point deviation calculation process:
[0032] In the Z-phase signal, each rising edge pulse is detected by comparing the levels of the preceding and following sampling points, and the index position of the recorder in the sampling sequence is recorded. Each index corresponds to an instantaneous phase. For each pulse, the instantaneous angular velocity corresponding to it in the phase sequence is taken, and the difference between it and the ideal zero-position phase is calculated to obtain a preliminary deviation value. To prevent errors caused by crossing the 0° boundary, the preliminary deviation value is calculated by differentiating it from 0° and 360° respectively to obtain two differences. The smaller of the two is taken as the zero-position deviation, which reflects the repeatability and stability of the zero position. The smallest zero-position deviation is selected from the zero-position deviations corresponding to each pulse in the same overlapping window segment as the zero-position deviation of this overlapping window segment.
[0033] The preferred process for obtaining the compensation parameters is as follows:
[0034] 4-1. The signal data of each overlapping window segment are merged into a single signal data segment according to their own timestamps. For the merged signal data, the average voltage of phase A and phase B is calculated, and then the DC compensation value λ is calculated by comparing it with the ideal center level of 2.5V. The calculation formula is as follows: ,in , These are the average voltage values for phase A and phase B, respectively.
[0035] 4-2. Based on the merged signal data, draw sine and cosine waveforms, and take the peak-to-valley value A of the waveform. pp and B pp The amplitude compensation value α is obtained by dividing the cosine peak-to-valley value by the sine peak-to-valley value. The specific calculation formula is as follows: ;
[0036] 4-3. Based on the merged signal data, plot the AB relationship curve to obtain the Lissajous curve, where the digital value of phase A is the horizontal axis and the digital value of phase B is the vertical axis; fit an ellipse based on the Lissajous curve and calculate its ellipse tilt angle, then subtract the ellipse tilt angle from 45° to obtain the phase compensation value β.
[0037] 4-4. Write the three compensation parameters mentioned above into the register of the gear encoder processing chip. The three compensation parameters are DC compensation value, amplitude compensation value, and phase compensation value. At the same time, perform zero-position calibration on the Z channel to ensure that the zero-position pulse edge is synchronized with the phase of the A and B waveforms. After the compensation parameters are written, wait for a short stabilization period. After the stabilization period ends, regenerate the compensation monitoring command to verify the compensation and send it to step one for iteration. Continue until the compensation is successful or the maximum number of iterations is reached. Record each compensation event, which includes the compensation time, compensation parameters, and compensation result.
[0038] Preferably, the monitoring cycle is dynamically adjusted:
[0039] The system retrieves compensation events within a fixed number of days. If no compensation events are found, the monitoring period is taken as the baseline monitoring period. A new compensation monitoring instruction is generated according to the baseline monitoring period and updated to the signal acquisition module. The baseline monitoring period is the maximum allowable monitoring period Fmax, and those skilled in the art also set a minimum allowable monitoring period Fmin.
[0040] If a compensation event exists, the compensation event of the compensation event is extracted, and the interval since the current time is calculated vertically. This interval is used as the initial value for the next monitoring cycle. If the initial value is greater than or equal to Fmax, the monitoring cycle is set to Fmax. If the initial value is less than or equal to Fmin, the monitoring cycle is set to Fmin. If Fmin is less than the initial value and less than Fmax, the monitoring cycle is set to the initial value. A new compensation monitoring instruction is generated according to the value of the monitoring cycle and updated to the signal acquisition module.
[0041] If there are two or more compensation events, sort the compensation events in order of their corresponding order, calculate the compensation interval between two adjacent compensation events, and select the smallest compensation interval as the suggested monitoring period. If the suggested monitoring period is greater than or equal to Fmax, then the monitoring period is Fmax; if the suggested monitoring period is less than or equal to Fmin, then the monitoring period is Fmin; if Fmin is less than the suggested monitoring period and less than Fmax, then the monitoring period is the suggested monitoring period. Generate a new compensation monitoring instruction based on the monitoring period and update it to the signal acquisition module.
[0042] This invention provides a method for correcting signal errors in a gear encoder, specifically including: Step 1, based on the received error monitoring command, enabling the differential receiving circuit channel to convert the encoder A-phase differential signal, B-phase differential signal and Z-phase zero-position reference signal into single-ended signals, and simultaneously acquiring the above three signals to obtain signal data;
[0043] Step 2: The collected signal data is segmented, and a three-level signal quality screening is performed on each segment. The three-level signal quality screening includes high-frequency noise removal, Lissajous curve closure verification, and Z-pulse validity detection. Signal data is retained only when all three signals (A, B, and Z) meet the standards within the same segment.
[0044] Step 3: Based on the retained signal data after filtering, perform error analysis to generate error indicators. If any indicator exceeds the threshold, a correction instruction is generated; otherwise, skip step 4 and proceed directly to step 5. The error indicators include velocity fluctuation ratio, zero-position deviation, and linearity.
[0045] Step 4: Merge each segment of signal data after filtering to form a whole segment of signal data. Calculate the DC, amplitude, and phase compensation values based on the whole segment of signal data to obtain compensation parameters, and write them into a register. Simultaneously calibrate the phase of the Z pulse with the A and B waveforms, iteratively verify the compensation effect, and record the compensation events.
[0046] Step 5: Dynamically adjust the monitoring cycle based on the compensation events within the most recent fixed time period, and generate the next corrective monitoring instruction according to the monitoring cycle, and update it to Step 1.
[0047] The present invention has the following beneficial effects:
[0048] 1. Through a compensation monitoring command mechanism that can be triggered automatically or manually, the gear encoder signal can be inspected automatically and periodically during daily operation, and engineers can quickly intervene when needed to achieve flexible fault response. The differential receiving circuit converts the three original differential signals A, B, and Z into single-ended signals and performs synchronous high-precision sampling with a length of at least 10 complete gear cycles. This not only improves the signal's noise immunity but also ensures that sufficient periodic information can be obtained for each monitoring, laying a solid data foundation for subsequent multi-dimensional analysis such as frequency domain and phase.
[0049] 2. Through rigorous quality assessment and segmented screening, dirty data containing high-frequency noise, half-cycle truncation, and zero-position pulse distortion are eliminated at the earliest stage, fundamentally avoiding the misleading effect of abnormal sampling on subsequent compensation calculations. The high-frequency energy ratio detection in 2-1 eliminates intense noise interference, the Lissajous curve closure judgment in 2-2 eliminates incomplete period and abrupt segmentation, and the three Z signal detections (quantity, width, and interval) in 2-3 ensure the timing accuracy of the zero-position reference. The 50% overlapping window segment strategy further balances continuity and robustness, ensuring that even if individual window segments are eliminated, the overall data can be smoothly spliced, ensuring that the data entering the error quantification analysis is always of high quality and reliable.
[0050] 3. By jointly judging three major indicators—speed fluctuation, zero-position repeatability, and linearity—the health status of the encoder signal is comprehensively measured from three perspectives: dynamic jitter, reference consistency, and full-cycle output. The fluctuation ratio of instantaneous angular velocity directly reflects the jitter degree of mechanical motion and electrical feedback. Zero-position deviation quantifies the consistency of the reference pulse per revolution. Linearity residual assesses the distortion amplitude of the feedback phase relative to the ideal uniform motion. As long as any indicator exceeds the limit, a correction command can be triggered in time, avoiding the problems of overgeneralization or over- or over-delayed compensation, and realizing accurate capture and timely response to signal errors.
[0051] 4. By seamlessly stitching all qualified window segments according to timestamps, and calculating global DC bias, amplitude gain, and phase calibration compensation values based on the entire data segment, the system offset and mismatch within the entire monitoring range can be corrected macroscopically in one go. At the same time, through the zero-position synchronization calibration mechanism, hardware-level precise alignment of the Z pulse edge with the A and B waveforms with zero crossover is achieved, ensuring absolute synchronization between the zero-position reference and the analog sine and cosine signals. The strategy of stable delay and a maximum of two iterations not only provides sufficient response time for the analog path but also avoids invalid and redundant operations, making the compensation process efficient and reliable. The clear criteria for determining successful or failed compensation also provide a clear basis for subsequent operation statistics and strategy optimization.
[0052] 5. By retrieving historical compensation events from the past 7 days and adaptively calculating the next monitoring cycle in combination with three compensation frequency scenarios, intelligent scheduling of monitoring frequency is achieved: the monitoring cycle is automatically extended when the situation is stable for a long period, saving computing and communication resources; monitoring is triggered at actual intervals after the first drift occurs, quickly capturing new errors; and the monitoring is followed at the most closely during frequent drifts, allowing for timely intervention; at the same time, the amplitude is strictly limited within the preset minimum and maximum monitoring cycle range, balancing real-time performance and resource efficiency. This adaptive strategy ensures that error correction monitoring is both timely and not excessive, significantly improving the intelligence and long-term reliability of error correction.
[0053] Of course, any product implementing this invention does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description
[0054] To more clearly illustrate the technical solutions of the embodiments of the invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the invention. For those skilled in the art, the drawings can be obtained from these drawings without creative effort.
[0055] Figure 1 The present invention provides a flowchart of a gear encoder signal error correction system.
[0056] Figure 2 This invention provides a schematic flowchart of a method for correcting signal errors in a gear encoder. Detailed Implementation
[0057] 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 embodiments of the present invention, and not all embodiments. 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.
[0058] To address the technical problems raised in the background section, a gear encoder is installed in the circuit, along with a host computer that communicates with the gear encoder. The host computer has a built-in gear encoder signal error correction system, specifically:
[0059] The gear encoder signal error correction system includes a signal acquisition module, a judgment and screening module, an error analysis module, an error correction module, and a monitoring and adjustment module. The signal acquisition module activates the differential receiving circuit channel based on the received error monitoring command to convert the encoder A-phase differential signal, B-phase differential signal, and Z-phase zero-position reference signal into single-ended signals, and simultaneously acquires the above three signals to obtain signal data.
[0060] The judgment and screening module segments the collected signal data and performs three-level signal quality screening on each segment. The three-level signal quality screening includes high-frequency noise removal, Lissajous curve closure verification, and Z pulse validity detection. The signal data is retained only when all three signals, A, B, and Z, meet the standards within the same segment.
[0061] The error analysis module performs error analysis based on the filtered and retained signal data to generate error indicators. If any indicator exceeds the threshold, a correction instruction is generated; otherwise, the error correction module is skipped and the monitoring and adjustment module is executed directly. The error indicators include speed fluctuation ratio, zero-point deviation, and linearity.
[0062] The error correction module merges each segment of signal data after filtering to form a complete segment of signal data. It calculates the DC, amplitude, and phase compensation values based on the complete segment of signal data to obtain compensation parameters, writes them into a register, synchronously calibrates the phase of the Z pulse with the A and B waveforms, iteratively verifies the compensation effect, and records compensation events.
[0063] The monitoring and adjustment module dynamically adjusts the monitoring cycle based on the compensation events within the most recent fixed time period, and generates the next correction monitoring instruction according to the monitoring cycle, and updates it to the signal acquisition module. The fixed time period is set by those skilled in the art according to the usage scenario and reliability requirements of the gear encoder, and is usually in days. The most recent fixed time period refers to the most recent time window of that length pushed back from the current time of the system. For example, the most recent 7 days is the time window covered by 7×24 hours from the current time.
[0064] Specifically, an encoder signal error correction system can be constructed using components such as a differential amplifier, a high-precision ADC, an embedded DSP and an industrial PC signal processor, a ring buffer RAM, a programmable signal conditioning chip, an on-chip EEPROM or an external SPI Flash / EEPROM, and a host computer-built-in scheduler. The differential amplifier is located at the output of the read head to eliminate common-mode noise and convert it to a single-ended signal. The ADC is closely connected to it, synchronously acquiring and digitizing three analog signals (A, B, and Z) to ensure at least 1000 sampling points within 10 tooth cycles. The signal processor is responsible for overlapping window FFT, Lissajous curve fitting, and phase and threshold decision-making, with a single complete processing time ≤5ms. The ring buffer RAM is used to store at least 10 × the maximum tooth cycle of raw data in real time. The system records timestamps for each window segment; the programmable signal conditioning chip, as a hardware compensation execution unit, sends DC, amplitude, and phase compensation parameters via I²C / SPI, and fine-tunes the comparator threshold and delay to achieve Z-phase zero-position synchronization; the EEPROM is used to persistently store the compensation parameters to prevent loss in case of power failure; the host computer / scheduler, in the industrial Ethernet or IoT, undertakes timing and manual triggering, historical data management, and visualization interface, collaboratively completing signal acquisition, quality screening, error judgment, adaptive scheduling, and compensation command issuance, providing full-process digital monitoring and closed-loop control, and providing the data acquisition and plug-in-free correction system for this invention.
[0065] In the specific implementation of the above embodiments, when the host computer scheduler triggers the compensation monitoring command periodically or manually through the user interface, the signal acquisition module activates the differential amplifier to convert the encoder A and B phase differential signals and the Z phase zero-position differential signal into single-ended voltages, and simultaneously acquires the three original signals, with a sampling duration covering at least 10 complete tooth cycles; the judgment and filtering module performs segmented quality checks on each overlapping window segment in the ring buffer, retaining only fully qualified window segments, and eliminating dirty data from multiple perspectives including frequency domain, phase, and timing, ensuring that subsequent error quantization is based only on high-confidence signals, significantly improving the accuracy of error correction and system robustness; error The analysis module calculates three key indicators—velocity fluctuation, zero-position repeatability, and linearity—for the retained overlapping window segments after filtering. Velocity fluctuation is quantified as the ratio of the standard deviation to the mean of the instantaneous angular velocity, indicating mechanical jitter. Zero-position repeatability is assessed by evaluating reference consistency using the phase deviation of the Z-pulse per revolution. Linearity is measured by taking the maximum residual of the circumferential difference between the instantaneous phase and the ideal uniform velocity angle to measure whole-cycle distortion. If any indicator exceeds the limit, the system generates a correction command and enters the compensation phase. By jointly evaluating signal quality from three levels—dynamic, reference, and periodic—the system avoids the risk of misjudgment based on a single indicator, achieving comprehensive and refined monitoring of encoder errors. The error correction module... After receiving the error correction command, the block seamlessly splices all qualified window segments into a single signal segment according to their timestamps. Based on this, three global compensation parameters are calculated: compensation parameters are obtained for DC bias, amplitude mismatch, and phase mismatch in channels A and B. Subsequently, the compensation parameters are written into the programmable signal conditioning chip via I²C. At the same time, the threshold and delay of the Z-channel comparator are fine-tuned to achieve zero-position synchronization calibration. After the hardware stabilizes, the test is repeated and iterated a maximum of two times. One global correction eliminates system offset, gain, and phase imbalance to the greatest extent, while zero-position fine-tuning ensures reference accuracy. The two work together to significantly improve the absolute accuracy and stability of the encoder feedback. The monitoring and adjustment module is used to retrieve compensation events within the past 7 days. If no compensation event is found, the monitoring period is set to the maximum allowable value Fmax. If compensation is performed once, the monitoring period is set to the interval since the last compensation and limited to [Fmin, Fmax]. If compensation is performed twice or more, the shortest adjacent interval is selected as the suggested period and limited in the same way. The generated new monitoring command is returned to the signal acquisition module to achieve adaptive closed-loop scheduling. In summary, the five modules are closely connected and form a closed loop, constructing a high-precision, anti-interference, and intelligent gear encoder error correction system that integrates signal acquisition, cleaning, discrimination, correction, and adaptive scheduling.
[0066] To improve the accuracy and robustness of the gear encoder signal error correction system, this invention establishes a multi-dimensional, complementary and collaborative threshold setting system based on signal quality judgment and error identification mechanisms. This system focuses on the error types that are prone to occur in signal acquisition and analysis, and sets six core thresholds from the aspects of frequency domain characteristics, time domain consistency, and angle characteristics. This ensures that the compensation criteria are neither too strict, leading to false positives, nor too lenient, leading to false negatives. The setting of each threshold follows the collaborative design concept of core objective—failure consequences—design principles. The specific principles are as follows: 1. High-frequency threshold (5%): The core objective of setting this threshold is to suppress electromagnetic interference and prevent high-frequency noise from polluting the encoder's sine and cosine signals. If the proportion of high-frequency energy is too high, it may cause false compensation or signal distortion. Therefore, the value is determined empirically based on the critical point of the signal-to-noise ratio. In industrial settings, frequency components that are more than 5 times the fundamental frequency are usually considered interference. Setting a 5% threshold is just the upper limit of tolerance for high-frequency pollution in the signal energy. 2. Distance threshold (0.05V): This threshold is used to determine the closure of the Lissajous curve. The core purpose is to ensure the integrity of the periodic data. If the deviation at the beginning and end is too large, it will cause problems such as jumps in speed calculation. The value is taken into account the superposition range of mechanical tolerance and electrical error. Combined with the amplitude of the standard 5V analog signal, 0.05V is equivalent to a 1% error tolerance, which can both identify the broken period and tolerate small jitter. 3. Minimum pulse width threshold (5μs): This threshold is set to filter out narrow pulse noise caused by electromagnetic interference, cable reflection, etc., and to avoid false triggering of the Z signal. Based on the statistical pulse width distribution analysis of interference pulses, pulses within 5μs are mostly abnormal signals, and the system sampling frequency range is sufficient to ensure adequate detection accuracy at this threshold; 4. Speed fluctuation threshold (1%): This threshold is used to monitor the dynamic stability of encoder feedback. The core objective is to warn of early faults in the mechanical system, such as shaft loosening, tooth difference, etc. If the speed fluctuation is too large, it will directly lead to instability of the servo system control loop. Therefore, 1% is used as an empirical threshold for the stability boundary of the servo system, which can accurately capture non-stationary working conditions without damaging normal operation; 5. Zero position deviation threshold (2°): This threshold is used to measure the consistency of the Z pulse in each revolution position, ensuring the reliability of the zero position as a mechanical reference and preventing cumulative positioning drift. Its setting is based on the superposition tolerance of installation tolerance and electrical phase shift. In high-precision scenarios, 2° is usually used as the dividing line. Exceeding this threshold may produce cumulative errors; 6. Linearity threshold (2°): Used to judge the degree of agreement between the feedback angle and the ideal uniform motion. The core objective is to maintain the uniformity of the angle increment. Excessive linear deviation can cause position loop oscillation or angle distortion. This threshold is set comprehensively based on gear machining accuracy error, signal processing system tolerance, and control strategy redundancy capability. 2° is considered the identification limit for linear distortion of feedback signal.In summary, each threshold not only independently controls specific signal quality indicators, but also forms a complementary linkage mechanism in the overall design: the high-frequency threshold controls frequency domain noise, the distance and pulse width thresholds ensure the integrity of the time domain structure, and the fluctuation, zero position, and linearity thresholds focus on phase accuracy and feedback consistency. Together, they construct a scalable, adjustable error judgment and compensation standard system with good field adaptability. This system significantly enhances the anti-interference capability of signal analysis and the accuracy of compensation decisions, providing a solid guarantee for the long-term reliable operation of the gear encoder feedback system in complex industrial environments.
[0067] Furthermore, to better illustrate the technical solution of the embodiments of the present invention, based on the above-mentioned gear encoder signal error correction system, such as... Figure 2 As shown, this embodiment of the invention provides a method for correcting signal errors in a gear encoder, specifically including the following steps:
[0068] Step 1, Signal Acquisition: Upon receiving the compensation monitoring command (timed trigger or manual trigger), where timed trigger is dynamically scheduled by the host computer scheduler, and manual trigger is manually triggered by the host computer's user interface; the differential receiving circuit channel is activated to convert the encoder A-phase differential signal, B-phase differential signal, and Z-phase zero-position reference signal into single-ended signals; the three raw signals are acquired simultaneously, with a duration covering ≥10 complete tooth cycles; after acquisition, the acquired raw data is stored in a circular buffer;
[0069] Through a compensation monitoring command mechanism that can be triggered automatically or manually, the gear encoder signal can be inspected automatically and periodically during daily operation. Engineers can also intervene quickly when needed to achieve flexible fault response. The differential receiving circuit converts the three original differential signals A, B, and Z into single-ended signals and performs synchronous high-precision sampling with a length of at least 10 complete gear cycles. This not only improves the signal's noise immunity but also ensures that sufficient periodic information can be obtained for each monitoring, laying a solid data foundation for subsequent multi-dimensional analysis such as frequency domain and phase.
[0070] Step 2, Signal quality assessment and screening:
[0071] 2-1. Obtain the encoder signal fundamental frequency f0, which is defined as one complete sine or cosine cycle appearing in the waveform for each tooth of the gear per revolution. Its frequency is determined by the rotational speed: f0 = rotational speed (unit: revolutions / second) × number of teeth; a frequency greater than (N... f The signal component of ×f0) is the high-frequency component, where N f =5, N fThe frequency harmonic coefficient is used to determine high-frequency components. This value is an adjustable parameter and can be increased or decreased appropriately according to the noise characteristics at the site. In this technical field, technicians usually consider components with frequencies higher than 5 times the fundamental frequency as high-frequency noise. The discrete waveform (sine wave and cosine wave) is divided into overlapping window segments of length L. A set of frequency domain coefficients is obtained after performing a discrete Fourier transform on each overlapping window segment, along with the amplitude of each frequency domain coefficient. The overlapping part of each window is taken as 50%. All amplitudes are squared and summed, that is, the power of all spectral points is added together to obtain the total energy of the signal in the entire sampling window. The spectral parameters of each overlapping window segment are extracted. The specific spectral parameters include the sampling rate (i.e., the frequency corresponding to the spectral line) and the length L (i.e., the number of FFT points). In the same Fourier transform, each spectral line corresponds to a frequency, which is greater than (N). f The signal components of ×f0) are high-frequency components. The squares of the amplitudes of the high-frequency components are taken and summed to obtain the sum of the energy in the high-frequency band, which is marked as high-frequency energy. The high-frequency energy is then divided by the total energy in the entire sampling window to obtain the high-frequency energy ratio. A high-frequency threshold is preset and set to 5%. If the high-frequency energy ratio of the sine wave or cosine wave in the overlapping window segment at the same time is greater than or equal to the high-frequency threshold, the signal data of this overlapping window segment is determined to be severely noisy and is removed. If the high-frequency energy ratio of the sine wave and cosine wave in the overlapping window segment at the same time is less than the high-frequency threshold, the signal data of this overlapping window segment is retained and 2-2 is executed.
[0072] 2-2. Based on the overlapping window signal data retained in step 2-1, plot the Lissajous curve, where the numerical value of A within the overlapping window is used as the horizontal axis and the numerical value of B is used as the vertical axis. Extract the coordinates of the first and last points from the Lissajous curve, where the coordinates of the first point are (x0, y0) and the coordinates of the last point are (xN, yN). Then, use the formula... Calculate the closure distance d between the first and last points, where N represents the index of the last point in the Lissajous curve, i.e., the tail point index. The unit of the closure distance is volts. Set a distance threshold (0.05 volts). If the closure distance d ≥ the distance threshold, the curve closure is considered unsuccessful, and the signal data of this window segment is discarded. If the closure distance d < the distance threshold, the curve closure is considered successful, and the signal data of this overlapping window segment is retained, and steps 2-3 are executed. It should be noted that ideally, the A and B sine and cosine signals complete a full sine and cosine cycle within an integer tooth period. Therefore, the Lissajous curve composed of the A and B sine and cosine signals should describe a closed loop on the plane, i.e., connected end-to-end without jumps or breaks. Otherwise, it indicates that the A and B waveforms have not completed an integer period or there are abrupt changes. Reasons for this include: insufficient sampling time for an integer period, window boundary cutting at the midpoint of the period, signal loss or abrupt changes within the window, and asynchronous A / B sampling. Therefore, these signals are discarded.
[0073] 2-3, Based on the signal data of the stacked window segment retained in step 2-3, the validity of the zero-position pulse is verified, specifically as follows:
[0074] Pulse Count Detection: Extract the number of teeth from the gear encoder. The number of pulses M detected by the Z channel within the sampling window should satisfy: MM = k × number of teeth, where k is the subdivision factor, i.e., in A / B square wave mode, the ratio between the number of pulses after subdivision of the A / B phase signals per tooth rotation and the original number of teeth. No subdivision mode means that only one pulse is generated at one edge (rising or falling edge) of phase A or B, so one zero-position pulse is generated per tooth rotation. In this case, k = 1, M = 1 × number of teeth = number of teeth. In 2x subdivision mode: a zero-position pulse is triggered once at one edge of both phase A and B (or at the rising and falling edges of phase A), generating 2 pulses per tooth rotation. In this case, k = 2, M = 2 × number of teeth. In 4x subdivision mode: a zero-position pulse is triggered once at the rising and falling edges of both phase A and B, generating 4 pulses per tooth rotation. In this case, k = 4, M = 4 × number of teeth; therefore, k = 2. n Where n=0,1,2,3……; count the number of pulses within the overlapping window. If the number of pulses ≠ k×number of teeth, then the number of pulses is deemed insufficient, and the signal data of this overlapping window is removed; otherwise, the signal data of the overlapping window is retained, and pulse width detection is performed.
[0075] Pulse width detection: For the i-th pulse, record the rising edge index. Falling edge index According to the formula Calculate pulse width Δm i ;where f sThe sampling frequency is set; a minimum pulse width threshold Tmin = 5μs is set. If either pulse width Δm of A or B within the overlapping window... i If the pulse interval is less than Tmin, the pulse is considered too narrow, and the signal data of this overlapping window segment is discarded; otherwise, the pulse interval consistency check continues.
[0076] Pulse width consistency detection: The actual pulse interval Δt is calculated by taking the time interval between two adjacent rising edges. Actual pulse interval = the difference between the indices of two adjacent rising edges, and then dividing it by the sampling frequency f. s The theoretical interval should be equal to the duration of a single tooth cycle at the sampling point. The specific derivation process is as follows: f0 = rotational speed (unit: revolutions per second) × number of teeth. The theoretical pulse interval is: Substituting f0 = rotational speed (unit: revolutions per second) × number of teeth into the calculation of the theoretical pulse interval, we can obtain: theoretical pulse interval = 1 / (rotational speed × number of teeth); calculate the difference between the actual pulse interval and the theoretical pulse interval and take the absolute value to obtain the interval deviation. A maximum allowable deviation is set, with a value of 0.05; if any interval deviation within the overlapping window is greater than the maximum allowable deviation, it is judged that the intervals are inconsistent, and the signal data of this overlapping window is discarded; otherwise, the signal quality is judged to be qualified. Therefore, only when the number of pulses, pulse width, and pulse interval are all qualified are the Z channel signal of this window segment determined to be valid, and only then can it be used in conjunction with the A / B waveform for subsequent error analysis;
[0077] It should be noted that each overlapping window segment contains three signal data: A, B, and Z. Signals A and B are used for Lissajous curves, Fourier analysis, and narrowband noise removal; signal Z is used for consistency judgment of the number of zero-position pulses, pulse width, and pulse interval. Only when all three signals pass their respective quality checks (2-1 high-frequency noise, 2-2 curve closure verification, 2-3 Z pulse validity) within the same window segment is the signal quality of that window segment considered qualified, and it can proceed to the subsequent error quantization and correction steps. If any signal fails to meet the standard in that segment, the data of the entire segment is discarded to ensure that distorted or incomplete information is not mixed into subsequent calculations. This can minimize the impact of dirty data on error quantization and compensation strategies, and improve the reliability and stability of the entire correction system.
[0078] Through rigorous quality assessment and segmented screening, dirty data containing high-frequency noise, half-cycle truncation, and zero-position pulse distortion are eliminated at the earliest stage, fundamentally avoiding the misleading influence of abnormal sampling on subsequent compensation calculations. The high-frequency energy ratio detection in 2-1 eliminates intense noise interference, the Lissajous curve closure judgment in 2-2 eliminates incomplete period and abrupt segmentation, and the three Z signal detections (quantity, width, and interval) in 2-3 ensure the timing accuracy of the zero-position reference. The 50% overlapping window segment strategy further balances continuity and robustness, ensuring that even if individual window segments are eliminated, the overall data can be smoothly spliced together, guaranteeing that the data entering the error quantification analysis is always of high quality and reliable.
[0079] Step 3, Error Judgment;
[0080] 3-1, Speed Judgment:
[0081] The digital sequences of phase A and phase B in the overlapping window segment selected and retained after the signal quality detection in step two are denoted as A. j and B j Where j represents the sampling point index within the overlapping window segment; for each sampling point j in the sequence, the current B-phase voltage and A-phase voltage are combined, and the two-parameter arctangent function is called to obtain an angle value, i.e., the instantaneous phase φ. j The two-parameter arctangent function is: This involves converting the sine and cosine voltages into an angle value for subsequent analysis of speed, linearity, etc.; the instantaneous phase represents the actual mechanical angle of the gear encoder at that moment.
[0082] The instantaneous angular velocity w at the current moment is obtained by multiplying the point difference by the sampling rate (i.e., starting from the second sampling point, subtracting the phase of the previous sampling point from the current phase, and then multiplying by the sampling rate). j This reflects the rate of change of the mechanical angle between two samples, equivalent to a discretized expression of the actual rotational speed; instantaneous angular velocity w j The calculation formula is: ;
[0083] Calculate the average and standard deviation of all instantaneous angular velocities within this overlapping window segment. The average represents the overall rotational speed of the gear encoder within this window, and the standard deviation describes the jitter or fluctuation amplitude of the speed within this window. Then, divide the standard deviation of the instantaneous angular velocity by the average of the instantaneous angular velocities to obtain the speed fluctuation ratio. The larger the value, the more unstable the rotational speed or signal. A fluctuation threshold is preset (taken as a percentage: 1%). If the speed fluctuation ratio within any overlapping window segment is greater than or equal to the fluctuation threshold, the speed fluctuation is determined to be too large, indicating that there is an abnormality in the encoder feedback or mechanical movement, and the correction stage needs to be entered; otherwise, the speed is determined to be normal.
[0084] 3-2, Zero-digit repeatability judgment:
[0085] In the Z-phase signal, each rising edge pulse is detected by comparing the levels of the preceding and following sampling points (from low to high), and the index position of the recorder in the sampling sequence is recorded. Each index corresponds to the previously calculated instantaneous phase. For each pulse, its corresponding instantaneous angular velocity in the phase sequence is taken, and the difference between it and the ideal zero-position phase (usually 0° or equivalent 360°) is calculated to obtain a preliminary deviation value. To prevent errors caused by crossing the 0° boundary, the preliminary deviation value is calculated by differencing 0° and 360° respectively to obtain two differences, and the smaller one is taken as the zero-position deviation, which reflects the zero position. The repeatability and stability of the pulse are improved. It should be noted that, based on the calculation method of the initial deviation value, the initial deviation value is an angle between 0° and +360°. The difference between the initial deviation value and 0° represents how many degrees the pulse has deviated from its starting point if 0° is taken as the starting point. Because the phase is a ring (360° period), if the pulse phase is close to 360°, then its ring distance from 0° can be considered shorter. This distance is 360° minus the initial deviation value. Through this ring-shaped difference method, the actual deviation of each zero-position pulse can be accurately and unambiguously measured.
[0086] The minimum zero-position deviation is selected from the zero-position deviations corresponding to each pulse in the same overlapping window segment as the zero-position deviation of this overlapping window segment. A zero-position deviation threshold is preset (with a value of 2°). If the zero-position deviation of any overlapping window segment is greater than or equal to the zero-position deviation threshold, it is judged that there is zero-position drift, indicating that the zero-position markings of each revolution are inconsistent and there is cumulative phase drift, which needs to be corrected; otherwise, the zero-position repeatability is judged to be qualified.
[0087] 3-3, Linearity Judgment:
[0088] Ideal linear relationship: Assume that the mechanical shaft should rotate 360 degrees at a constant speed within one complete tooth cycle. If we start sampling from time 0°, then theoretically the ideal angle corresponding to the j-th sampling point should be θ. j =j / (number of sampling points - 1);
[0089] Extract the instantaneous phase φ at each sampling point j The residual sequence e is obtained by successively calculating the difference between it and the corresponding ideal angle. jSince phase is a periodic quantity, the residuals should first undergo a ring-shaped processing (taking the minimum ring angle difference). Specifically, each residual in the residual sequence is added to 180°, then modulo 360° (i.e., divided by 360° and taking the remainder) to obtain a value within [0°, 360°). Finally, 180° is subtracted. This ensures that the ring-shaped residual sequence obtains the shortest and most unambiguous phase difference value in the interval [−180°, +180°), which is used for subsequent linearity residual calculation and determination. The residuals at each sampling point within the overlapping window segment are taken, and the largest residual is taken as the linearity of this overlapping window segment. A preset linearity is used. The linearity threshold (valued at 2°) is used to determine linear deviation. If the linearity of any overlapping window segment is greater than or equal to the linearity threshold, the signal is considered to be non-linear, indicating significant distortion and requiring correction. Otherwise, the linearity is considered to be acceptable, meaning that the output of the gear encoder is almost exactly equal to the mechanical rotation in terms of angular increments, which is very friendly to motion control. It should be noted that in gear encoder signal correction, linearity usually refers to the degree of match between the feedback phase (or angle) and the actual mechanical angle, that is, whether the encoder output signal can reflect the actual rotation of the shaft according to the expected uniform angular increments.
[0090] 3-4, Comprehensive judgment:
[0091] Summarize the velocity fluctuation ratio, zero-point deviation, and linearity of each overlapping window segment. If any one of these exceeds the corresponding threshold (i.e., there is any one of excessive velocity fluctuation, zero-point drift, or linear deviation), it is determined that the feedback signal of this window has an error and needs to be corrected. That is, an error correction instruction is generated and sent to step four; otherwise, the compensation is skipped and step five is executed.
[0092] By jointly judging three major indicators—speed fluctuation, zero-position repeatability, and linearity—the health status of the encoder signal is comprehensively measured from three perspectives: dynamic jitter, reference consistency, and full-cycle output. The fluctuation ratio of instantaneous angular velocity directly reflects the jitter degree of mechanical motion and electrical feedback. Zero-position deviation quantifies the consistency of the reference pulse per revolution. Linearity residual assesses the distortion amplitude of the feedback phase relative to the ideal uniform motion. As long as any indicator exceeds the limit, a correction command can be triggered in time, avoiding the problems of overgeneralization or over- or over-delayed compensation, and realizing accurate capture and timely response to signal errors.
[0093] Step 4: Error Correction Execution
[0094] 4-1. The signal data from each overlapping window segment detected in step two are merged into a single signal data segment according to their inherent timestamps. For the merged signal data, the average voltage of phase A and phase B is calculated, and then compared with the ideal center level of 2.5V to obtain the DC compensation value λ. The calculation formula is as follows: ,in , These are the average voltage values for phase A and phase B, respectively.
[0095] 4-2. Based on the merged signal data, draw sine and cosine waveforms, and take the peak-to-valley value A of the waveform. pp and B pp The amplitude compensation value α is obtained by dividing the cosine peak-to-valley value by the sine peak-to-valley value. The specific calculation formula is as follows: ;
[0096] 4-3. Based on the merged signal data, plot the AB relationship curve to obtain the Lissajous curve, where the digital value of phase A is the horizontal axis and the digital value of phase B is the vertical axis; fit an ellipse based on the Lissajous curve and calculate its ellipse tilt angle, then subtract the ellipse tilt angle from 45° to obtain the phase compensation value β.
[0097] 4-4. Write the three compensation parameters mentioned above into the register of the gear encoder processing chip. The three compensation parameters are the DC compensation value, amplitude compensation value, and phase compensation value. At the same time, perform zero-position calibration on the Z channel to ensure that the zero-position pulse edge is synchronized with the phase of the A and B waveforms. After writing the compensation parameters, wait for a short stabilization period (10ms) to allow the analog path to complete the filtering, amplification, and phase shifting processes. After the stabilization period, regenerate the compensation monitoring command for compensation verification and send it to step one for iteration. This continues until compensation is successful (i.e., no more error correction commands are generated, i.e., all errors are corrected). Key error indicators are all below the threshold) or the maximum number of iterations is reached (the maximum number of iterations is set to 2). Therefore, the compensation results include successful compensation and failed compensation. Successful compensation means that after the compensation parameters are issued, the compensation verification is performed again and there is no error, that is, the speed fluctuation ratio, zero deviation, and linearity residual all drop to within the corresponding threshold. Failed compensation means that after the compensation parameters are issued, the compensation verification is performed again and there is still an error, that is, one or more of the speed fluctuation ratio, zero deviation, and linearity residual exceed the corresponding threshold. Each compensation event is recorded, and the compensation event includes the compensation time, compensation parameters, and compensation result.
[0098] By seamlessly stitching together all qualified window segments according to timestamps, and calculating global DC bias, amplitude gain, and phase calibration compensation values based on the entire data segment, the system offset and mismatch within the entire monitoring range can be corrected macroscopically in one go. At the same time, through the zero-position synchronization calibration mechanism, hardware-level precise alignment of the Z pulse edge with the A and B waveforms with zero crossover is achieved, ensuring absolute synchronization between the zero-position reference and the analog sine and cosine signals. The strategy of stable delay and a maximum of two iterations not only provides sufficient response time for the analog path but also avoids invalid and redundant operations, making the compensation process efficient and reliable. The clear criteria for determining successful or failed compensation also provide a clear basis for subsequent operation statistics and strategy optimization.
[0099] Step 5: Retrieve compensation events from the past 7 days (the 7 days here is set by those skilled in the art based on actual conditions and monitoring needs, and can be manually fine-tuned). If there are no compensation events, the monitoring period is taken as the baseline monitoring period (the baseline monitoring period is the maximum allowable monitoring period Fmax set by those skilled in the art). A new compensation monitoring instruction is generated according to the baseline monitoring period and updated to Step 1. At the same time, those skilled in the art also set the minimum allowable monitoring period Fmin.
[0100] If a compensation event exists within 7, extract the compensation event of the compensation event and calculate the interval since the current time vertically. Use this interval as the initial value for the next monitoring cycle. If the initial value is greater than or equal to Fmax, the monitoring cycle is set to Fmax. If the initial value is less than or equal to Fmin, the monitoring cycle is set to Fmin. If Fmin is less than the initial value and less than Fmax, the monitoring cycle is set to the initial value. Generate a new compensation monitoring instruction according to the value of the monitoring cycle and update it to step one.
[0101] If there are two or more compensation events within 7 days, sort the compensation events according to their order, calculate the compensation interval between two adjacent compensation events, and select the smallest compensation interval as the suggested monitoring period. If the suggested monitoring period is ≥ Fmax, then the monitoring period is Fmax; if the suggested monitoring period is ≤ Fmin, then the monitoring period is Fmin; if Fmin < suggested monitoring period < Fmax, then the monitoring period is the suggested monitoring period. Generate a new compensation monitoring instruction based on the monitoring period and update it to step one.
[0102] By retrieving historical compensation events from the past 7 days and adaptively calculating the next monitoring cycle in combination with three compensation frequency scenarios, intelligent scheduling of monitoring frequency is achieved: the monitoring cycle is automatically lengthened when the situation is stable for a long period, saving computing and communication resources; monitoring is triggered at actual intervals after the first drift occurs, quickly capturing new errors; and the monitoring is followed at the most closely during frequent drifts, allowing for timely intervention; at the same time, the amplitude is strictly limited within the preset minimum and maximum monitoring cycle range, balancing real-time performance and resource efficiency. This adaptive strategy ensures that error correction monitoring is both timely and not excessive, significantly improving the intelligence and long-term reliability of error correction.
[0103] In the description of this specification, references to terms such as "an embodiment," "example," "specific example," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0104] The preferred embodiments of the invention disclosed above are merely illustrative of the invention. These preferred embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this specification. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the invention, thereby enabling those skilled in the art to better understand and utilize the invention.
Claims
1. A gear encoder signal error correction system, characterized in that, The correction system includes: The signal acquisition module, based on the error monitoring command, enables the differential receiving circuit channel to convert the gear encoder A-phase differential signal, B-phase differential signal and Z-phase zero-position reference signal into single-ended signals, and simultaneously acquires the above three signals to obtain signal data; The judgment and screening module segments the collected signal data and performs a three-level signal quality screening on each segment. The three-level signal quality screening includes high-frequency noise removal, Lissajous curve closure verification, and Z pulse validity detection. The signal data is retained only when all three signals, A, B, and Z, meet the standards within the same segment. The error analysis module performs error analysis on the retained signal data after filtering to generate error indicators. If any indicator exceeds the threshold, a correction command is generated; otherwise, the error correction module is skipped and the monitoring and adjustment module is executed directly. The error indicators include speed fluctuation ratio, zero-point deviation, and linearity. The error correction module merges each segment of signal data after filtering to form a complete segment of signal data. It calculates the DC, amplitude, and phase compensation values based on the complete segment of signal data to obtain compensation parameters, writes them into a register, synchronously calibrates the phase of the Z pulse with the A and B waveforms, iteratively verifies the compensation effect, and records compensation events. The monitoring and adjustment module dynamically adjusts the monitoring cycle based on the compensation events within the most recent fixed time period, and generates the next correction monitoring instruction according to the monitoring cycle, and updates it to the signal acquisition module.
2. The gear encoder signal error correction system according to claim 1, characterized in that, Segmentation based on the collected signal data: Obtain the encoder signal fundamental frequency f0, which is defined as the appearance of one complete sine or cosine cycle in the waveform for each tooth of the gear during rotation. Its frequency is determined by the rotation speed: f0 = rotation speed × number of teeth; The sine wave and cosine wave are divided into overlapping window segments of length L. A set of frequency domain coefficients and the amplitude of each frequency domain coefficient are obtained by performing a discrete Fourier transform on each overlapping window segment. The overlapping part of each window is 50%.
3. The gear encoder signal error correction system according to claim 2, characterized in that, High-frequency noise removal: Extract the fundamental frequency f0, whose frequency is determined by the rotational speed: f0 = rotational speed × number of teeth; define a frequency greater than (N f The signal component of ×f0) is a high-frequency component, N f The harmonic coefficients for determining high-frequency components; The total energy of the signal within the entire overlapping window segment is obtained by summing the squares of all amplitudes within the overlapping window segment. Spectral line parameters for each overlapping window segment are extracted, including sampling rate and length L. In the same Fourier transform, each spectral line corresponds to a frequency, taking values greater than (N...). f The signal components of ×f0) are high-frequency components. The square of the amplitude of each high-frequency component is taken and summed to obtain the sum of the energy in the high-frequency band, which is then marked as high-frequency energy. The high-frequency energy is then divided by the total energy in the entire sampling window to obtain the proportion of high-frequency energy. A preset high-frequency threshold is set. If the proportion of high-frequency energy of sine or cosine waves in the same overlapping window segment is greater than or equal to the high-frequency threshold, the signal data of this overlapping window segment is determined to be severely noisy and is removed. If the proportion of high-frequency energy of sine and cosine waves in the overlapping window segment at the same time is less than the high-frequency threshold, the signal data of this overlapping window segment is retained and Lissajous curve closure verification is performed.
4. The gear encoder signal error correction system according to claim 3, characterized in that, Lissajous curve closure verification: Lissajous curves are plotted based on the overlapping window signal data retained after high-frequency noise removal, where the A digital value within the overlapping window is used as the horizontal axis and the B digital value is used as the vertical axis to construct the Lissajous curve; the coordinates of the first and last points are extracted from the Lissajous curve, and the closed distance d between the first and last points is calculated according to the two-dimensional Euclidean geometric distance formula, where N represents the index of the last point in the Lissajous curve, i.e., the tail point index. Set a distance threshold. If the closing distance d ≥ the distance threshold, the curve closure is deemed unsuccessful, and the signal data of this window segment is discarded. If the closing distance d < the distance threshold, the curve closure is deemed successful, and the signal data of this overlapping window segment is retained, and Z-pulse validity detection is performed.
5. A gear encoder signal error correction system according to claim 4, characterized in that, Z-pulse validity detection: 2-3-1, Pulse Count Detection: Extract the number of teeth of the gear encoder. The number of pulses M detected by the Z channel within the overlapping window segment should satisfy: M = k × number of teeth, where k is the subdivision factor, k = 2. n , where n=0,1,2,3……; count the number of pulses in the overlapping window. If the number of pulses ≠ k×number of teeth, then the number of pulses does not meet the requirement, and the signal data of this overlapping window is removed; otherwise, the signal data of the overlapping window is retained, and 2-3-2 is executed. 2-3-2, Pulse Width Detection: For the i-th pulse, record the rising edge index. Falling edge index According to the formula Calculate pulse width Δm i ;where f s The sampling frequency is set; a minimum pulse width threshold Tmin is set, if any pulse width Δm of A or B within the overlapping window... i If the pulse is less than Tmin, the pulse is considered too narrow, and the signal data in this overlapping window segment is discarded; otherwise, continue executing 2-3-3. 2-3-3, Pulse Width Consistency Detection: The actual pulse interval Δt is calculated by taking the time interval between two adjacent rising edges: Actual pulse interval = (Index of two adjacent rising edges) / (Differentiation of the difference between the indices of the two rising edges) / (Sampling frequency f). s The theoretical interval should be equal to the duration of a single tooth cycle at the sampling point. The interval deviation is obtained by calculating the difference between the actual pulse interval and the theoretical pulse interval and taking the absolute value. A maximum allowable deviation is set. If any interval deviation in the overlapping window is greater than the maximum allowable deviation, the interval is judged to be inconsistent and the signal data in this overlapping window is removed; otherwise, the signal quality is judged to be qualified.
6. A gear encoder signal error correction system according to claim 5, characterized in that, Error analysis: 3-1, Speed Judgment: Calculate the instantaneous phase of the A and B phase voltages at each sampling point using atan2, then convert the instantaneous angular velocity using differential and sampling rate conversion. Calculate the average and standard deviation of the angular velocity within the window segment and calculate the speed fluctuation ratio. If the speed fluctuation ratio is greater than or equal to the fluctuation threshold, the speed fluctuation is judged to be too large; otherwise, the speed is judged to be normal. 3-2, Zero-position repeatability judgment: Detect the phase corresponding to the rising edge of the Z pulse, and use the ring difference method to calculate the minimum angular deviation between it and the theoretical zero position as the zero-position deviation. If it exceeds the zero-position deviation threshold, it is judged as zero-position drift; otherwise, the zero-position repeatability is judged as qualified. 3-3, Linearity judgment: Subtract the corresponding ideal angle of uniform velocity from the actual instantaneous phase of each sampling point and perform a circular processing to obtain the residual sequence. Take the maximum absolute residual and compare it with the linearity threshold. If it exceeds the limit, it is judged as linear deviation; otherwise, the linearity is qualified. 3-4. Comprehensive judgment: Summarize the speed fluctuation ratio, zero deviation and linearity of each overlapping window segment. If any one of them exceeds the corresponding threshold, an error correction instruction is generated and sent to the error correction module; otherwise, the compensation is skipped and the monitoring and adjustment module is executed.
7. A gear encoder signal error correction system according to claim 6, characterized in that, Zero-point deviation calculation process: In the Z-phase signal, each rising edge pulse is detected by comparing the levels of the preceding and following sampling points, and its index position in the sampling sequence is recorded. Each index corresponds to an instantaneous phase. For each pulse, the instantaneous angular velocity corresponding to it in the phase sequence is taken, and the difference between it and the ideal zero-position phase is calculated to obtain a preliminary deviation value. To prevent errors caused by crossing the 0° boundary, the preliminary deviation value is calculated by differentiating it from 0° and 360° respectively to obtain two differences. The smaller of the two is taken as the zero-position deviation, which reflects the repeatability and stability of the zero position. The smallest zero-position deviation is selected from the zero-position deviations corresponding to each pulse in the same overlapping window segment as the zero-position deviation of this overlapping window segment.
8. A gear encoder signal error correction system according to claim 7, characterized in that, The process of obtaining compensation parameters: 4-1. The signal data of each overlapping window segment are merged into a single signal data segment according to their own timestamps. For the merged signal data, the average voltage of phase A and phase B is calculated, and then the DC compensation value λ is calculated by comparing it with the ideal center level of 2.5V. The calculation formula is as follows: ,in , These are the average voltage values for phase A and phase B, respectively. 4-2. Based on the merged signal data, draw sine and cosine waveforms, and take the peak-to-valley value A of the waveform. pp and B pp The amplitude compensation value α is obtained by dividing the cosine peak-to-valley value by the sine peak-to-valley value. The specific calculation formula is as follows: ; 4-3. Based on the merged signal data, plot the AB relationship curve to obtain the Lissajous curve, where the digital value of phase A is the horizontal axis and the digital value of phase B is the vertical axis; fit an ellipse based on the Lissajous curve and calculate its ellipse tilt angle, then subtract the ellipse tilt angle from 45° to obtain the phase compensation value β. 4-4. Write the above three compensation parameters into the register of the gear encoder processing chip. The three compensation parameters are DC compensation value, amplitude compensation value and phase compensation value. At the same time, perform zero-position calibration on the Z channel to ensure that the zero-position pulse edge is synchronized with the phase of the A and B waveforms. After the compensation parameters are written, wait for a short stabilization period. After the stabilization period ends, regenerate the compensation monitoring command to verify the compensation and send it to step one for iteration until the compensation is successful or the maximum number of iterations is reached. Record each compensation event, which includes the compensation time, compensation parameters, and compensation result.
9. A gear encoder signal error correction system according to claim 8, characterized in that, Dynamically adjust the monitoring cycle: The system retrieves compensation events within a fixed number of days. If no compensation events are found, the monitoring period is taken as the baseline monitoring period. A new compensation monitoring instruction is generated according to the baseline monitoring period and updated to the signal acquisition module. The baseline monitoring period is the maximum allowable monitoring period Fmax, and those skilled in the art also set a minimum allowable monitoring period Fmin. If a compensation event exists, the compensation event of the compensation event is extracted, and the interval since the current time is calculated vertically. This interval is then used as the initial value for the next monitoring cycle. If the initial value is greater than or equal to Fmax, the monitoring cycle is set to Fmax. If the initial value is less than or equal to Fmin, the monitoring cycle is set to Fmin. If Fmin is less than the initial value and less than Fmax, the monitoring cycle is set to the initial value. A new compensation monitoring instruction is generated according to the value of the monitoring cycle and updated to the signal acquisition module. If there are two or more compensation events, sort the compensation events in order of their corresponding order, calculate the compensation interval between two adjacent compensation events, and select the smallest compensation interval as the suggested monitoring period. If the suggested monitoring period is greater than or equal to Fmax, then the monitoring period is Fmax; if the suggested monitoring period is less than or equal to Fmin, then the monitoring period is Fmin; if Fmin is less than the suggested monitoring period and less than Fmax, then the monitoring period is the suggested monitoring period. Generate a new compensation monitoring instruction based on the monitoring period and update it to the signal acquisition module.
10. A method for correcting signal errors in a gear encoder, wherein the method is applied to the gear encoder signal error correction system as described in any one of claims 1-9, characterized in that, Includes the following steps: Step 1: Based on the received error monitoring command, the differential receiving circuit channel is activated to convert the encoder A-phase differential signal, B-phase differential signal and Z-phase zero-position reference signal into single-ended signals, and the above three signals are collected simultaneously to obtain signal data; Step 2: The collected signal data is segmented, and a three-level signal quality screening is performed on each segment. The three-level signal quality screening includes high-frequency noise removal, Lissajous curve closure verification, and Z-pulse validity detection. Signal data is retained only when all three signals (A, B, and Z) meet the standards within the same segment. Step 3: Based on the retained signal data after filtering, perform error analysis to generate error indicators. If any indicator exceeds the threshold, a correction instruction is generated; otherwise, skip step 4 and proceed directly to step 5. The error indicators include velocity fluctuation ratio, zero-position deviation, and linearity. Step 4: Merge each segment of signal data after filtering to form a whole segment of signal data. Calculate the DC, amplitude, and phase compensation values based on the whole segment of signal data to obtain compensation parameters, and write them into a register. Simultaneously calibrate the phase of the Z pulse with the A and B waveforms, iteratively verify the compensation effect, and record the compensation events. Step 5: Dynamically adjust the monitoring cycle based on the compensation events within the most recent fixed time period, and generate the next corrective monitoring instruction according to the monitoring cycle, and update it to Step 1.
Citation Information
Patent Citations
Dynamic adjustment system of rotary encoder
CN118816966A
Error compensation device for encoder and the encoder
JP2007107886A