Paper detection method and device and printer

By adopting a paper detection method that dynamically adjusts the reference value in a thermal label printer, the problem of infrared reflection sensors being difficult to obtain a fixed ADC threshold that adapts to different environments is solved, and the accuracy and adaptability of detection are improved.

CN119319727APending Publication Date: 2025-01-17SHENZHEN TOPBAND CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411587811.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-07
Publication Date
2025-01-17

AI Technical Summary

Technical Problem

In existing thermal label printers, when infrared reflection sensors are used to detect paper media, it is difficult to obtain an adaptable fixed ADC threshold between different printers and label media, resulting in unstable detection signals and prone to misjudgment or misjudgment.

Method used

A paper detection method is used to compare and update the current value of the detection signal with the historical average value during the printing and paper feeding process, and dynamically adjust the reference value to achieve adaptation to the detection environment.

Benefits of technology

It improves the accuracy of paper detection, can dynamically adapt to the differences in characteristics of different paper media and infrared sensors, and reduces the occurrence of missed and misjudgments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119319727A_ABST
    Figure CN119319727A_ABST
Patent Text Reader

Abstract

The invention relates to a paper detection method and device and a printer. The method comprises the steps that S1, in the printing paper feeding process, the current value of a detection signal in a detection area is obtained, and whether the detection area is a detection target or a target gap is judged according to the current value and a reference value; s2, when the gap is the target gap, acquiring a first historical average value corresponding to the detection signal, and updating the first historical average value of the detection signal according to the current value of the detection signal in the detection area and the first historical average value; s3, when the target is the detection target, acquiring a second historical average value corresponding to the detection signal, and updating the second historical average value of the detection signal according to the current value of the detection signal in the detection area and the second historical average value; and S4, updating the reference value according to the first historical average value of the detection signals and the second historical average value of the detection signals, and executing S1. According to the invention, during the paper feeding process and paper detection, self-adaption to the detection environment can be realized, and the accuracy of paper detection is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of detection technology, and more specifically, to a paper detection method, device and printer. Background Art

[0002] In thermal label printers, infrared reflection sensors are usually used to detect label paper and release paper (liner) of paper media. The principle is that the infrared emitting tube emits infrared light and irradiates the paper medium, and part of the infrared light is reflected from the medium back to the infrared receiving sensor and converted into an electrical signal. This electrical signal is amplified and transmitted to the MCU. The MCU detects the signal strength of the infrared receiving sensor through the ADC, and determines whether there is paper or no paper based on the signal strength. In the case of paper, and the label paper or release paper (liner) of the paper medium is located at the sensor position, a fixed ADC threshold is set as the threshold for judging the label paper area and the release paper area. The area with a signal strength lower than this threshold is considered to be the label paper area; the area with a signal strength higher than this threshold is considered to be the release paper area. Due to the different reflectivity of different label papers. The characteristics of infrared sensors from different manufacturers and batches are different. In fact, different printers and different label media have different ranges of measured signal strength values. Therefore, it is difficult to obtain a suitable fixed ADC threshold to adapt to all sensors and media. Therefore, in some cases, the ADC average value of the collected stable area plus a fixed value is used as the ADC threshold of the label paper area and the gap area.

[0003] During the feeding of label paper, paper jitter, motor ripple interference, etc. will make the reflected infrared signal of label paper unstable. Obvious burrs may appear in the label area, making it difficult to form an ideal stable area in the entire label area. In this case, it is easy to miss or misjudge the label area. Summary of the invention

[0004] The technical problem to be solved by the present invention is to provide a paper detection method, device and printer in view of the above-mentioned technical defects of the prior art.

[0005] The technical solution adopted by the present invention to solve the technical problem is: constructing a paper detection method, comprising the following steps:

[0006] S1. During the printing and paper feeding process, the current value of the detection signal in the detection area is obtained, so as to determine whether the detection area corresponds to the detection target or the target gap according to the current value and the reference value;

[0007] S2. When the detection area corresponds to a target gap, obtain a first historical average value corresponding to the detection signal, and update the first historical average value of the detection signal according to the current value of the detection signal of the detection area and the first historical average value; wherein the first historical average value is the historical average value of the target gap detection signal;

[0008] S3, when the detection area corresponds to a detection target, obtaining a second historical average value corresponding to the detection signal, and updating the second historical average value of the detection signal according to the current value of the detection signal of the detection area and the second historical average value; wherein the second historical average value is the historical average value of the detection signal of the detection target;

[0009] S4. Update the reference value according to the first historical average value of the detection signal and the second historical average value of the detection signal, and execute step S1.

[0010] Preferably, in an embodiment of the paper detection method of the present invention, in the step S2, updating the first historical average value of the detection signal according to the current value of the detection signal of the detection area and the first historical average value; including: obtaining a new first historical average value according to the expression (GapBase*Wg1+IrNew*Wg2) / (Wg1+Wg2), wherein GapBase is the first historical average value, IrNew is the current value, and Wg1 and Wg2 are constants.

[0011] Preferably, in the paper detection method embodiment of the present invention, in the step S2, the first historical average value of the detection signal is updated according to the current value of the detection signal of the detection area and the first historical average value; further comprising:

[0012] Comparing the current value of the detection signal in the detection area with the first historical average value;

[0013] When the current value of the detection signal in the detection area is greater than the first historical average value, setting the ratio of Wg1 to Wg2 to be less than a first preset value;

[0014] When the current value of the detection signal in the detection area is less than the first historical average value, the ratio of Wg1 to Wg2 is set to be greater than a second preset value; wherein the second preset value is greater than or equal to the first preset value.

[0015] Preferably, in an embodiment of the paper detection method of the present invention, in the step S3, the second historical average value of the detection signal is updated according to the current value of the detection signal of the detection area and the second historical average value; including: obtaining a new second historical average value according to the expression (LabelBase*Wg3+IrNew*Wg4) / (Wg3+Wg4), wherein LabelBase is the second historical average value, IrNew is the current value, and Wg3 ​​and Wg4 are constants.

[0016] Preferably, in the paper detection method embodiment of the present invention, in the step S3, the second historical average value of the detection signal is updated according to the current value of the detection signal of the detection area and the second historical average value; further comprising:

[0017] Comparing the current value of the detection signal in the detection area with the second historical average value;

[0018] When the current value of the detection signal in the detection area is greater than the second historical average value, setting the ratio of Wg3 to Wg4 to be less than a third preset value;

[0019] When the current value of the detection signal in the detection area is less than the first historical average value, the ratio of Wg3 to Wg4 is set to be greater than a fourth preset value; wherein the fourth preset value is less than or equal to the third preset value.

[0020] Preferably, in an embodiment of the paper detection method of the present invention, in step S3, updating the reference value according to the first historical average value of the detection signal and the second historical average value of the detection signal includes: obtaining a new reference value according to the expression LabelBase+k*(GapBase-LabelBase), wherein GapBase is the first historical average value, LabelBase is the second historical average value, and k is a constant greater than zero and less than 1.

[0021] Preferably, in the paper detection method embodiment of the present invention, it also includes:

[0022] A historical maximum value of a detection target detection signal is obtained, and a value of k is set according to the historical maximum value of the detection target detection signal so that the reference value is smaller than the historical maximum value.

[0023] Preferably, in an embodiment of the paper detection method of the present invention, the detection target is printing paper for printing, and the target gap is a non-printing area for dividing the printing paper. The method further includes:

[0024] A reflection signal generated by a preset infrared signal in the detection area is received and a corresponding electrical signal is generated to obtain the detection signal.

[0025] The present invention also constructs a paper detection device, which includes: a module for executing the method described above.

[0026] The present invention also constructs a printer, comprising the paper detection device as described above, and the printer obtains a paper detection result through the paper detection device when printing.

[0027] The paper detection method, device and printer of the present invention have the following beneficial effects: when performing paper detection during paper feeding, it is possible to achieve self-adaptation to the detection environment and improve the accuracy of paper detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:

[0029] Figure 1 is a program flow chart of an embodiment of a paper detection method of the present invention;

[0030] Figure 2 is a program flow chart of another embodiment of a paper detection method of the present invention;

[0031] Figure 3 It is a program flow chart of another embodiment of a paper detection method of the present invention. DETAILED DESCRIPTION

[0032] In order to have a clearer understanding of the technical features, purposes and effects of the present invention, specific embodiments of the present invention are now described in detail with reference to the accompanying drawings.

[0033] like Figure 1 FIG. 1 shows an embodiment of a paper detection method of the present invention. Figure 1In the first embodiment of a paper detection method of the present invention, the process is mainly used for detecting the printing area during the printing paper feeding process. Specifically, the following steps are included: S1, during the printing paper feeding process, the current value of the detection signal in the detection area is obtained, so as to judge whether the detection area corresponds to the detection target or the target gap according to the current value and the reference value; S2, when the detection area is the target gap, the first historical average value corresponding to the detection signal is obtained, and the first historical average value of the detection signal is updated according to the current value of the detection signal of the detection area and the first historical average value; wherein the first historical average value is the historical average value of the target gap detection signal; S3, when the detection area is the detection target, the second historical average value corresponding to the detection signal is obtained, and the second historical average value of the detection signal is updated according to the current value of the detection signal of the detection area and the second historical average value; wherein the second historical average value is the historical average value of the detection signal of the detection target; S4, the reference value is updated according to the first historical average value of the detection signal and the second historical average value of the detection signal, and step S1 is executed.

[0034] Based on the above step S1, the setting of the detection area can be set differently according to different devices, and its purpose is to identify whether the final printing area contains paper that needs to be printed, that is, to obtain the corresponding detection target. Among them, the detection area includes but is not limited to corresponding to the printing area, and the detection area can also be set to a certain area before the printing area. After the detection target is detected in the detection area, the detection target can be obtained in the printing area within a certain time to perform the printing task. The detection process of the detection area is carried out in real time, that is, the detection signal in the detection area is obtained in real time to obtain the corresponding current value. According to the relationship between the current value and the reference value, it is judged whether the detection area corresponds to the detection target or the target gap. For example, when the current value is greater than or equal to the reference value, it is determined that the target gap is located in the current area. When the current value is less than the reference value, it is determined that the detection target is located in the current area.

[0035] Based on step S2, when it can be determined that the current detection area corresponds to the target gap, the historical average value of the target gap detection signal, i.e., the first historical average value, is obtained, and the first historical average value is updated according to the current value of the detection signal of the detection area to obtain the latest first historical average value. It can be understood that the updating process is also approximately performed in real time, that is, after obtaining the detection signal corresponding to the target gap, the average value of the existing target gap detection signal is recalculated to obtain a new average value. In the initial stage, the first historical average value can be set based on experience.

[0036] Based on step S3, when it can be determined that the current detection area corresponds to the detection target, the historical average value of the detection signal of the detection target, i.e., the second historical average value, is obtained, and the second historical average value is updated according to the current value of the detection signal of the detection area to obtain the latest second historical average value. It can be understood that the updating process is also approximately real-time, that is, after obtaining the detection signal corresponding to the detection target, the average value of the detection signal of the existing detection target is recalculated to obtain a new average value. In the initial stage, the second historical average value can be set based on experience.

[0037] In a specific embodiment, the detection target is printing paper for printing, and the target gap is used to separate the non-printing area of ​​the printing paper. For example, the detection target includes and is limited to label paper that needs to be printed, and the target gap includes and is limited to release paper used to post label paper.

[0038] Based on step S4, after obtaining the first historical average value and the second historical average value of the updated detection signal, the reference value can be updated according to the first historical average value and the second historical average value, that is, a new reference value is obtained. After obtaining the new reference value, during the printing process, a new detection result corresponding to the detection area can be obtained based on the new reference value and the current value of the detection signal in the detection area. Finally, dynamic detection within the detection area is achieved. Through this process, the characteristic differences of different paper media and different batches of devices for obtaining detection signals can be dynamically adapted. The label paper area and the gap area (release paper area) of the label paper can be detected and determined quickly and accurately.

[0039] In a specific embodiment, the process of obtaining the detection signal may include: receiving a reflection signal generated by a preset infrared signal in the detection area and generating a corresponding electrical signal to obtain the detection signal. That is, a reflection signal is generated according to the reflection effect of the material on the light signal and signal acquisition is performed to generate a corresponding electrical signal, and a corresponding detection signal is obtained according to the electrical signal. Different materials have different reflection effects on the light signal, and the detection signals generated will also be different. Based on the detection signal, specific materials can be distinguished. The signal detection process may include receiving the signal, ADC sampling of the signal, and conversion of the signal, and finally obtaining a detection signal that can reflect the strength of the reflection signal. The specific processing process of the signal can be based on the current existing signal processing process, which is not limited here.

[0040] In one embodiment, in step S2, the first historical average value of the detection signal is updated according to the current value of the detection signal of the detection area and the first historical average value; including: obtaining a new first historical average value according to the expression (GapBase*Wg1+IrNew*Wg2) / (Wg1+Wg2), wherein GapBase is the first historical average value, IrNew is the current value, and Wg1 and Wg2 are constants. Specifically, the first historical average value of the detection signal can be updated by the weighted formula GapBase=(GapBase*Wg1+IrNew*Wg2) / (Wg1+Wg2), wherein Wg1 and Wg2 are weight constants.

[0041] Further, such as Figure 2 As shown, in the process of updating the first historical average value of the detection signal according to the current value of the detection signal of the detection area and the first historical average value, it also includes: S21, comparing the current value of the detection signal of the detection area with the first historical average value; S22, when the current value of the detection signal of the detection area is greater than the first historical average value, setting the ratio of Wg1 to Wg2 to be less than the first preset value; S23, when the current value of the detection signal of the detection area is less than the first historical average value, setting the ratio of Wg1 to Wg2 to be greater than the second preset value; wherein the second preset value is greater than or equal to the first preset value. That is, a suitable weight constant is selected based on the comparison result between the current value and the first historical average value. If the newly sampled ADC value, such as the current value IrNew is greater than the first historical average value GapBase, it can be determined that the waveform corresponding to the detection signal is in the rising stage, and a larger weight is assigned to the newly sampled value, that is, the current value IrNew. At this time, the ratio of Wg1 to Wg2 will obtain a relatively small value, for example, less than the first preset value. In a specific embodiment, Wg1 is 1792 and Wg2 is 256. If the newly sampled ADC value, such as the current value IrNew, is less than the first historical average value GapBase, it can be determined that the waveform corresponding to the detection signal is in a descending phase, and a smaller weight is assigned to the newly sampled value, i.e., the current value IrNew. At this time, the ratio of Wg1 to Wg2 will obtain a relatively large value, for example, greater than the second preset value. The second preset value is greater than or equal to the first preset value. In a specific embodiment, Wg1 is 1047 and Wg2 is 1.

[0042] In one embodiment, in the step S3, the second historical average value of the detection signal is updated according to the current value of the detection signal of the detection area and the second historical average value; including: obtaining a new second historical average value according to the expression (LabelBase*Wg3+IrNew*Wg4) / (Wg3+Wg4). Wherein, LabelBase is the second historical average value, IrNew is the current value, and Wg3 ​​and Wg4 are constants. Specifically, the second historical average value of the detection signal can be updated by the weighted formula LabelBase=(LabelBase*Wg3+IrNew*Wg4) / (Wg3+Wg4), where Wg3 and Wg4 are weight constants.

[0043] Further, such as Figure 3 As shown, in the step S3, the second historical average value of the detection signal is updated according to the current value of the detection signal of the detection area and the second historical average value; it also includes: S31, comparing the current value of the detection signal of the detection area with the second historical average value; S32, when the current value of the detection signal of the detection area is greater than the second historical average value, setting the ratio of Wg3 to Wg4 to be less than the third preset value; S33, when the current value of the detection signal of the detection area is less than the first historical average value, setting the ratio of Wg3 to Wg4 to be greater than the fourth preset value; wherein the fourth preset value is less than or equal to the third preset value. That is, a suitable weight constant is selected based on the comparison result between the current value and the second historical average value. If the newly sampled ADC value, such as the current value IrNew is greater than the second historical average value LabelBase, it can be determined that the waveform corresponding to the detection signal is in the rising stage, and a smaller weight is assigned to the newly sampled value, that is, the current value IrNew. At this time, the ratio of Wg3 to Wg4 will obtain a relatively large value, for example, greater than the fourth preset value. If the newly sampled ADC value, such as the current value IrNew, is less than the second historical average value LabelBase, it can be determined that the waveform corresponding to the detection signal is in a descending phase, and a larger weight is assigned to the newly sampled value, i.e., the current value IrNew. At this time, the ratio of Wg3 to Wg4 will obtain a relatively small value, for example, less than the fourth preset value. Among them, the third preset value is greater than or equal to the fourth preset value.

[0044] In one embodiment, in step S3, updating the baseline value according to the first historical average value of the detection signal and the second historical average value of the detection signal includes: obtaining a new baseline value according to the expression LabelBase+k*(GapBase-LabelBase), wherein GapBase is the first historical average value, LabelBase is the second historical average value, and k is a constant greater than zero and less than 1.

[0045] Specifically, the new benchmark value Thres can be obtained according to the formula Thres=LabelBase+k*(GapBase-LabelBase) to update the benchmark value Thres. Each update of the benchmark value will be related to the previous detection result, and finally the benchmark value can be dynamically adjusted to improve the accuracy of the detection result. For example, there is also relatively high noise interference in the process of detecting the target, which almost reaches the average of the second historical average LabelBase and the first historical average GapBase. Therefore, the threshold needs to be set higher than this average, that is, greater than (LabeBase+GapBase) / 2; therefore, the benchmark value can be increased by setting the k value. Similarly, in some scenarios, the k value can also be set to make the benchmark value smaller.

[0046] In a specific embodiment, the paper detection method of the present invention further includes: obtaining the historical maximum value of the detection signal of the detection target, and setting the value of k according to the historical maximum value of the detection signal of the detection target, so that the reference value is greater than the historical maximum value. That is, in the process of adjusting the k value, it is necessary to ensure that the obtained reference value is greater than the historical maximum value of the detection signal corresponding to the detection target. It can also be understood that the k value is set according to the historical maximum value of the detection signal of the detection target.

[0047] In addition, a paper detection device of the present invention has the function of implementing the corresponding steps executed in the above method. Each function can be implemented by hardware, or by hardware executing corresponding software. The corresponding hardware or software includes one or more modules corresponding to the above functions. That is, the steps in the above method are respectively executed by one or more modules. The specific coordination operations between the modules can refer to the specific process of the above method, which will not be repeated here.

[0048] In addition, the printer of the present invention has the above-mentioned paper detection device. During the operation of the printer, the paper detection result can be obtained based on the paper detection device to achieve accurate printing of the printer. The printer can dynamically adapt to different paper media and the differences in infrared sensor characteristics of different batches during the printing process. It can quickly and accurately detect and determine the label paper area and gap area (release paper area) of the label paper. The specific adaptive process can be understood as the adaptation of label papers with different reflectivity; the adaptation of sensors from different manufacturer batches (differences in sensitivity and signal strength); the effective filtering of waveform jitter in the label paper area; and the accurate identification of the label paper area and the gap (release paper) area. The application scenarios of the entire printer are more extensive.

[0049] It can be understood that the above embodiments only express the preferred implementation modes of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the patent scope of the present invention. It should be pointed out that, for ordinary technicians in this field, the above technical features can be freely combined without departing from the concept of the present invention, and several deformations and improvements can be made, which all belong to the protection scope of the present invention. Therefore, all equivalent changes and modifications made to the scope of the claims of the present invention should belong to the coverage of the claims of the present invention.

Claims

1. A paper detection method, characterized in that: The following steps are involved: S1. During the printing and paper feeding process, the current value of the detection signal in the detection area is obtained, so as to determine whether the detection area corresponds to the detection target or the target gap according to the current value and the reference value; S2. When the detection area corresponds to a target gap, obtain a first historical average value corresponding to the detection signal, and update the first historical average value of the detection signal according to the current value of the detection signal of the detection area and the first historical average value; wherein the first historical average value is the historical average value of the target gap detection signal; S3, when the detection area corresponds to a detection target, obtaining a second historical average value corresponding to the detection signal, and updating the second historical average value of the detection signal according to the current value of the detection signal of the detection area and the second historical average value; wherein the second historical average value is the historical average value of the detection signal of the detection target; S4. Update the reference value according to the first historical average value of the detection signal and the second historical average value of the detection signal, and execute step S1.

2. The paper detection method according to claim 1, characterized in that: In the step S2, the first historical average value of the detection signal is updated according to the current value of the detection signal of the detection area and the first historical average value; including: obtaining a new first historical average value according to the expression (GapBase*Wg1+IrNew*Wg2) / (Wg1+Wg2), wherein GapBase is the first historical average value, IrNew is the current value, and Wg1 and Wg2 are constants.

3. The paper detection method according to claim 2, characterized in that: In the step S2, the first historical average value of the detection signal is updated according to the current value of the detection signal of the detection area and the first historical average value; and further comprising: Comparing the current value of the detection signal in the detection area with the first historical average value; When the current value of the detection signal in the detection area is greater than the first historical average value, setting the ratio of Wg1 to Wg2 to be less than a first preset value; When the current value of the detection signal in the detection area is less than the first historical average value, the ratio of Wg1 to Wg2 is set to be greater than a second preset value; wherein the second preset value is greater than or equal to the first preset value.

4. The paper detection method according to claim 1, characterized in that: In the step S3, the second historical average value of the detection signal is updated according to the current value of the detection signal of the detection area and the second historical average value; including: obtaining a new second historical average value according to the expression (LabelBase*Wg3+IrNew*Wg4) / (Wg3+Wg4), wherein LabelBase is the second historical average value, IrNew is the current value, and Wg3 ​​and Wg4 are constants.

5. The paper detection method according to claim 4, characterized in that: In the step S3, the second historical average value of the detection signal is updated according to the current value of the detection signal of the detection area and the second historical average value; and further comprising: Comparing the current value of the detection signal in the detection area with the second historical average value; When the current value of the detection signal in the detection area is greater than the second historical average value, setting the ratio of Wg3 to Wg4 to be less than a third preset value; When the current value of the detection signal in the detection area is less than the first historical average value, the ratio of Wg3 to Wg4 is set to be greater than a fourth preset value; wherein the fourth preset value is less than or equal to the third preset value.

6. The paper detection method according to claim 1, characterized in that: In step S3, the reference value is updated according to the first historical average value of the detection signal and the second historical average value of the detection signal, including: obtaining a new reference value according to the expression LabelBase+k*(GapBase-LabelBase), wherein GapBase is the first historical average value, LabelBase is the second historical average value, and k is a constant greater than zero and less than 1.

7. The paper detection method according to claim 6, characterized in that: The method further comprises: A historical maximum value of a detection target detection signal is obtained, and a value of k is set according to the historical maximum value of the detection target detection signal so that the reference value is smaller than the historical maximum value.

8. The paper detection method according to claim 1, characterized in that: The detection target is a printing paper for printing, and the target gap is a non-printing area for dividing the printing paper; the method further includes: A reflection signal generated by a preset infrared signal in the detection area is received and a corresponding electrical signal is generated to obtain the detection signal.

9. A paper detection device, characterized in that: The device comprises: a module for executing the method according to any one of claims 1 to 8.

10. A printer, characterized in that: It comprises the paper detection device as claimed in claim 9, and when the printer is printing, the paper detection result is obtained through the paper detection device.