A gap detection method based on multiple optical couplers

By constructing an optical coupler state vector using a multi-optical coupler sensor array and performing jitter removal processing, combined with a confidence function, the shortcomings of traditional printer gap detection methods in terms of cost and response speed are solved, achieving efficient and accurate gap identification and real-time correction.

CN123111111APending Publication Date: 2026-11-17ZHUHAI XPRINTER ELECTRONICS TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611187645.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-06
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing printer gap detection methods struggle to strike a balance between cost and efficiency. Traditional single-optical-coupler detection has poor anti-interference capabilities and adaptability, while machine vision detection is expensive and has a slow response time, making it difficult to meet the demands of high-speed printing.

Method used

A spatial array of multiple optical couplers is constructed. Gap is determined and edge morphology data is acquired through combinational logic. Optical coupler state vectors are constructed and jitter is removed. A confidence function is introduced to accurately identify the actual gap. It is suitable for linear, cross, and grid array layouts.

Benefits of technology

It improves gap recognition capability and accuracy, reduces development costs, adapts to different paper sizes and operating speeds, is suitable for high-speed printers, and provides real-time correction data to improve the accuracy of subsequent processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123111111A_ABST
    Figure CN123111111A_ABST
Patent Text Reader

Abstract

This invention provides a gap detection method based on multiple optical couplers, comprising setting an optical coupler array in the paper feed area of ​​a printer and constructing an optical coupler state vector; setting a scanning cycle, and acquiring the state values ​​of each optical coupler in the array in real time within the scanning cycle, updating the optical coupler state vector according to the state values ​​of each optical coupler; acquiring the optical coupler state vector over multiple consecutive scanning cycles, and determining whether a real gap exists based on the temporal changes of the optical coupler state vector; if a real gap exists, measuring the gap width and calculating the offset of the paper tail edge, and determining whether it is a valid gap based on the gap width; if it is a valid gap, outputting a corresponding compensation signal based on the offset of the paper tail edge to adjust the printing deviation. This invention uses a spatial array composed of multiple optical coupler sensors, and uses the combination logic of multiple optical couplers to determine the valid gap and acquire edge morphology data, thereby improving gap recognition capability and accuracy, as well as achieving high cost-effectiveness and rapid deployment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of printer technology, and more specifically to a gap detection method based on multiple optical couplers. Background Technology

[0002] In the field of printer technology, paper gap detection is a crucial step in ensuring paper feeding accuracy, preventing paper jams, and achieving precise alignment in subsequent processes such as cutting, folding, and binding. With increasing printing speeds and higher demands for automation, greater requirements are placed on the accuracy, real-time performance, and robustness of gap detection. Currently, the mainstream gap detection methods fall into two categories: a simple detection scheme based on a single optocoupler and a complex detection scheme based on machine vision. Both have significant limitations, making it difficult to balance cost, reliability, and functional completeness.

[0003] One detection scheme based on a single optocoupler determines the presence of a gap by detecting the level transition caused by paper obstructing the light path. While simple and inexpensive, this scheme has several drawbacks: First, it has extremely poor anti-interference capabilities. Local defects on the paper surface, such as stains, scratches, and holes, easily lead to misjudgments, treating non-gap signals as gaps, resulting in counting errors or equipment shutdowns. Second, a single optocoupler can only output two states: "paper present" or "paperless," completely failing to acquire morphological data of the gap edges. In subsequent processes requiring precise alignment, such as splicing in high-speed inkjet printing and positioning in post-printing processing, the lack of gap edge morphological data means dynamic compensation is impossible, severely impacting finished product quality. Furthermore, because the detection threshold of a single optocoupler is fixed, its adaptability is poor when dealing with paper of different thicknesses, colors, or transmittances, further increasing the risk of false alarms.

[0004] While machine vision-based inspection solutions can provide rich image information and achieve high-precision gap detection and edge analysis, they suffer from several drawbacks: First, they are costly and complex to deploy. A complete vision system typically includes an industrial camera, telecentric lens, dedicated light source, high-performance industrial computer, and expensive image processing software licenses, with an overall investment reaching tens of thousands of yuan or even higher. Second, image acquisition, transmission, and processing in vision systems are time-consuming, usually on the order of tens of milliseconds, making it difficult to meet the microsecond-level response requirements of high-speed continuous printing scenarios. Furthermore, vision systems are sensitive to changes in ambient lighting, requiring complex software debugging and light source calibration, making maintenance difficult and demanding a high level of technical expertise from operators. In mass production of low- to mid-range printers or multi-station collaborative operations, this high-cost, low-flexibility solution is often not economically feasible.

[0005] Therefore, there is an urgent need for a gap detection method that can balance cost and benefit, effectively identify gaps and extract gap edge morphology data, and has a fast response. Summary of the Invention

[0006] To address the problems existing in the prior art, this invention provides a gap detection method based on multiple optical couplers. This invention consists of a spatial array of multiple optical couplers, and uses the combination logic of multiple optical couplers to determine the effective gap and acquire edge morphology data, thereby improving the gap recognition capability and accuracy, as well as achieving high cost-effectiveness and rapid deployment.

[0007] The present invention achieves the above objectives through the following technical solutions: A gap detection method based on multiple optical couplers includes: An optical coupler array is set up in the paper feed area of ​​the printer, and the state variables of each optical coupler in the array are defined. An optical coupler state vector is constructed based on the state variables of each optical coupler.

[0008] Set a scanning period, and collect the state values ​​of each optocoupler in the optocoupler array in real time within the scanning period. Update the optocoupler state vector according to the state values ​​of each optocoupler.

[0009] The optical coupler state vector is obtained within multiple consecutive scanning cycles, and the existence of a real gap is determined based on the temporal changes of the optical coupler state vector.

[0010] If the actual gap exists, measure the gap width and calculate the offset of the paper tail edge, and determine whether it is an effective gap based on the gap width.

[0011] If it is the effective gap, a corresponding compensation signal is output according to the offset of the paper tail edge to adjust the printing deviation.

[0012] A further option is that the optical coupler array is a linear array, which is perpendicular to the paper feed direction and its center line coincides with the center line of the paper feed channel.

[0013] A further embodiment is that the optical coupler array adopts a cross array, which includes a first optical coupler array and a second optical coupler array, wherein the first optical coupler array is perpendicular to the normal of the paper feed direction. The second optical coupler array is arranged at an angle, with the normal to the paper feed direction at an angle. Arranged at an angle.

[0014] A further option is that the optical coupler array adopts a grid array, which includes a rectangular grid set in the paper feed channel, and an optical coupler pair is set at each grid point of the rectangular grid.

[0015] A further approach is to define the state variables as at least a paper-containing state and a gap state, using binary encoding to define the paper-containing state as 0 and the gap state as 1.

[0016] The optocoupler state vector is represented as follows:

[0017] Wherein, K is the number of optical couplers in the optical coupler array. This is used to identify the position of the optocoupler in the optocoupler array. , which is the state variable of the optocoupler.

[0018] A further approach is to perform jitter removal processing on the periodically acquired state values ​​of each optocoupler, including the following steps: Allocate a circular buffer for each optocoupler and initialize the circular buffer to all zeros.

[0019] During each scanning cycle, the status values ​​of each optocoupler in the optocoupler array are sequentially collected in real time and stored in a temporary array.

[0020] Write the temporary array into the circular buffer, and iterate through all elements in the current circular buffer to count the number of elements with a value of 1.

[0021] Set a jitter threshold. If the number of counts is greater than or equal to the jitter threshold, the current state value of the optocoupler is set to 1; otherwise, it is set to 0.

[0022] A further approach is that the step for determining the actual gap includes: The number of state variables with a value of 1 in the optical coupler state vector and their duration are counted. The lateral span threshold of the actual gap is set, and the minimum gap width threshold of the printer paper feed is obtained.

[0023] A lateral coverage index is created based on the statistical count and the lateral span threshold; a duration index is created based on the duration and the minimum gap width threshold; and a consistency index is created based on the time synchronization of the state changes of all optocouplers in the optocoupler array. The confidence function for the true gap is defined by combining the lateral coverage index, the duration index, and the consistency index.

[0024] Set a confidence threshold and use the confidence function to calculate the current confidence level. If the current confidence level is greater than the confidence threshold, it is determined to be the true gap.

[0025] A further approach is that the determination step for the effective gap includes: The paper feed speed of the printer is obtained, and the gap width is calculated based on the duration and the paper feed speed. The standard gap width threshold and the maximum gap width threshold of the printer are also obtained.

[0026] If the gap width is between the standard gap width threshold and the maximum gap width threshold, it is determined to be a valid gap.

[0027] If the gap width is greater than the maximum gap width threshold, it is determined to be a paper break or paper shortage, and a stop signal is triggered.

[0028] A further approach is that the calculation step for the offset of the paper tail edge includes: If the printer feeds paper vertically, all optical coupler positions located horizontally at the paper tail edge and their corresponding trigger timestamps are extracted and a set of data points is formed.

[0029] The data points are linearly fitted using the least squares method to obtain a linear equation representing the change of time with lateral position. The slope of the linear equation represents the rate of change of lateral position.

[0030] The tilt angle of the paper tail edge is calculated based on the paper feed speed and the lateral position change rate, and an angle compensation signal is output to the printer's servo driver based on the tilt angle.

[0031] A further approach is to extract the minimum and maximum values ​​of the horizontal position, take the average value, and then obtain the horizontal center position.

[0032] The center time corresponding to the horizontal center position is calculated using the equation of the straight line.

[0033] The lateral offset of the paper tail edge is calculated based on the paper feed speed, the lateral position change rate, and the center time. An offset compensation signal is then output to the printer's servo driver based on the lateral offset.

[0034] Therefore, compared with the prior art, the present invention has the following beneficial effects: 1. This invention uses a spatial array of multiple optocoupler sensors. By combining the logic of these multiple optocouplers to determine the effective gap, it can effectively filter out false triggers caused by local defects such as holes and scratches in the paper. This avoids the erroneous gap signal output caused by paper defects when only a single optocoupler is in operation, thus improving gap recognition capability and accuracy, as well as the robustness of the detection system.

[0035] 2. This invention uses a spatial array of multiple optocoupler sensors to acquire edge morphology data, which can be used to calculate the tilt angle and lateral offset of the paper tail edge in real time, providing real-time feedback data for printer correction and helping to improve the accuracy of subsequent processes.

[0036] 3. This invention constructs an optically coupled state vector and performs de-jitter processing. By introducing a confidence function, the reliability of the gap can be quantitatively evaluated, which can accurately distinguish between the real gap and various defects. This avoids the missed judgment or false judgment caused by the traditional direct threshold judgment, and is especially suitable for high-speed printers or complex working conditions.

[0037] 4. The multi-optical coupler gap detection method proposed in this invention can be uniformly applied to different optical coupler layouts such as linear array, cross array, and grid array. Only parameter adjustments are needed to adapt to different machine models, paper sizes, and working speeds. This configurable design reduces development costs.

[0038] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments. Attached Figure Description

[0039] Figure 1 This is a flowchart of a gap detection method based on multiple optical couplers according to an embodiment of the present invention.

[0040] Figure 2 This is a flowchart of a gap detection method based on a linear array according to an embodiment of the present invention. Detailed Implementation

[0041] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this 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 this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0042] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0043] See Figure 1 The present invention provides a gap detection method based on multiple optical couplers, comprising: S1: Set up an optical coupler array in the paper feed area of ​​the printer, and define the state variables of each optical coupler in the array. Construct an optical coupler state vector based on the state variables of each optical coupler.

[0044] S2: Set the scanning period, and collect the state values ​​of each optocoupler in the optocoupler array in real time during the scanning period, and update the optocoupler state vector according to the state values ​​of each optocoupler.

[0045] S3: Obtain the optical coupler state vector within multiple consecutive scanning cycles, and determine whether there is a real gap based on the temporal changes of the optical coupler state vector.

[0046] S4: If the actual gap exists, measure the gap width and calculate the offset of the paper tail edge, and determine whether it is an effective gap based on the gap width.

[0047] S5: If it is the effective gap, then output a corresponding compensation signal according to the offset of the paper tail edge to adjust the printing deviation.

[0048] In this embodiment, the state variables include at least a paper-containing state and a gap state, and the paper-containing state is defined as 0 and the gap state is defined as 1 using binary encoding.

[0049] Specifically, this embodiment maintains a state machine inside the printer, including but not limited to STATE_PAPER (paper present state), STATE_GAP (gap state), STATE_HOLE (hole state), STATE_NOISE (interference state), and STATE_NO_PAPER (paper break or paper shortage state). When a valid gap is determined, STATE_GAP=1, and the others are similar.

[0050] The optocoupler state vector is represented as follows:

[0051] Wherein, K is the number of optical couplers in the optical coupler array. This is used to identify the position of the optocoupler in the optocoupler array. , which is the state variable of the optocoupler.

[0052] In this embodiment, the optical coupler array is a linear array, which is perpendicular to the paper feed direction and its center line coincides with the center line of the paper feed channel.

[0053] Specifically, in this embodiment, N optocouplers in the linear array are installed horizontally in sequence at a fixed interval, preferably 10~20mm. The installation position is in the gap between the printer's conveyor rollers. The axis of the light beam emitted by the optocoupler is perpendicular to the paper surface to ensure that the paper passes between the light beam and the receiving tube.

[0054] Specifically, in this embodiment, the linear array is assumed to include N optocouplers and N≥3, then the optocoupler state vector is represented as:

[0055] in, Let be the state variable of the i-th optocoupler in the linear array, 1 ≤ .

[0056] In another embodiment, the optical coupler array is a cross array, which includes a first optical coupler array and a second optical coupler array, wherein the first optical coupler array is perpendicular to the normal of the paper feed direction. The second optical coupler array is arranged at an angle, with the normal to the paper feed direction at an angle. Arranged at an angle.

[0057] Specifically, in this embodiment, the first optical coupler array and the second optical coupler array both include M optical couplers and M≥3. Then, the optical coupler state vector is represented as:

[0058] in, Let j be the state variable of the j-th optical coupler in the first optical coupler subarray; Let j be the state variable of the j-th optical coupler in the second optical coupler subarray, 1≤ .

[0059] It is not difficult to conceive that the cross array can be composed of M optical couplers forming a cross pair. Each cross pair consists of an optical coupler from a first optical coupler subarray and an optical coupler from a second optical coupler subarray, both located in the same lateral position but in different tilt directions. Therefore, the optical coupler state vector can be expressed as:

[0060] In another embodiment, the optical coupler array is a grid array, which includes a rectangular grid disposed in the paper feed channel, and an optical coupler pair is disposed at each grid point of the rectangular grid.

[0061] Specifically, in this embodiment, let R be the number of rows in the paper feed direction and C be the number of columns in the horizontal direction of the grid array. Then, the optical coupler state vector is represented as:

[0062] A one-dimensional vector is represented as:

[0063] in, Let be the state variable of the optocoupler located in the i-th row and j-th column of the grid array, 1 ≤ ,1≤ .

[0064] In this embodiment, the state values ​​of each periodically acquired optocoupler are subjected to jitter reduction processing, the steps of which include: Allocate a circular buffer for each optocoupler and initialize the circular buffer to all zeros. Let the circular buffer be buf[i], and its length be L. During initialization, maintain a write pointer ptr[i] and set it to initially point to the beginning position of the buffer.

[0065] During each scanning cycle, the state values ​​of each optocoupler in the optocoupler array are sequentially collected in real time and stored in a temporary array raw[i].

[0066] The temporary array raw[i] is written to the circular buffer buf[i][ptr[i]], overwriting the old value at that position. The write pointer ptr[i] is then incremented cyclically, ensuring that the buffer always retains the original values ​​from the most recent L samples. The incrementing algorithm is: ptr[i] = (ptr[i] + 1) % L.

[0067] Iterate through all L elements in the current circular buffer buf[i] to count the number of elements with a value of 1, and record it as ones_count.

[0068] A jitter threshold D is set. When ones_count ≥ D, the current state of the optocoupler has been truly flipped, and its state value is set to 1; otherwise, it is set to 0. This embodiment filters out the instantaneous burr signal caused by paper jitter through jitter removal processing.

[0069] In this embodiment, the step of determining the actual gap includes: The number of state variables with a value of 1 in the optical coupler state vector and their duration are counted. The lateral span threshold of the actual gap is set, and the minimum gap width threshold of the printer paper feed is obtained.

[0070] A lateral coverage index is created based on the statistical count and the lateral span threshold; a duration index is created based on the duration and the minimum gap width threshold; and a consistency index is created based on the time synchronization of the state changes of all optocouplers in the optocoupler array. The confidence function for the true gap is defined by combining the lateral coverage index, the duration index, and the consistency index.

[0071] Specifically, in this embodiment, when the number of counts exceeds the horizontal span threshold, the horizontal coverage index is set to 1; otherwise, it decreases linearly according to the ratio of the number of counts to the horizontal span threshold. When the duration exceeds the minimum gap width threshold, the duration index is set to 1; otherwise, it decreases linearly according to the ratio of the duration to the minimum gap width threshold. Consistency is measured by checking the proportion of all optocouplers that become 1 within the time threshold. The higher the proportion, the better the consistency. Taking a linear array composed of three optocouplers as an example, when the state value of an optocoupler changes from [0,0,0] to [1,1,1] and the change occurs within the time threshold, the consistency index is set to 1; otherwise, it decreases linearly according to the proportion of optocouplers that become 1 within the time threshold.

[0072] Specifically, in this embodiment, the confidence function for creating the true gap is:

[0073] in, It is a horizontal coverage indicator used to measure the spatial extent of optical transmission and optocoupler coverage; This is a duration metric used to measure the temporal stability of the light-transmitting state; It is a consistency indicator used to measure the time synchronization of light transmission of each optocoupler; These are the weighting coefficients for the three indicators.

[0074] Specifically, in practical applications, this embodiment... The recommended value range is 0.4 to 0.5. The recommended value range is 0.3 to 0.4. The recommended value range is 0.1 to 0.2, and an appropriate weighting coefficient can be selected according to different application scenarios. For example, in high-speed laser printers with speeds of 200 to 500 mm / s, due to the high paper feed speed, short time for the gap to pass through the optical coupler, and relatively small duration, and because of the large paper vibration at high speeds, short-term interference is prone to occur. Therefore, a reasonable setting is to improve... ,reduce In ordinary inkjet / dot matrix printers with speeds of 50~150 mm / s, due to the moderate paper feed speed and appropriate gap duration, various indicators can effectively distinguish between the actual gap and interference. Therefore, a reasonable setting is to balance the weighting coefficients of each parameter.

[0075] Set a confidence threshold and use the confidence function to calculate the current confidence level. If the current confidence level is greater than the confidence threshold, it is determined to be the true gap; otherwise, it is determined to be local interference or edge, and the abnormal situation is recorded.

[0076] It's easy to imagine that in another embodiment, the true gap can be determined simply by observing the changes in the optical coupler state vector over several consecutive scanning cycles. Taking a linear array of three optical couplers as an example, when the state value of an optical coupler changes from [0,0,0] to [1,1,1], it may indicate that all three optical couplers have detected light transmission, i.e., a gap, which the system determines to be a true gap. When the state value changes from [0,0,0] to [1,0,0] and then back to [0,0,0], it may indicate that only the first optical coupler has detected light transmission, which the system determines to be a hole or partial damage. Although this scheme is also based on the temporal changes in the optical coupler state vector, its accuracy is affected by the number of optical couplers, the spacing, and the paper feed speed. If there are many optical couplers, and the gap width is small and the paper tail is tilted, the gap may only cover 3 to 4 optical couplers at the same time, which this scheme will directly determine as an anomaly, leading to missed detection. If there are few optical couplers, wide scratches or large areas of dirt may simultaneously cover all optical couplers, leading to misjudgment as a true gap.

[0077] In this embodiment, the step of determining the effective gap includes: The paper feed speed of the printer is obtained, and the gap width Lw is calculated based on the duration and the paper feed speed. The standard gap width threshold Lstd and the maximum gap width threshold Lmax of the printer are also obtained.

[0078] If the gap width Lw is between the standard gap width threshold Lstd and the maximum gap width threshold Lmax, i.e. Lstd≤Lw≤Lmax, then it is determined to be a valid gap.

[0079] If the gap width Lw is greater than the maximum gap width threshold Lmax, i.e., Lw > Lmax, it is determined to be a paper break or paper shortage, and a stop signal is triggered.

[0080] If the gap width Lw is less than the standard gap width threshold Lstd, i.e., Lw < Lmax, it is judged as interference or a small gap.

[0081] In this embodiment, the step of calculating the offset of the paper tail edge includes: If the printer feeds paper vertically, all optical coupler positions located horizontally at the paper tail edge and their corresponding trigger timestamps are extracted and a set of data points is formed.

[0082] Specifically, this embodiment takes a linear array composed of N optocouplers as an example. Assume the N optocouplers are arranged at equal intervals, with a spacing of d. The horizontal coordinate is represented as... Record the precise moment when each optocoupler changes from being blocked to being able to transmit light. Then the data points are represented as ( , ).

[0083] The data points are linearly fitted using the least squares method to obtain a linear equation representing the change of time with lateral position. The slope of the linear equation represents the rate of change of lateral position.

[0084] Specifically, in this embodiment, N data points are fitted into a straight line: The formula for calculating the slope is:

[0085] The tilt angle of the paper tail edge is calculated based on the paper feed speed and the lateral position change rate, and an angle compensation signal is output to the printer's servo driver based on the tilt angle.

[0086] Specifically, the formula for calculating the tilt angle in this embodiment is:

[0087] Where v is the paper feed speed.

[0088] In this embodiment, the minimum and maximum values ​​of the horizontal position are extracted, and the average value is taken to obtain the horizontal center position.

[0089] Specifically, in this embodiment, the linear array is arranged horizontally from near to far in order of 1 to N. Therefore, its horizontal center position is:

[0090] in, This is the minimum value of the lateral position, i.e., the lateral position of the first optocoupler; This represents the maximum value of the lateral position, which is the lateral position of the Nth optocoupler.

[0091] The center time corresponding to the horizontal center position is calculated using the equation of the straight line.

[0092] Specifically, in this embodiment, the central time .

[0093] The lateral offset of the paper tail edge is calculated based on the paper feed speed, the lateral position change rate, and the center time. An offset compensation signal is then output to the printer's servo driver based on the lateral offset.

[0094] Specifically, the formula for calculating the lateral offset in this embodiment is as follows:

[0095] The slope 'a' is in units of s / mm, representing the change in trigger time for every 1mm lateral movement of the paper tail edge. , is the tangent of the tilt angle; This indicates the displacement of the paper tail edge at the center position along the paper feeding direction.

[0096] See Figure 2 In this embodiment, a high-speed infrared through-beam photoelectric sensor with a response time ≤50μs is selected as the optocoupler to ensure that details at the paper tail edge can be captured even at high-speed paper feed settings such as 300 m / min. The signal output terminal of the optocoupler is connected to the high-speed GPIO interface of the main control unit inside the printer. The main control unit adopts a high-speed PLC or STM32 series microcontroller with microsecond-level I / O scanning capability. The main control unit is connected to the encoder of the printer's conveyor motor through a speed measurement interface to obtain the current paper conveying line speed in real time. The hardware circuit design also includes an RC low-pass filter, which is used to filter out high-frequency electromagnetic interference and prevent signal jitter. Taking the above hardware foundation and a linear array composed of three optocouplers as an example, the multi-optocoupler gap detection process will be explained.

[0097] Step 1: System Initialization and Self-Test. After the system is powered on, the main control unit reads the initial I / O status. The signal logic is defined as: 0 = blocked (paper present), 1 = light present (gap present). The system performs a self-test to ensure that all sensors have the same initial status; otherwise, a sensor fault is reported.

[0098] Step 2: High-speed real-time scanning and signal acquisition. The main control unit cyclically scans the states of optical couplers S1, S2, and S3 at a period of T=1ms, constructs the current state vector Statet=[S1,S2,S3], and performs jitter removal processing at the software level to filter out instantaneous burr signals caused by paper jitter.

[0099] Step 3: Core Logic Processing. First, the actual gap is determined based on the temporal changes of the optocoupler state vector. If it is a true gap, the gap processing flow begins; if it is not a true gap, the system determines it as a hole or partial damage, does not output a gap signal, and continues counting. Simultaneously, the precise timestamp of each optocoupler's state value changing from 0 to 1 is recorded to calculate the tilt angle of the paper tail edge. After calculating the tilt angle, the system can calculate the actual position of the paper tail's geometric center, performing reverse compensation for subsequent printing or cutting positions to eliminate positioning errors caused by tilting. Then, the gap width is verified. If Lstd ≤ Lw ≤ Lmax, it is determined to be a valid gap; if Lw > Lmax, it is determined to be a paper break or missing paper, and a stop signal is immediately triggered; if Lw < Lmax, it is determined to be interference or a small gap.

[0100] Step 4: When a complete and effective gap is detected, a pulse signal of fixed width is output to the counter for pulse counting, and a position synchronization signal after tilt angle compensation is output to the servo driver to ensure accurate alignment in subsequent processes such as printing and cutting. If a paper break or optocoupler failure is detected, an alarm is triggered by a buzzer or indicator light.

[0101] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0102] The above embodiments are merely preferred embodiments of the present invention and should not be construed as limiting the scope of protection of the present invention. Any non-substantial changes and substitutions made by those skilled in the art based on the present invention shall fall within the scope of protection claimed by the present invention.

Claims

1. A gap detection method based on multiple optical couplers, characterized in that, include: An optical coupler array is set up in the paper feed area of ​​the printer, and the state variables of each optical coupler in the optical coupler array are defined; Construct an optocoupler state vector based on the state variables of each optocoupler; Set a scanning period, and collect the state values ​​of each optocoupler in the optocoupler array in real time within the scanning period, and update the optocoupler state vector according to the state values ​​of each optocoupler. Obtain the optical coupler state vector within multiple consecutive scanning cycles, and determine whether a real gap exists based on the temporal changes of the optical coupler state vector; If the actual gap exists, measure the gap width and calculate the offset of the paper tail edge, and determine whether it is an effective gap based on the gap width; If it is the effective gap, a corresponding compensation signal is output according to the offset of the paper tail edge to adjust the printing deviation.

2. The gap detection method based on multiple optical couplers according to claim 1, characterized in that: The optical coupler array is a linear array, which is perpendicular to the paper feed direction and its center line coincides with the center line of the paper feed channel.

3. The gap detection method based on multiple optical couplers according to claim 1, characterized in that: The optical coupler array is a cross array, which includes a first optical coupler subarray and a second optical coupler array. The first optical coupler array is perpendicular to the normal of the paper feed direction. The second optical coupler array is arranged at an angle, with the normal to the paper feed direction perpendicular to the angle of the second optical coupler array. Arranged at an angle.

4. The gap detection method based on multiple optical couplers according to claim 1, characterized in that: The optical coupler array is a grid array, which includes a rectangular grid set in the paper feed channel, and an optical coupler pair is set at each grid point of the rectangular grid.

5. The gap detection method based on multiple optical couplers according to any one of claims 1-4, characterized in that: The state variables include at least a paper-containing state and a gap state, and the paper-containing state is defined as 0 and the gap state is defined as 1 using binary encoding. The optocoupler state vector is represented as follows: Wherein, K is the number of optical couplers in the optical coupler array; This serves as the position identifier for the optocoupler within the optocoupler array. , which is the state variable of the optocoupler.

6. The gap detection method based on multiple optical couplers according to claim 5, characterized in that, The process of de-jittering the state values ​​of each periodically acquired optocoupler includes the following steps: Allocate a circular buffer for each optocoupler and initialize the circular buffer to all zeros; During each scanning cycle, the status values ​​of each optocoupler in the optocoupler array are sequentially and collected in real time and stored in a temporary array; Write the temporary array into the circular buffer, and iterate through all elements in the current circular buffer to count the number of elements with a value of 1. Set a jitter threshold. If the number of counts is greater than or equal to the jitter threshold, the current state value of the optocoupler is set to 1; otherwise, it is set to 0.

7. The gap detection method based on multiple optical couplers according to claim 5, characterized in that, The steps for determining the actual gap include: The number and duration of state variables with a value of 1 in the optical coupler state vector are counted, the lateral span threshold of the actual gap is set, and the minimum gap width threshold of the printer paper feed is obtained. A horizontal coverage index is created based on the number of statistically significant items and the horizontal span threshold; a duration index is created based on the duration and the minimum gap width threshold; and a consistency index is created based on the time synchronization of the state changes of all optical couplers in the optical coupler array. The confidence function of the actual gap is defined by combining the horizontal coverage index, the duration index, and the consistency index. Set a confidence threshold and use the confidence function to calculate the current confidence level. If the current confidence level is greater than the confidence threshold, it is determined to be the true gap.

8. The gap detection method based on multiple optical couplers according to claim 7, characterized in that, The steps for determining the effective gap include: The paper feed speed of the printer is obtained, and the gap width is calculated based on the duration and the paper feed speed; and the standard gap width threshold and the maximum gap width threshold of the printer are obtained. If the gap width is between the standard gap width threshold and the maximum gap width threshold, it is determined to be a valid gap; If the gap width is greater than the maximum gap width threshold, it is determined to be a paper break or paper shortage, and a stop signal is triggered.

9. The gap detection method based on multiple optical couplers according to claim 8, characterized in that, The steps for calculating the offset of the paper tail edge include: If the printer feeds paper vertically, extract all optical coupler positions located laterally at the paper tail edge and their corresponding trigger timestamps, and form a set of data points; The data points are linearly fitted using the least squares method to obtain a linear equation representing the change of time with lateral position. The slope of the linear equation represents the rate of change of lateral position. The tilt angle of the paper tail edge is calculated based on the paper feed speed and the lateral position change rate, and an angle compensation signal is output to the printer's servo driver based on the tilt angle.

10. The gap detection method based on multiple optical couplers according to claim 9, characterized in that: Extract the minimum and maximum values ​​of the horizontal position, take the average value, and then obtain the horizontal center position; The center time corresponding to the horizontal center position is calculated using the equation of the straight line. The lateral offset of the paper tail edge is calculated based on the paper feed speed, the lateral position change rate, and the center time. An offset compensation signal is then output to the printer's servo driver based on the lateral offset.