Photoelectric sensor calibration detection method, device, photoelectric sensor and storage medium
By reading the calibration signal in the semi-finished state of the photoelectric sensor, setting the calibration mark bits and thresholds, and performing pulse signal processing and filtering, the problem of detection error after glue filling is solved, and high-precision detection of the photoelectric sensor is realized.
Patent Information
- Application Number
- CN202410271335.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-11
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2044-03-11
AI Technical Summary
When the photoelectric sensor is tested after glue filling, the detection result has a large error and insufficient accuracy due to the influence of the material.
By reading the calibration signal in the semi-finished state of the photoelectric sensor, setting the calibration mark value of the calibration mark bit, determining the calibration threshold and the response difference, controlling the pulse signal transmission, acquiring the received signal for sampling and filtering, and finally performing photoinductance detection based on the filtered signal.
It improves the measurement accuracy of the photoelectric sensor, reduces detection errors due to the influence of the material, and ensures accurate detection of the photoelectric sensor in different environments.
Smart Images

Figure CN118225153B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of photoelectric sensors, and in particular to a photoelectric sensor calibration detection method, device, photoelectric sensor, and storage medium. Background Art
[0002] Photoelectric sensors use photoelectric devices as conversion elements. They can be used to detect non-electrical quantities that directly cause changes in light intensity, such as distance detection. During the production process, due to differences in the materials used, light may refract or reflect as it propagates through different media, changing how it reaches the sensor. For example, glue-potting photoelectric sensors are surface-mount sensors manufactured using a glue-potting process. The speed of light propagating through the glue is affected by the glue molecules, which refract light. This can lead to inaccuracies in the test results when testing finished products after glue-potting. Summary of the Invention
[0003] In view of this, the present application provides a photoelectric sensor calibration detection method, device, photoelectric sensor and storage medium to solve the technical problem that the sensing distance detected by the finished photoelectric sensor is affected by the material of the photoelectric sensor.
[0004] A first aspect of the present application provides a photoelectric sensor calibration detection method, the method comprising:
[0005] Reading a calibration signal from a calibration interface, and setting a calibration identification value of a calibration identification bit according to the calibration signal, wherein the calibration signal is read when the photoelectric sensor is in a semi-finished state;
[0006] Determining a calibration threshold based on the calibration identification value, and obtaining a response difference value based on the calibration threshold;
[0007] Controlling the photoelectric sensor to transmit a pulse signal, and obtaining a received signal based on the pulse signal;
[0008] When it is detected that the transmission identification bit is a preset transmission identification value, sampling the received signal to obtain a sampled signal set;
[0009] Acquire multiple sampling signals from the sampling signal set to obtain a sampling signal group;
[0010] Performing filtering on the sampled signal group to obtain a filtered signal;
[0011] The photoelectric sensor performs photoelectric sensing detection based on the filtered signal, the calibration threshold, and the hysteresis value.
[0012] In an optional implementation, setting the calibration flag value of the calibration flag bit according to the calibration signal includes:
[0013] identifying whether the photoelectric sensor needs to be calibrated according to the calibration signal;
[0014] When it is determined that the photoelectric sensor needs to be calibrated, setting the calibration identification value of the calibration identification position to a first preset calibration identification value;
[0015] When it is determined that the photoelectric sensor does not need to be calibrated, the calibration identification value of the calibration identification position is set to a second preset calibration identification value.
[0016] In an optional embodiment, determining the calibration threshold based on the calibration identification value includes:
[0017] Determine whether there is a pre-stored threshold in the specified space of the memory;
[0018] When a pre-stored threshold value exists in the designated space of the memory and the calibration identification value is the first preset calibration identification value, the pre-stored threshold value is used as the calibration threshold value;
[0019] When there is no pre-stored threshold value in the designated space of the memory and the calibration identification value is the first preset calibration identification value, a preset threshold value is randomly selected from the preset threshold value range as the calibration threshold value.
[0020] In an optional embodiment, before performing photoelectric sensing detection on the photoelectric sensor based on the filtered signal, the calibration threshold, and the hysteresis value, the method further includes:
[0021] determining whether the photoelectric sensor is interfered with based on the sampling signal group;
[0022] When it is determined based on the sampled signal group that the photoelectric sensor is interfered with, increasing the hysteresis value to a specified hysteresis value;
[0023] When it is determined based on the sampling signal group that the photosensor is not disturbed, the hysteresis value is kept unchanged.
[0024] In an optional embodiment, determining whether the photoelectric sensor is interfered with based on the sampling signal group includes:
[0025] Obtaining a maximum sampling signal and a minimum sampling signal in the sampling signal group;
[0026] Calculating a difference sampling signal between the maximum sampling signal and the minimum sampling signal;
[0027] Comparing the difference sampling signal with a preset difference sampling signal threshold;
[0028] When the difference sampling signal is greater than the preset difference sampling signal threshold, determining that the photoelectric sensor is interfered with;
[0029] When the difference sampling signal is less than the preset difference sampling signal threshold, it is determined that the photoelectric sensor is not interfered with.
[0030] In an optional embodiment, the method further comprises:
[0031] When the presence of the pre-stored threshold is detected or the pre-stored threshold is obtained by calculation, the calibration flag is cleared;
[0032] After detecting that the transmission identification bit is the preset transmission identification value and completing sampling of the received signal, the transmission identification bit is cleared.
[0033] In an optional embodiment, the method further comprises:
[0034] Processing the sampled signal set using sliding filtering to obtain a new sampled signal group;
[0035] Performing filtering on the new sampling signal group to obtain a new filtered signal;
[0036] The photoelectric sensor is again subjected to photoelectric sensing detection based on the new filtered signal, the calibration threshold, and the hysteresis value.
[0037] A second aspect of the present application provides a photoelectric sensor calibration detection device, the device comprising:
[0038] An interface reading module, configured to read a calibration signal from a calibration interface and set a calibration identification value of a calibration identification bit according to the calibration signal;
[0039] A threshold determination module, configured to determine a calibration threshold based on the calibration identification value, and obtain a response difference value based on the calibration threshold;
[0040] A signal receiving module, used to control the photoelectric sensor to transmit a pulse signal and obtain a received signal based on the pulse signal;
[0041] A signal sampling module is used to sample the received signal to obtain a sampled signal set when detecting that the transmission identification bit is a preset transmission identification value;
[0042] a signal grouping module, configured to obtain a plurality of sampled signals from the sampled signal set to obtain a sampled signal group;
[0043] A signal filtering module, configured to filter the sampled signal group to obtain a filtered signal;
[0044] The sensing detection module is configured to perform photoelectric sensing detection on the photoelectric sensor based on the filtered signal, the calibration threshold, and the hysteresis value.
[0045] A third aspect of the present application provides a photoelectric sensor, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the photoelectric sensor calibration detection method when executing the computer program.
[0046] A fourth aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the photoelectric sensor calibration detection method when executed by a processor.
[0047] The photoelectric sensor calibration detection method, device, photoelectric sensor, and storage medium provided in the embodiments of the present application read the signal from the calibration interface and set the value of the calibration flag according to the signal; determine the calibration threshold based on the calibration flag value, and calculate the error value based on it; control the photoelectric sensor to transmit a pulse signal; obtain the received signal, and when it is detected that the transmission flag is a preset value, sample the received signal to obtain a sampled signal set; obtain multiple sampled signals from the sampled signal set to obtain a sampled signal group; filter the sampled signal group to obtain a filtered signal; and finally, perform photoelectric sensing detection on the photoelectric sensor based on the filtered signal, the calibration threshold, and the error value. By calibrating and detecting the photoelectric sensor before leaving the factory, the present application can ensure the measurement accuracy of the photoelectric sensor. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 1 is a flow chart of a photoelectric sensor calibration and detection method according to an embodiment of the present application;
[0049] Figure 2 1 is a functional module diagram of a photoelectric sensor calibration and detection device shown in an embodiment of the present application;
[0050] Figure 3 Schematic diagram of the structure of the photoelectric sensor shown in the embodiment of the present application. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in the embodiments of this application will be described below in conjunction with the drawings in the embodiments of this application.
[0052] The photoelectric sensor calibration and detection method provided in the embodiment of the present application is executed by a photoelectric sensor, and accordingly, the photoelectric sensor calibration and detection device runs in the photoelectric sensor.
[0053] Figure 1FIG1 is a flow chart of a photoelectric sensor calibration and detection method provided in Embodiment 1 of the present invention. The photoelectric sensor calibration and detection method specifically includes the following steps.
[0054] Photoelectric sensors are a common type of sensor, typically consisting of a transmitter and a receiver integrated into the same physical device. They simultaneously transmit light signals and receive reflected signals to detect the presence, location, or other attributes of a target object.
[0055] The transmitting end of a photoelectric sensor typically includes a light source, such as a laser diode or a light-emitting diode. The light source emits a beam of light. When the beam strikes a target object, a portion of the light is reflected by the target object. The properties of the target object determine the intensity, wavelength, and direction of the reflected light. The receiving end of a photoelectric sensor typically includes a photosensor, such as a photodiode or photoresistor, which receives the reflected light signal and converts it into an electrical signal. The converted electrical signal typically requires further processing, including amplification, filtering, and digitization, to improve signal quality and make it suitable for subsequent data analysis or control systems. By comparing the intensity or other properties of the received light signal, a photoelectric sensor can detect the presence, location, or other characteristics of a target object. When a target object blocks or interferes with the light beam, the received signal changes, which can be used to trigger an alarm or execute a control operation.
[0056] Photoelectric sensor devices with integrated transmitters and receivers are commonly used in automation and control applications, such as object detection, position detection, counting, and identification. By using a photoelectric sensor to detect the position or state of a target object, corresponding actions or feedback are triggered. Typical applications of these photoelectric sensor devices include automatic doors, vending machines, industrial robots, and printing machines.
[0057] S11, reading a calibration signal from a calibration interface, and setting a calibration identification value of a calibration identification bit according to the calibration signal, wherein the calibration signal is read when the photoelectric sensor is in a semi-finished state.
[0058] During the manufacturing process of photoelectric sensors, semi-finished photoelectric sensors offer easier access to internal components, interfaces, and signal lines for necessary adjustments and calibration. Reading calibration signals during the semi-finished stage ensures the proper functioning of the device or sensor after assembly. If the calibration interface of a photoelectric sensor is deaf or emits an abnormal signal, adjustments can be easily made. However, after glue filling, the calibration interface of a finished photoelectric sensor is sealed in glue and must be disassembled for adjustment. This glue removal process is cumbersome, and unnecessary disassembly can lead to further errors. By reading calibration signals during the semi-finished stage, the manufacturing process can better control the production process, ensuring that each component is properly calibrated and verified before being assembled into the entire device.
[0059] The photoelectric sensor reads the calibration signal from the calibration interface, which contains some specific calibration instructions or data. By analyzing the calibration signal, it can be determined whether the photoelectric sensor needs to be calibrated, and the calibration flag value of the calibration flag bit is set according to the calibration status.
[0060] By setting the calibration flag to determine whether calibration is required, you can ensure that the photoelectric sensor can operate quickly and concisely and provide accurate detection results.
[0061] In an optional implementation, setting the calibration flag value of the calibration flag bit according to the calibration signal includes:
[0062] Setting the calibration flag value of the calibration flag bit according to the calibration signal includes:
[0063] identifying whether the photoelectric sensor needs to be calibrated according to the calibration signal;
[0064] When it is determined that the photoelectric sensor needs to be calibrated, setting the calibration identification value of the calibration identification position to a first preset calibration identification value;
[0065] When it is determined that the photoelectric sensor does not need to be calibrated, the calibration identification value of the calibration identification position is set to a second preset calibration identification value.
[0066] By analyzing the calibration signal, it can be determined whether the photoelectric sensor needs to be calibrated. If the photoelectric sensor needs to be calibrated, the calibration flag value of the calibration flag in the photoelectric sensor is set to a first preset calibration flag value, which indicates that the photoelectric sensor needs to be calibrated. If the photoelectric sensor does not need to be calibrated, the calibration flag value of the calibration flag in the photoelectric sensor is set to a second preset calibration flag value, which indicates that the photoelectric sensor does not need to be calibrated.
[0067] In the above possible implementation manner, by using the calibration identification bit to record the calibration status, the calibration process is made more convenient, orderly and traceable, thereby improving the reliability and accuracy of the photoelectric sensor and reducing the error problem caused by confusion of the calibration status.
[0068] For example, when the photoelectric sensor reads a calibration signal of 0 from the calibration input and output interface, indicating that the photoelectric sensor needs to be calibrated, the calibration identification value of the calibration identification is recorded as 1; when the photoelectric sensor reads a calibration signal of 1 from the calibration input and output interface, indicating that the photoelectric sensor does not need to be calibrated, the calibration identification value of the calibration identification is recorded as 0.
[0069] S12, determining a calibration threshold based on the calibration identification value, and obtaining a differential value based on the calibration threshold.
[0070] Photoelectric sensors used for distance measurement use light to measure the distance between an object and the sensor. The closer an object is to the sensor, the stronger the light reflection, resulting in a larger received signal value. When a photoelectric sensor detects an object within its measurement range, it typically outputs a high-level signal or illuminates a light to indicate its presence. However, in practical applications, the performance of photoelectric sensors can be affected by various factors, including environmental conditions and material properties. If the photoelectric sensor is a glue-encapsulated product, light passing through the glue may refract, resulting in deviations and errors in the actual sampled signal value. For example, a photoelectric sensor has a measurement range of 20 meters. When the target object is 20 meters away from the sensor, the standard sampled signal value is 0.8V, meaning the sensor should be illuminated. However, due to the refraction of the glue, the actual sampled signal value is 0.76V, meaning the sensor is off, resulting in a detection error. Therefore, calibrating the photoelectric sensor's threshold can yield more accurate distance detection results.
[0071] When the calibration identification value indicates that calibration is required, a calibration threshold is obtained; when the calibration identification value indicates that calibration is not required, the threshold of the photoelectric sensor is not processed.
[0072] The difference can be calculated using the following formula:
[0073] The error value x = calibration threshold y - buffer value z.
[0074] The buffer value z is a pre-set threshold value used to adjust the sensitivity of the photoelectric sensor. For example, if the hysteresis value is set low, the photoelectric sensor will turn on or off more quickly, making it more sensitive. If the hysteresis value is set high, the photoelectric sensor will turn on or off more slowly, making it less sensitive. The hysteresis value can also be used to filter noise or prevent false positives. For example, if a photoelectric sensor is affected by ambient light, it may misjudge a signal. By setting the hysteresis value, the stability of the photoelectric sensor can be increased and the likelihood of false positives can be reduced.
[0075] It should be noted that when the object is closer to the photoelectric sensor, the reflection of the light will be stronger, and the photoelectric sensor will sample a larger received signal value. Therefore, the error value should be smaller than the calibration threshold, and the distance value corresponding to the error value should be greater than the distance value corresponding to the calibration threshold.
[0076] In the above possible implementations, the sensor is calibrated in an actual environment, the sensor output is adjusted to compensate for errors caused by environmental factors, and the error value is set to ensure that the photoelectric sensor can correctly light up or turn off the light under target conditions.
[0077] In an optional embodiment, determining the calibration threshold based on the calibration identification value includes:
[0078] Determine whether there is a pre-stored threshold in the specified space of the memory;
[0079] When a pre-stored threshold value exists in the designated space of the memory and the calibration identification value is the first preset calibration identification value, the pre-stored threshold value is used as the calibration threshold value;
[0080] When there is no pre-stored threshold value in the designated space of the memory and the calibration identification value is the first preset calibration identification value, a preset threshold value is randomly selected from the preset threshold value range as the calibration threshold value.
[0081] The designated space of the memory is checked, and if a pre-stored threshold value exists in the designated space of the memory and the calibration identification value is equal to the first preset calibration identification value, the pre-stored threshold value is selected as the calibration threshold value.
[0082] If there is no pre-stored threshold in the designated space of the memory, but the calibration identification value is equal to the first preset calibration identification value, a preset threshold is randomly selected from the preset threshold range as the calibration threshold, and the preset threshold range is determined according to the detection range of the photoelectric sensor. For example, the measurement range of the photoelectric sensor is 20M. When the target object is 20M away from the photoelectric sensor, the standard sampling signal value is 0.8V, and the preset threshold range is [0.8,1].
[0083] Since environmental and target conditions may change over time, using pre-stored thresholds can make the detection of photoelectric sensors more flexible and make corresponding adjustments according to changes in environmental conditions, ensuring that the photoelectric sensor can still accurately detect under different environmental conditions.
[0084] In the above possible implementation manner, the calibration threshold is determined by using the information stored in the memory to meet the ranging requirement of the photoelectric sensor.
[0085] For example, the measurement range of the photoelectric sensor is 20M. When the target object is 20M away from the photoelectric sensor, the standard sampling signal value is 0.8V. When the preset threshold Flash_v exists in the memory space, and Flash_v = 0.81, and the calibration identification value is 1, it indicates that the photoelectric sensor needs to be calibrated. In this case, the calibration threshold Flash = 0.81. When the preset threshold Flash_v does not exist in the memory space, or the preset threshold Flash_v = 0, and the calibration identification value is 1, it indicates that the photoelectric sensor needs to be calibrated. According to the measurement range of the photoelectric sensor, the value range of the calibration threshold Flash can be obtained as [0.8, 1]. A number within the value range is randomly selected as the calibration threshold, for example, Flash = 0.87.
[0086] S13, controlling the photoelectric sensor to transmit a pulse signal, and obtaining a received signal based on the pulse signal.
[0087] It should be noted that the photoelectric sensor is controlled to emit a single pulse signal when the finished product is in its final state. Because the speed of light propagating through glue is affected by the glue molecules, which refract light, testing the finished product after glue filling can result in errors and inaccuracies. Therefore, it is necessary to calibrate the photoelectric sensor after glue filling to minimize the effect of glue on the sensor.
[0088] When in operation, a photoelectric sensor emits a pulse signal and receives a reflected signal. The pulse signal is typically a beam of light of a specific wavelength, such as laser or infrared light, and is used to detect the distance between the target object and the photoelectric sensor. When the emitted light pulse intersects the target object, a portion of the light is reflected or scattered by the target object. The reflected or scattered light is the received signal. The photoelectric sensor captures and records the received signal through a built-in receiver or receiving element. The received signal contains interactive information with the target object, such as the degree of light reflection and scattering direction. By analyzing the interactive information in the received signal, information data related to the target object can be obtained, facilitating the subsequent measurement of the distance between the photoelectric sensor and the object.
[0089] In the above possible implementation manners, by controlling the pulse signal emission of the photoelectric sensor, information about the target object can be obtained, thereby determining the distance between the object and the sensor.
[0090] S14, when it is detected that the transmission identification bit is a preset transmission identification value, sampling the received signal to obtain a sampled signal set.
[0091] When the emission flag is detected as a preset emission flag value, indicating that the photoelectric sensor has transmitted a pulse signal, sampling processing is performed on the received signal. This sampling process involves capturing different aspects of the received signal, such as intensity, frequency, and waveform, depending on the type of photoelectric sensor and application requirements. The sampling process generates multiple sampling results, which are aggregated into a sampled signal set. The sampled signal set includes multiple sample signals, each of which corresponds to the received signal characteristics at a sampling point or time period.
[0092] In the above possible implementations, by sampling and processing the received signal based on the emission identification value, signal data related to the distance or other characteristics of the photoelectric sensor and the target object can be obtained. This is very useful in applications that require real-time monitoring, ranging, or detection of target object properties.
[0093] S15, acquiring multiple sampling signals from the sampling signal set to obtain a sampling signal group.
[0094] Each sampled signal in the sampled signal set represents information about the reflected signal at a specific point in time. Due to the special properties of pulse signals, the sampled signal set exhibits pulse characteristics, which can be used to determine the distance between the object and the photoelectric sensor. The sampled signal group typically includes multiple individual sampled signals, each corresponding to a received signal characteristic at a specific point in time during the sampling process or under specific conditions.
[0095] S16, performing filtering processing on the sampled signal group to obtain a filtered signal.
[0096] The sampled signal group includes a series of discrete signal samples or data points. Since the sampled signals are collected at different times or under different conditions and may contain noise or other interference factors, it is necessary to perform filtering processing on the data in the sampled signal group.
[0097] Median filtering is a common nonlinear signal processing technique used to eliminate noise and outliers. By replacing each data point in a sampled signal with the median value of the subsequence to which it belongs, the effects of outliers and noise can be eliminated. Specifically, the median filter processes each data point in the sampled signal in the order in which they were sampled, replacing it with the median value of the preceding and following data points. This effectively eliminates random noise and outliers without introducing noticeable distortion.
[0098] Arithmetic mean filtering is a common linear signal processing technique used to reduce the effects of noise and fluctuations. By calculating the arithmetic mean of all data points in a sampled signal group and replacing each data point with the arithmetic mean, it reduces the effects of noise and fluctuations, resulting in a smoother signal.
[0099] In this embodiment, median filtering and arithmetic mean filtering are used to process the sampled signal group to obtain a filtered signal. Specifically, the sampled signal group is first input into a median filter to perform median filtering on the sampled signals. The median filtering process eliminates the effects of outliers and noise and produces a set of median-filtered data points. The median-filtered data points are then input into an arithmetic mean filter to perform arithmetic mean filtering on the data. The arithmetic mean filtering process further smoothes the signal and reduces the effects of noise and fluctuations, resulting in a set of median-filtered and arithmetic mean-filtered data points, i.e., the filtered signal.
[0100] In the above possible implementation manners, by filtering the signal, noise or other interference factors can be reduced, which is beneficial for subsequent further analysis of the sampled signal.
[0101] S17: Perform photoelectric sensing detection on the photoelectric sensor based on the filtered signal, the calibration threshold, and the hysteresis value.
[0102] In this embodiment, a sliding window of a preset window length is used to sequentially read the filtered signals, for example, a sliding window of eight is used, and the eight filtered signals in the sliding window are used as the target sample signal group for this processing. The average value of the target sample signal group is calculated and used as the detection value of the current photoelectric sensor. Specifically, when the average value is greater than a calibration threshold, a high voltage is output, and the photoelectric sensor turns on; when the average value is less than a hysteresis value, a low voltage is output, and the photoelectric sensor turns off; when the average value is between the threshold and the hysteresis value, the photoelectric sensor maintains the voltage of the previous state, that is, if the previous state was high, the voltage is maintained high, and if the previous state was low, the voltage is maintained low.
[0103] The distance between the target object and the photoelectric sensor determines whether the sensor has passed calibration. When the distance between the target object and the photoelectric sensor exceeds the maximum detection distance of the photoelectric sensor, the photoelectric sensor should turn off; when the distance between the target object and the photoelectric sensor does not exceed the maximum detection distance of the photoelectric sensor, the photoelectric sensor should turn on. If the detection result of the photoelectric sensor does not match the preset value, it indicates that the photoelectric sensor calibration has failed and the calibration threshold needs to be adjusted.
[0104] If the pre-stored threshold value does not exist in the designated memory space, but the calibration identifier value is equal to the first preset calibration identifier value, the calibration threshold value needs to be recalculated, and the average value of the target sampling signal group is stored as the pre-stored calibration threshold value in the designated memory space. It should be noted that since this application is to calibrate the threshold value of the photoelectric sensor, the target detection object needs to be placed at the maximum detection distance of the photoelectric sensor during the detection process of calculating the calibration threshold value.
[0105] In an optional embodiment, before performing photoelectric sensing detection on the photoelectric sensor based on the filtered signal, the calibration threshold, and the hysteresis value, the method further includes:
[0106] determining whether the photoelectric sensor is interfered with based on the sampling signal group;
[0107] When it is determined based on the sampled signal group that the photoelectric sensor is interfered with, increasing the hysteresis value to a specified hysteresis value;
[0108] When it is determined based on the sampling signal group that the photosensor is not disturbed, the hysteresis value is kept unchanged.
[0109] In this embodiment, a sliding window with a preset window length is used to read the filtered signals in sequence. For example, a sliding window of eight is used in a group, and the eight filtered signals in the sliding window are used as the sampling signal group for this processing. The sampling signal group is then analyzed to determine whether the photoelectric sensor is interfered with.
[0110] If the analysis result shows that the photoelectric sensor is interfered with during the sampling process, a new hysteresis value is determined based on the data of the sampling signal group and the hysteresis value calculated by S12 to improve the response speed and anti-interference ability of the sensor.
[0111] If the analysis result indicates that the photoelectric sensor is not disturbed, the hysteresis value remains the hysteresis value calculated in S12 to maintain the normal operating state of the sensor.
[0112] In the above possible implementation manner, by processing the response difference under different environmental conditions, it is ensured that the photoelectric sensor can adapt to and maintain its performance when facing interference, and maintain its normal working state when there is no interference.
[0113] In an optional embodiment, determining whether the photoelectric sensor is interfered with based on the sampling signal group includes:
[0114] Obtaining a maximum sampling signal and a minimum sampling signal in the sampling signal group;
[0115] Calculating a difference sampling signal between the maximum sampling signal and the minimum sampling signal;
[0116] Comparing the difference sampling signal with a preset difference sampling signal threshold;
[0117] When the difference sampling signal is greater than the preset difference sampling signal threshold, determining that the photoelectric sensor is interfered with;
[0118] When the difference sampling signal is less than the preset difference sampling signal threshold, it is determined that the photoelectric sensor is not interfered with.
[0119] The maximum sampling signal and the minimum sampling signal are identified and extracted from the sampling signal group. By calculating the difference between the maximum sampling signal and the minimum sampling signal, a sampling signal difference can be obtained, and the difference represents the variation range of the sampling signal. The calculated sampling signal difference is compared with a preset difference threshold. If the sampling signal difference is greater than the preset difference threshold, it indicates that external factors may have interfered with the performance of the sensor, and further calibration of the photoelectric sensor is required. If the difference sampling signal is less than the preset difference sampling signal threshold, it indicates that the variation of the sampling signal is within an acceptable range, there is no significant external interference, and further calibration of the photoelectric sensor is not required.
[0120] In the above possible implementation, the range and variation of the sampled signal are analyzed to determine whether the photoelectric sensor is interfered with. If the difference signal exceeds a preset threshold, appropriate measures are taken to address the potential interference, thereby ensuring the accuracy and reliability of the photoelectric sensor.
[0121] For example, when the maximum sampling signal value is 0.811 V and the minimum sampling signal value is 0.796 V, the sampling signal difference value is 0.015 V. Since the difference threshold is 0.01 V, the difference value needs to be processed accordingly, and the new difference value should be 8.15 V + 0.015 V = 8.165 V.
[0122] In an optional embodiment, the method further comprises:
[0123] When the presence of the pre-stored threshold is detected or the pre-stored threshold is obtained by calculation, the calibration flag is cleared;
[0124] After detecting that the transmission identification bit is the preset transmission identification value and completing sampling of the received signal, the transmission identification bit is cleared.
[0125] Checks whether a pre-stored threshold value already exists in memory or has been successfully calculated. If a pre-stored threshold value is detected or calculated, the calibration flag is cleared. Clearing the calibration flag helps ensure that the calibration process is not repeated or triggered unnecessarily. Once the calibration flag is cleared, the calibration flag value will not be changed, ensuring that the photoelectric sensor operates as expected.
[0126] When the transmit flag is detected to be equal to the preset transmit flag value, the photoelectric sensor has completed a transmit operation and begins processing the received signal. After processing the received signal, the transmit flag is cleared to ensure correct processing of the received signal before the next transmit cycle. This clearing operation ensures that new transmit operations can be accurately detected and new received signals can be processed in the following transmit cycle.
[0127] In the above possible implementation manner, the accuracy and normal operation of the photoelectric sensor are ensured by clearing the identification bit under specific conditions.
[0128] In an optional embodiment, the method further comprises:
[0129] Processing the sampled signal set using sliding filtering to obtain a new sampled signal group;
[0130] Performing filtering on the new sampling signal group to obtain a new filtered signal;
[0131] The photoelectric sensor is again subjected to photoelectric sensing detection based on the new filtered signal, the calibration threshold, and the hysteresis value.
[0132] In this embodiment, a sliding window of a preset window length is used to sequentially read the sampled signals, for example, a sliding window of eight samples is used, and the eight sampled signals in the sliding window are used as the sampled signal group for processing. After processing the sampled signal group, the sliding window is slid a preset distance, for example, backward by the distance of one data point, to obtain a new sampled signal group. As shown in S16 and S17, the new sampled signal group is filtered, and the photoelectric sensor is again subjected to photoelectric sensing testing to determine whether the photoelectric sensor is qualified.
[0133] In the above possible implementation manner, the performance of the photoelectric sensor is calibrated by using a sliding window to detect multiple times, so that the photoelectric sensor can perform photoelectric sensing detection more accurately.
[0134] Figure 2 It is a structural diagram of a photoelectric sensor calibration and detection device provided in the second embodiment of the present invention.
[0135] In some embodiments, the photoelectric sensor calibration and detection device 20 may include a plurality of functional modules composed of computer program segments. The computer program of each program segment in the photoelectric sensor calibration and detection device 20 may be stored in a memory of the photoelectric sensor and executed by at least one processor to perform (see Figure 1 Description) Photoelectric sensor calibration detection function.
[0136] In this embodiment, the photoelectric sensor calibration and detection device 20 can be divided into multiple functional modules based on the functions they perform. These functional modules may include: an interface reading module 201, a threshold determination module 202, a signal receiving module 203, a signal sampling module 204, a signal grouping module 205, a signal filtering module 206, an induction detection module 207, an interference detection module 208, a zeroing processing module 209, and a slip detection module 210. As used herein, a module refers to a series of computer program segments that can be executed by at least one processor and perform fixed functions, and are stored in a memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.
[0137] The interface reading module 201 is used to read the calibration signal of the calibration interface and set the calibration identification value of the calibration identification bit according to the calibration signal. The calibration signal is read when the photoelectric sensor is in a semi-finished state.
[0138] During the manufacturing process of photoelectric sensors, semi-finished photoelectric sensors allow for easier access to internal components, interfaces, and signal lines for necessary adjustments and calibration. Reading calibration signals during the semi-finished stage ensures that the device or sensor will function properly after assembly. For example, if the calibration interface of a photoelectric sensor has no signal or emits an abnormal signal, the sensor can be easily adjusted. However, the calibration interface of a finished photoelectric sensor after glue filling is sealed in glue and can only be disassembled for adjustment. The glue removal process is very cumbersome, and unnecessary disassembly can also lead to more errors. By reading calibration signals during the semi-finished stage, the manufacturing process can better control the production process and ensure that each component is properly calibrated and verified before being assembled into the entire device.
[0139] The photoelectric sensor reads the calibration signal from the calibration interface, which contains some specific calibration instructions or data. By analyzing the calibration signal, it can be determined whether the photoelectric sensor needs to be calibrated, and the calibration flag value of the calibration flag bit is set according to the calibration status.
[0140] By setting the calibration flag to determine whether calibration is required, you can ensure that the photoelectric sensor can operate quickly and concisely and provide accurate detection results.
[0141] In an optional implementation, setting the calibration flag value of the calibration flag bit according to the calibration signal includes:
[0142] Setting the calibration flag value of the calibration flag bit according to the calibration signal includes:
[0143] identifying whether the photoelectric sensor needs to be calibrated according to the calibration signal;
[0144] When it is determined that the photoelectric sensor needs to be calibrated, setting the calibration identification value of the calibration identification position to a first preset calibration identification value;
[0145] When it is determined that the photoelectric sensor does not need to be calibrated, the calibration identification value of the calibration identification position is set to a second preset calibration identification value.
[0146] By analyzing the calibration signal, it can be determined whether the photosensor requires calibration. If the photosensor requires calibration, the calibration flag value of the calibration flag in the photosensor is set to a first preset calibration flag value, where the first preset calibration flag value indicates that the photosensor requires calibration. If the photosensor does not require calibration, the calibration flag value of the calibration flag in the photosensor is set to a second preset calibration flag value, where the second preset calibration flag value indicates that the photosensor does not require calibration.
[0147] In the above possible implementation manner, by using the calibration identification bit to record the calibration status, the calibration process is made more convenient, orderly and traceable, thereby improving the reliability and accuracy of the photoelectric sensor and reducing the error problem caused by confusion of the calibration status.
[0148] For example, when the photoelectric sensor reads a calibration signal of 0 from the calibration input and output interface, indicating that the photoelectric sensor needs to be calibrated, the calibration identification value of the calibration identification is recorded as 1; when the photoelectric sensor reads a calibration signal of 1 from the calibration input and output interface, indicating that the photoelectric sensor does not need to be calibrated, the calibration identification value of the calibration identification is recorded as 0.
[0149] The threshold determination module 202 is configured to determine a calibration threshold based on the calibration identification value, and obtain a differential value based on the calibration threshold.
[0150] Photoelectric sensors used for distance measurement use light to measure the distance between an object and the sensor. The closer an object is to the sensor, the stronger the light reflection, resulting in a larger received signal value. When a photoelectric sensor detects an object within its measurement range, it typically outputs a high-level signal or illuminates a light to indicate its presence. However, in practical applications, the performance of photoelectric sensors can be affected by various factors, including environmental conditions and material properties. If the photoelectric sensor is a glue-encapsulated product, light passing through the glue may refract, resulting in deviations and errors in the actual sampled signal value. For example, a photoelectric sensor has a measurement range of 20 meters. When the target object is 20 meters away from the sensor, the standard sampled signal value is 0.8V, meaning the sensor should be illuminated. However, due to the refraction of the glue, the actual sampled signal value is 0.76V, meaning the sensor is off, resulting in a detection error. Therefore, calibrating the photoelectric sensor's threshold can yield more accurate distance detection results.
[0151] When the calibration identification value indicates that calibration is required, a calibration threshold is obtained; when the calibration identification value indicates that calibration is not required, the threshold of the photoelectric sensor is not processed.
[0152] The difference can be calculated using the following formula:
[0153] The error value x = calibration threshold y - buffer value z.
[0154] The buffer value z is a pre-set threshold value used to adjust the sensitivity of the photoelectric sensor. For example, if the hysteresis value is set low, the photoelectric sensor will turn on or off more quickly, making it more sensitive. If the hysteresis value is set high, the photoelectric sensor will turn on or off more slowly, making it less sensitive. The hysteresis value can also be used to filter noise or prevent false positives. For example, if a photoelectric sensor is affected by ambient light, it may misjudge a signal. By setting the hysteresis value, the stability of the photoelectric sensor can be increased and the likelihood of false positives can be reduced.
[0155] It should be noted that when the object is closer to the photoelectric sensor, the reflection of the light will be stronger, and the photoelectric sensor will sample a larger received signal value. Therefore, the error value should be smaller than the calibration threshold, and the distance value corresponding to the error value should be greater than the distance value corresponding to the calibration threshold.
[0156] In the above possible implementations, the sensor is calibrated in an actual environment, the sensor output is adjusted to compensate for errors caused by environmental factors, and the error value is set to ensure that the photoelectric sensor can correctly light up or turn off the light under target conditions.
[0157] In an optional embodiment, determining the calibration threshold based on the calibration identification value includes:
[0158] Determine whether there is a pre-stored threshold in the specified space of the memory;
[0159] When a pre-stored threshold value exists in the designated space of the memory and the calibration identification value is the first preset calibration identification value, the pre-stored threshold value is used as the calibration threshold value;
[0160] When there is no pre-stored threshold value in the designated space of the memory and the calibration identification value is the first preset calibration identification value, a preset threshold value is randomly selected from the preset threshold value range as the calibration threshold value.
[0161] The designated space of the memory is checked, and if a pre-stored threshold value exists in the designated space of the memory and the calibration identification value is equal to the first preset calibration identification value, the pre-stored threshold value is selected as the calibration threshold value.
[0162] If there is no pre-stored threshold in the designated space of the memory, but the calibration identification value is equal to the first preset calibration identification value, a preset threshold is randomly selected from the preset threshold range as the calibration threshold, and the preset threshold range is determined according to the detection range of the photoelectric sensor. For example, the measurement range of the photoelectric sensor is 20M. When the target object is 20M away from the photoelectric sensor, the standard sampling signal value is 0.8V, and the preset threshold range is [0.8,1].
[0163] Since environmental and target conditions may change over time, using pre-stored thresholds can make the detection of photoelectric sensors more flexible and make corresponding adjustments according to changes in environmental conditions, ensuring that the photoelectric sensor can still accurately detect under different environmental conditions.
[0164] In the above possible implementation manner, the calibration threshold is determined by using the information stored in the memory to meet the ranging requirement of the photoelectric sensor.
[0165] For example, the measurement range of the photoelectric sensor is 20M. When the target object is 20M away from the photoelectric sensor, the standard sampling signal value is 0.8V. When the preset threshold Flash_v exists in the memory space, and Flash_v = 0.81, and the calibration identification value is 1, it indicates that the photoelectric sensor needs to be calibrated. In this case, the calibration threshold Flash = 0.81. When the preset threshold Flash_v does not exist in the memory space, or the preset threshold Flash_v = 0, and the calibration identification value is 1, it indicates that the photoelectric sensor needs to be calibrated. According to the measurement range of the photoelectric sensor, the value range of the calibration threshold Flash can be obtained as [0.8, 1]. A number within the value range is randomly selected as the calibration threshold, for example, Flash = 0.87.
[0166] The signal receiving module 203 is used to control the photoelectric sensor to transmit a pulse signal and obtain a received signal based on the pulse signal.
[0167] It should be noted that the photoelectric sensor is controlled to emit a single pulse signal when the finished product is in its final state. Because the speed of light propagating through glue is affected by the glue molecules, which refract light, testing the finished product after glue filling can result in errors and inaccuracies. Therefore, it is necessary to calibrate the photoelectric sensor after glue filling to minimize the effect of glue on the sensor.
[0168] When in operation, a photoelectric sensor emits a pulse signal and receives a reflected signal. The pulse signal is typically a beam of light of a specific wavelength, such as laser or infrared light, and is used to detect the distance between the target object and the photoelectric sensor. When the emitted light pulse intersects the target object, a portion of the light is reflected or scattered by the target object. The reflected or scattered light is the received signal. The photoelectric sensor captures and records the received signal through a built-in receiver or receiving element. The received signal contains interactive information with the target object, such as the degree of light reflection and scattering direction. By analyzing the interactive information in the received signal, information data related to the target object can be obtained, facilitating the subsequent measurement of the distance between the photoelectric sensor and the object.
[0169] In the above possible implementation manners, by controlling the pulse signal emission of the photoelectric sensor, information about the target object can be obtained, thereby determining the distance between the object and the sensor.
[0170] The signal sampling module 204 is configured to perform sampling processing on the received signal to obtain a sampled signal set when detecting that the transmission identification bit is a preset transmission identification value.
[0171] When the emission flag is detected as a preset emission flag value, indicating that the photoelectric sensor has transmitted a pulse signal, sampling processing is performed on the received signal. This sampling process involves capturing different aspects of the received signal, such as intensity, frequency, and waveform, depending on the type of photoelectric sensor and application requirements. The sampling process generates multiple sampling results, which are aggregated into a sampled signal set. The sampled signal set includes multiple sample signals, each of which corresponds to the received signal characteristics at a sampling point or time period.
[0172] In the above possible implementations, by sampling and processing the received signal based on the emission identification value, signal data related to the distance or other characteristics of the photoelectric sensor and the target object can be obtained. This is very useful in applications that require real-time monitoring, ranging, or detection of target object properties.
[0173] The signal grouping module 205 is configured to obtain a plurality of sampled signals from the sampled signal set to obtain a sampled signal group.
[0174] Each sampled signal in the sampled signal set represents information about the reflected signal at a specific point in time. Due to the special properties of pulse signals, the sampled signal set exhibits pulse characteristics, which can be used to determine the distance between the object and the photoelectric sensor. The sampled signal group typically includes multiple individual sampled signals, each corresponding to a received signal characteristic at a specific point in time during the sampling process or under specific conditions.
[0175] The signal filtering module 206 is configured to filter the sampled signal group to obtain a filtered signal.
[0176] The sampled signal group includes a series of discrete signal samples or data points. Since the sampled signals are collected at different times or under different conditions and may contain noise or other interference factors, it is necessary to perform filtering processing on the data in the sampled signal group.
[0177] Median filtering is a common nonlinear signal processing technique used to eliminate noise and outliers. By replacing each data point in a sampled signal with the median value of the subsequence to which it belongs, the effects of outliers and noise can be eliminated. Specifically, the median filter processes each data point in the sampled signal in the order in which they were sampled, replacing it with the median value of the preceding and following data points. This effectively eliminates random noise and outliers without introducing noticeable distortion.
[0178] Arithmetic mean filtering is a common linear signal processing technique used to reduce the effects of noise and fluctuations. By calculating the arithmetic mean of all data points in a sampled signal group and replacing each data point with the arithmetic mean, it reduces the effects of noise and fluctuations, resulting in a smoother signal.
[0179] In this embodiment, median filtering and arithmetic mean filtering are used to process the sampled signal group to obtain a filtered signal. Specifically, the sampled signal group is first input into a median filter to perform median filtering on the sampled signals. The median filtering process eliminates the effects of outliers and noise and produces a set of median-filtered data points. The median-filtered data points are then input into an arithmetic mean filter to perform arithmetic mean filtering on the data. The arithmetic mean filtering process further smoothes the signal and reduces the effects of noise and fluctuations, resulting in a set of median-filtered and arithmetic mean-filtered data points, i.e., the filtered signal.
[0180] In the above possible implementation manners, by filtering the signal, noise or other interference factors can be reduced, which is beneficial for subsequent further analysis of the sampled signal.
[0181] The sensing detection module 207 is configured to perform photoelectric sensing detection on the photoelectric sensor based on the filtered signal, the calibration threshold, and the hysteresis value.
[0182] In this embodiment, a sliding window of a preset window length is used to sequentially read the filtered signals, for example, a sliding window of eight is used, and the eight filtered signals in the sliding window are used as the target sample signal group for this processing. The average value of the target sample signal group is calculated and used as the detection value of the current photoelectric sensor. Specifically, when the average value is greater than a calibration threshold, a high voltage is output, and the photoelectric sensor turns on; when the average value is less than a hysteresis value, a low voltage is output, and the photoelectric sensor turns off; when the average value is between the threshold and the hysteresis value, the photoelectric sensor maintains the voltage of the previous state, that is, if the previous state was high, the voltage is maintained high, and if the previous state was low, the voltage is maintained low.
[0183] The distance between the target object and the photoelectric sensor determines whether the sensor has passed calibration. When the distance between the target object and the photoelectric sensor exceeds the maximum detection distance of the photoelectric sensor, the photoelectric sensor should turn off; when the distance between the target object and the photoelectric sensor does not exceed the maximum detection distance of the photoelectric sensor, the photoelectric sensor should turn on. If the detection result of the photoelectric sensor does not match the preset value, it indicates that the photoelectric sensor calibration has failed and the calibration threshold needs to be adjusted.
[0184] If the pre-stored threshold value does not exist in the designated memory space, but the calibration identifier value is equal to the first preset calibration identifier value, the calibration threshold value needs to be recalculated, and the average value of the target sampling signal group is stored as the pre-stored calibration threshold value in the designated memory space. It should be noted that since this application is to calibrate the threshold value of the photoelectric sensor, the target detection object needs to be placed at the maximum detection distance of the photoelectric sensor during the detection process of calculating the calibration threshold value.
[0185] an interference detection module 208, configured to determine whether the photoelectric sensor is interfered with based on the sampled signal group;
[0186] When it is determined based on the sampled signal group that the photoelectric sensor is interfered with, increasing the hysteresis value to a specified hysteresis value;
[0187] When it is determined based on the sampling signal group that the photosensor is not disturbed, the hysteresis value is kept unchanged.
[0188] In this embodiment, a sliding window with a preset window length is used to read the filtered signals in sequence. For example, a sliding window of eight is used in a group, and the eight filtered signals in the sliding window are used as the sampling signal group for this processing. The sampling signal group is then analyzed to determine whether the photoelectric sensor is interfered with.
[0189] If the analysis result indicates that the photoelectric sensor is interfered with during the sampling process, a new hysteresis value is determined based on the data of the sampling signal group and the hysteresis value calculated by the threshold determination module 202 to improve the response speed and anti-interference capability of the sensor.
[0190] If the analysis result indicates that the photoelectric sensor is not disturbed, the hysteresis value remains the hysteresis value calculated in S12 to maintain the normal operating state of the sensor.
[0191] In the above possible implementation manner, by processing the response difference under different environmental conditions, it is ensured that the photoelectric sensor can adapt to and maintain its performance when facing interference, and maintain its normal working state when there is no interference.
[0192] In an optional embodiment, determining whether the photoelectric sensor is interfered with based on the sampling signal group includes:
[0193] Obtaining a maximum sampling signal and a minimum sampling signal in the sampling signal group;
[0194] Calculating a difference sampling signal between the maximum sampling signal and the minimum sampling signal;
[0195] Comparing the difference sampling signal with a preset difference sampling signal threshold;
[0196] When the difference sampling signal is greater than the preset difference sampling signal threshold, determining that the photoelectric sensor is interfered with;
[0197] When the difference sampling signal is less than the preset difference sampling signal threshold, it is determined that the photoelectric sensor is not interfered with.
[0198] The maximum sampling signal and the minimum sampling signal are identified and extracted from the sampling signal group. By calculating the difference between the maximum sampling signal and the minimum sampling signal, a sampling signal difference can be obtained, and the difference represents the variation range of the sampling signal. The calculated sampling signal difference is compared with a preset difference threshold. If the sampling signal difference is greater than the preset difference threshold, it indicates that external factors may have interfered with the performance of the sensor, and further calibration of the photoelectric sensor is required. If the difference sampling signal is less than the preset difference sampling signal threshold, it indicates that the variation of the sampling signal is within an acceptable range, there is no significant external interference, and further calibration of the photoelectric sensor is not required.
[0199] In the above possible implementation, the range and variation of the sampled signal are analyzed to determine whether the photoelectric sensor is interfered with. If the difference signal exceeds a preset threshold, appropriate measures are taken to address the potential interference, thereby ensuring the accuracy and reliability of the photoelectric sensor.
[0200] For example, when the maximum sampling signal value is 0.811 V and the minimum sampling signal value is 0.796 V, the sampling signal difference value is 0.015 V. Since the difference threshold is 0.01 V, the difference value needs to be processed accordingly, and the new difference value should be 8.15 V + 0.015 V = 8.165 V.
[0201] A clearing processing module 209 is configured to clear the calibration flag when the presence of the pre-stored threshold is detected or the pre-stored threshold is obtained by calculation;
[0202] After detecting that the transmission identification bit is the preset transmission identification value and completing sampling of the received signal, the transmission identification bit is cleared.
[0203] Checks whether a pre-stored threshold value already exists in memory or has been successfully calculated. If a pre-stored threshold value is detected or calculated, the calibration flag is cleared. Clearing the calibration flag helps ensure that the calibration process is not repeated or triggered unnecessarily. Once the calibration flag is cleared, the calibration flag value will not be changed, ensuring that the photoelectric sensor operates as expected.
[0204] When the transmit flag is detected to be equal to the preset transmit flag value, the photoelectric sensor has completed a transmit operation and begins processing the received signal. After processing the received signal, the transmit flag is cleared to ensure correct processing of the received signal before the next transmit cycle. This clearing operation ensures that new transmit operations can be accurately detected and new received signals can be processed in the following transmit cycle.
[0205] In the above possible implementation manner, the accuracy and normal operation of the photoelectric sensor are ensured by clearing the identification bit under specific conditions.
[0206] A sliding detection module 210 is configured to process the sampled signal set using sliding filtering to obtain a new sampled signal group;
[0207] Performing filtering on the new sampling signal group to obtain a new filtered signal;
[0208] The photoelectric sensor is again subjected to photoelectric sensing detection based on the new filtered signal, the calibration threshold, and the hysteresis value.
[0209] In this embodiment, a sliding window of a preset window length is used to sequentially read the sampled signals, for example, a sliding window of eight samples is used, and the eight sampled signals in the sliding window are used as the sampled signal group for processing. After processing the sampled signal group, the sliding window is slid a preset distance, for example, backward by the distance of one data point, to obtain a new sampled signal group. The new sampled signal group is processed using the signal filtering module 206 and the sensing detection module 207, and the photoelectric sensor is again subjected to photoelectric sensing detection to determine whether the photoelectric sensor is qualified.
[0210] In the above possible implementation manner, the performance of the photoelectric sensor is calibrated by using a sliding window to detect multiple times, so that the photoelectric sensor can perform photoelectric sensing detection more accurately.
[0211] See Figure 3 FIG. 2 is a schematic diagram of the structure of the photoelectric sensor provided in an embodiment of the present application. In a preferred embodiment of the present application, the photoelectric sensor 3 includes a memory 31 , at least one processor 32 , and at least one communication bus 33 .
[0212] Those skilled in the art should understand that Figure 3 The structure of the photoelectric sensor shown does not constitute a limitation of the embodiments of the present application, and can be either a bus structure or a star structure. The photoelectric sensor 3 can also include more or less other hardware or software than shown in the figure, or a different component arrangement.
[0213] In some embodiments, the photoelectric sensor 3 is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions. Its hardware includes, but is not limited to, a microprocessor, an application-specific integrated circuit, a programmable gate array, a digital processor, and an embedded device. The photoelectric sensor 3 may also include other photoelectric sensors, including, but not limited to, any electronic product capable of human-computer interaction with a user via a keyboard, mouse, remote control, touchpad, or voice-controlled device, such as a personal computer, tablet computer, smartphone, digital camera, etc.
[0214] It should be noted that the photoelectric sensor 3 is only an example. Other existing or future electronic products that are suitable for this application should also be included in the protection scope of this application and included here by reference.
[0215] In some embodiments, the memory 31 stores a computer program that, when executed by the at least one processor 32, implements all or part of the steps in the above-described photoelectric sensor calibration and detection method. The memory 31 includes a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM), or other optical disk storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium capable of carrying or storing data.
[0216] In some embodiments, the at least one processor 32 serves as the control core (control unit) of the computer device 3. It utilizes various interfaces and circuits to connect the various components of the entire photoelectric sensor 3. It executes or runs programs or modules stored in the memory 31 and accesses data stored in the memory 31 to perform various functions and process data of the photoelectric sensor 3. For example, when executing the computer program stored in the memory, the at least one processor 32 implements all or part of the steps of the photoelectric sensor calibration and detection method described in the embodiments of the present application; or implements all or part of the functions of the photoelectric sensor calibration and detection method. The at least one processor 32 can be composed of an integrated circuit, such as a single packaged integrated circuit or multiple packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and a combination of various control chips.
[0217] In some embodiments, the at least one communication bus 33 is configured to enable communication between the memory 31 and the at least one processor 32. Although not shown, the photoelectric sensor 3 may also include a power supply (e.g., a battery) to power various components. Preferably, the power supply can be logically connected to the at least one processor 32 via a power management device, thereby enabling the power management device to manage charging, discharging, and power consumption. The power supply may also include one or more DC or AC power supplies, a recharging device, a power failure detection circuit, a power converter or inverter, a power status indicator, and other components. The photoelectric sensor 3 may also include various sensors, a Bluetooth module, a Wi-Fi module, and the like, which are not further detailed here.
[0218] The above-mentioned integrated unit implemented in the form of a software functional module can be stored in a computer-readable storage medium. The above-mentioned software functional module stored in a storage medium includes a number of instructions for causing a photoelectric sensor (which can be a personal computer, photoelectric sensor, or network device, etc.) or a processor to execute portions of the methods described in various embodiments of the present application.
[0219] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the module division is only a logical function division, and other division methods may be used in actual implementation.
[0220] The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical units, and may be located in one place or distributed across multiple network elements. Some or all of the modules may be selected to achieve the purpose of this embodiment based on actual needs.
[0221] The terms used in the embodiments of this application are only for the purpose of describing specific embodiments and are not intended to be limiting of this application. As used in the specification of this application and the appended claims, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include plural expressions, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in this application refers to any or all possible combinations comprising one or more of the listed items. The terms "first" and "second" are used for descriptive purposes only and are not to be understood as implying or suggesting relative importance or implicitly indicating the number of technical features indicated. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of these features, and in the description of the embodiments of this application, unless otherwise stated, the meaning of "multiple" is two or more.
[0222] The above content is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. A photoelectric sensor calibration detection method, characterized in that: The method comprises: Reading a calibration signal from a calibration interface, and setting a calibration identification value of a calibration identification bit according to the calibration signal, wherein the calibration signal is read when the photoelectric sensor is in a semi-finished state; Determining a calibration threshold based on the calibration identification value, and obtaining a hysteresis value based on the calibration threshold, wherein the hysteresis value is calculated by the following formula: hysteresis value = calibration threshold - buffer value, wherein the buffer value is a preset value used to adjust the sensitivity of the photoelectric sensor; Controlling the photoelectric sensor to transmit a pulse signal, and obtaining a received signal based on the pulse signal; When it is detected that the transmission identification bit is a preset transmission identification value, sampling the received signal to obtain a sampled signal set; Acquire multiple sampling signals from the sampling signal set to obtain a sampling signal group; Performing filtering on the sampled signal group to obtain a filtered signal; Performing photoelectric sensing detection on the photoelectric sensor based on the filtered signal, the calibration threshold, and the hysteresis value, specifically: A sliding window of a preset window length is used to read the filtered signal to obtain a target sampling signal group, and an average value of the target sampling signal group is calculated. When the average value is greater than a calibration threshold, the photoelectric sensor lights up, and when the average value is less than the error value, the photoelectric sensor turns off. Determine whether the photoelectric sensor is calibrated properly based on the distance between the target object and the photoelectric sensor. When the distance between the target object and the photoelectric sensor exceeds the maximum detection distance of the photoelectric sensor, the photoelectric sensor should turn off the light; When the distance between the target object and the photoelectric sensor does not exceed the maximum detection distance of the photoelectric sensor, the photoelectric sensor should light up. If the detection result of the photoelectric sensor does not match the preset result, it means that the calibration of the photoelectric sensor is unqualified and the calibration threshold needs to be adjusted.
2. The photoelectric sensor calibration and detection method according to claim 1, characterized in that: The step of setting the calibration flag value of the calibration flag bit according to the calibration signal includes: identifying whether the photoelectric sensor needs to be calibrated according to the calibration signal; When it is determined that the photoelectric sensor needs to be calibrated, setting the calibration identification value of the calibration identification position to a first preset calibration identification value; When it is determined that the photoelectric sensor does not need to be calibrated, the calibration identification value of the calibration identification position is set to a second preset calibration identification value.
3. The photoelectric sensor calibration and detection method according to claim 2, characterized in that: Determining the calibration threshold based on the calibration identification value includes: Determine whether there is a pre-stored threshold in the specified space of the memory; When a pre-stored threshold value exists in the designated space of the memory and the calibration identification value is the first preset calibration identification value, the pre-stored threshold value is used as the calibration threshold value; When there is no pre-stored threshold value in the designated space of the memory and the calibration identification value is the first preset calibration identification value, a preset threshold value is randomly selected from the preset threshold value range as the calibration threshold value.
4. The photoelectric sensor calibration and detection method according to claim 3, characterized in that: Before performing photoelectric sensing detection on the photoelectric sensor based on the filtered signal, the calibration threshold, and the hysteresis value, the method further includes: determining whether the photoelectric sensor is interfered with based on the sampling signal group; When it is determined based on the sampled signal group that the photoelectric sensor is interfered with, increasing the hysteresis value to a specified hysteresis value; When it is determined based on the sampling signal group that the photosensor is not disturbed, the hysteresis value is kept unchanged.
5. The photoelectric sensor calibration and detection method according to claim 4, characterized in that: The determining whether the photoelectric sensor is interfered with based on the sampling signal group includes: Obtaining a maximum sampling signal and a minimum sampling signal in the sampling signal group; Calculating a difference sampling signal between the maximum sampling signal and the minimum sampling signal; Comparing the difference sampling signal with a preset difference sampling signal threshold; When the difference sampling signal is greater than the preset difference sampling signal threshold, determining that the photoelectric sensor is interfered with; When the difference sampling signal is less than the preset difference sampling signal threshold, it is determined that the photoelectric sensor is not interfered with.
6. The photoelectric sensor calibration and detection method according to claim 4, characterized in that: The method further comprises: When the presence of the pre-stored threshold is detected or the pre-stored threshold is obtained by calculation, the calibration flag is cleared; After detecting that the transmission identification bit is the preset transmission identification value and completing sampling of the received signal, the transmission identification bit is cleared.
7. The photoelectric sensor calibration and detection method according to any one of claims 1 to 6, characterized in that: The method further comprises: Processing the sampled signal set using sliding filtering to obtain a new sampled signal group; Performing filtering on the new sampling signal group to obtain a new filtered signal; The photoelectric sensor is again subjected to photoelectric sensing detection based on the new filtered signal, the calibration threshold, and the hysteresis value.
8. A photoelectric sensor calibration detection device, applied to a photoelectric sensor calibration detection method according to claim 1, characterized in that: The device comprises: An interface reading module, configured to read a calibration signal from a calibration interface and set a calibration identification value of a calibration identification bit according to the calibration signal; A threshold determination module, configured to determine a calibration threshold based on the calibration identification value, and obtain a response difference value based on the calibration threshold; A signal receiving module, used to control the photoelectric sensor to transmit a pulse signal and obtain a received signal based on the pulse signal; A signal sampling module is used to sample the received signal to obtain a sampled signal set when detecting that the transmission identification bit is a preset transmission identification value; a signal grouping module, configured to obtain a plurality of sampled signals from the sampled signal set to obtain a sampled signal group; A signal filtering module, configured to filter the sampled signal group to obtain a filtered signal; The sensing detection module is configured to perform photoelectric sensing detection on the photoelectric sensor based on the filtered signal, the calibration threshold, and the hysteresis value.
9. A photoelectric sensor, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the photoelectric sensor calibration and detection method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the photoelectric sensor calibration and detection method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Sensor calibration controller
CN102928010A
Photoelectric sensor
CN108917801A