Photoelectric sensor control method and device, equipment and storage medium
By analyzing the target detection distance, interval change and change rate of the photoelectric sensor, and combining the calibration threshold to dynamically generate ADC values, the problem of large error in the set distance of the photoelectric sensor is solved, high-precision distance mapping control and high software versatility are achieved, and development costs and software management complexity are reduced.
Patent Information
- Application Number
- CN202510938784.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-08
- Publication Date
- 2025-09-30
AI Technical Summary
Existing photoelectric sensor control technology has problems such as large set distance errors, numerous software versions, and high development and maintenance costs. This is mainly due to the fixed lookup table method caused by imperfect filtering algorithms and hardware installation errors, which cannot adapt to different electric eyes, resulting in a large error between the set distance and the actual sensing distance.
By analyzing the change in the target detection distance and the preset interval and the interval change rate, and combining the calibration threshold to dynamically generate ADC values, high-precision distance mapping control of photoelectric sensors in complex environments can be achieved. Amplitude offset calibration and filtering processing are used to eliminate hardware delay errors and dynamically generate analog-to-digital converter values.
The control accuracy of the sensor's set distance and actual sensing distance has been improved, the development cost of multiple SKU versions and the complexity of software management have been reduced, and the stability and versatility of the system have been improved.
Smart Images

Figure CN120721141A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of sensor technology, and in particular to a control method, device, equipment, and storage medium for a photoelectric sensor. Background Art
[0002] Existing photoelectric sensor control technology uses a fixed lookup table method to achieve distance setting by pre-setting the mapping relationship between emission current and sensing threshold. However, it is limited by problems such as imperfect filtering algorithm and hardware installation errors that require separate matching lookup tables. There are defects such as large error in setting distance, numerous software versions and high development and maintenance costs. Summary of the Invention
[0003] The main purpose of this application is to provide a control method, device, equipment and storage medium for a photoelectric sensor, aiming to solve the technical problems of the existing photoelectric sensor technology, such as large error between the set distance and the actual sensing distance, and complex software control.
[0004] To achieve the above objectives, the present application proposes a control method for a photoelectric sensor, the control method for the photoelectric sensor comprising:
[0005] In response to a sensor control instruction for a photoelectric sensor, determining a target detection distance of the photoelectric sensor according to the sensor control instruction;
[0006] Determining the target detection distance and the interval variation between each distance interval;
[0007] Determine interval change rates corresponding to multiple distance intervals based on effective sensing values at each target position collected by each sample sensor under the corresponding calibration current;
[0008] Determine a target analog-to-digital converter value corresponding to the target detection distance according to the target detection distance and the interval change amount between each distance interval, the interval change rate corresponding to each distance interval, and the calibration sensing threshold corresponding to the photoelectric sensor;
[0009] Detection control is performed according to the target analog-to-digital converter value.
[0010] In one embodiment, before the step of determining the interval change rates corresponding to the plurality of distance intervals based on the effective sensing values at the target positions collected by the sample sensors under the corresponding calibration current, the step further includes:
[0011] performing amplitude offset calibration on a plurality of sample sensors to determine a sampling delay time of each sample sensor;
[0012] Calibrate the sensing values collected by each sample sensor under multiple emission currents according to the sampling delay time of each sample sensor, and determine the average of the sensing values of each sample sensor under the multiple emission currents according to the calibration result;
[0013] The calibration current of each sample sensor and the calibration sensing threshold of each sample sensor are determined according to the average value of the sensing values of each sample sensor under multiple emission currents and the sensing critical value.
[0014] In one embodiment, the step of performing amplitude offset calibration on a plurality of sample sensors and determining a sampling delay time of each sample sensor includes:
[0015] Controlling multiple sample sensors to perform data sampling and determining original sensing values corresponding to multiple delay times of each sample sensor;
[0016] sorting the original sensing values corresponding to the multiple delay times of each sample sensor respectively, and determining the maximum sensing value of each sample sensor among the multiple original sensing values of each sample sensor according to the sorting result;
[0017] The sampling delay time of each sample sensor is determined according to the sampling time corresponding to the maximum sensing value of each sample sensor.
[0018] In one embodiment, the step of calibrating the sensing values collected by each sample sensor under multiple emission currents according to the sampling delay time of each sample sensor, and determining the average of the sensing values of each sample sensor under the multiple emission currents according to the calibration result includes:
[0019] Calibrate multiple sensing values collected by each sample sensor under multiple emission currents according to the sampling delay time of each sample sensor to obtain multiple calibration sensing values of each sample sensor under the multiple emission currents;
[0020] Perform extreme value filtering on the calibration sensing values of each sample sensor under multiple emission currents to obtain multiple target sensing values of each sample sensor under multiple emission currents;
[0021] The average values of the target sensing values of each sample sensor under the multiple emission currents are calculated respectively to determine the average value of the sensing values of each sample sensor under the multiple emission currents.
[0022] In one embodiment, the step of determining the calibration current and the calibration sensing threshold of each sample sensor according to the average sensing value and the sensing threshold of each sample sensor under multiple emission currents includes:
[0023] The average sensing value and sensing critical value of each sample sensor at each emission current are compared respectively;
[0024] When the average of the sensing values of the sample sensors is less than or equal to the sensing critical value, determining the calibration sensing threshold of each sample sensor;
[0025] The calibration current of each sample sensor is determined according to the emission current corresponding to the calibration sensing threshold of each sample sensor.
[0026] In one embodiment, the step of determining interval change rates corresponding to a plurality of distance intervals based on the effective sensing values at each target position collected by each sample sensor under the corresponding calibration current includes:
[0027] Performing segmented fitting based on the effective sensing values of each sample sensor at each target position collected under the corresponding calibration current to determine the slope of the interval curve of each sample sensor in multiple distance intervals;
[0028] The average value of the interval curve slopes of each sample sensor in multiple distance intervals is calculated to obtain the interval change rates corresponding to the multiple distance intervals.
[0029] In one embodiment, the step of determining a target analog-to-digital converter value corresponding to the target detection distance based on the interval change between the target detection distance and each distance interval, the interval change rate corresponding to each distance interval, and a calibration sensing threshold corresponding to the photoelectric sensor includes:
[0030] Comparing the target detection distance with the calibration distance to determine the magnitude relationship between the target detection distance and the calibration distance;
[0031] Determine a threshold calculation method according to the size relationship between the target detection distance and the calibration distance;
[0032] A threshold value is calculated based on the threshold calculation method, the interval change between the target detection distance and each distance interval, the interval change rate corresponding to each distance interval, and the calibrated sensing threshold corresponding to the photoelectric sensor to determine the target analog-to-digital converter value corresponding to the target detection distance.
[0033] In addition, to achieve the above-mentioned purpose, the present application also proposes a control device for a photoelectric sensor, the control device for the photoelectric sensor comprising:
[0034] a response module, configured to respond to a sensor control instruction for the photoelectric sensor and determine a target detection distance of the photoelectric sensor according to the sensor control instruction;
[0035] a processing module, configured to determine a target detection distance and an interval variation between each distance interval;
[0036] The processing module is further configured to determine interval change rates corresponding to a plurality of distance intervals based on effective sensing values at each target position collected by each sample sensor under a corresponding calibration current.
[0037] The processing module is used to determine the target analog-to-digital converter value corresponding to the target detection distance based on the interval change between the target detection distance and each distance interval, the interval change rate corresponding to each distance interval, and the calibration sensing threshold corresponding to the photoelectric sensor;
[0038] A control module is used to perform detection control according to the target analog-to-digital converter value.
[0039] In addition, to achieve the above-mentioned purpose, the present application also proposes a control device for a photoelectric sensor, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the control method for the photoelectric sensor as described above.
[0040] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium and stores a computer program. When the computer program is executed by a processor, the steps of the control method of the photoelectric sensor as described above are implemented.
[0041] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps of the control method of the photoelectric sensor as described above are implemented.
[0042] The present application responds to a sensor control instruction for a photoelectric sensor, determines the target detection distance of the photoelectric sensor according to the sensor control instruction; determines the interval change between the target detection distance and each distance interval; determines the interval change rate corresponding to multiple distance intervals based on the effective sensing value of each sample sensor at each target position collected under the corresponding calibration current; determines the target analog-to-digital converter value corresponding to the target detection distance based on the interval change between the target detection distance and each distance interval, the interval change rate corresponding to each distance interval, and the calibration sensing threshold corresponding to the photoelectric sensor; and performs detection control based on the target analog-to-digital converter value. Through the above method, by analyzing the change between the target detection distance and the preset interval and the sensing specific change rate corresponding to each interval, and combining the calibration threshold to dynamically generate an ADC value, high-precision distance mapping control of the photoelectric sensor in complex environments is achieved, effectively solving the problem of large error in setting the distance caused by the traditional fixed lookup table method, significantly improving the control accuracy of the sensor set distance and the actual sensing distance, and achieving high software versatility under the same hardware circuit, significantly reducing the development cost of multiple SKU versions and the complexity of software management, and improving the stability and versatility of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0044] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0045] Figure 1 A flowchart of a first embodiment of a method for controlling a photoelectric sensor according to the present invention is provided;
[0046] Figure 2 A schematic diagram of a sampling value curve provided in Example 1 of the present application;
[0047] Figure 3 A flow chart of the second embodiment of the control method of the photoelectric sensor of the present application is provided;
[0048] Figure 4 This is a schematic diagram of the waveform before calibration provided in Example 2 of the present application;
[0049] Figure 5 This is a schematic diagram of the calibrated waveform provided in Example 2 of the present application;
[0050] Figure 6 This is a schematic diagram of the module structure of the control device of the photoelectric sensor according to the embodiment of the present application;
[0051] Figure 7 Schematic diagram of the device structure of the hardware operating environment involved in the control method of the photoelectric sensor in the embodiment of the present application.
[0052] The purpose, features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0053] It should be understood that the specific embodiments described herein are merely used to explain the technical solutions of the present application and are not intended to limit the present application.
[0054] In order to better understand the technical solution of this application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0055] The main solution of the embodiment of the present application is: in response to a sensor control instruction for a photoelectric sensor, determining the target detection distance of the photoelectric sensor according to the sensor control instruction; determining the interval change between the target detection distance and each distance interval; determining the interval change rate corresponding to multiple distance intervals based on the effective sensing value at each target position collected by each sample sensor under the corresponding calibration current; determining the target analog-to-digital converter value corresponding to the target detection distance based on the interval change between the target detection distance and each distance interval, the interval change rate corresponding to each distance interval, and the calibration sensing threshold corresponding to the photoelectric sensor; and performing detection control based on the target analog-to-digital converter value.
[0056] As a core component for human body sensing, the stability and reliability of photoelectric sensors (commonly known as electric eyes) have long been a research priority. Due to cost constraints, current electric eye control technologies typically rely on infrared and VCSEL (Vertical-Cavity Surface-Emitting Laser) technology. During actual installation and use, electric eyes are often affected by environmental factors (such as doors, bright objects, and installation angle), requiring distance readjustment. Current electric eye products are compatible with visual remote controls, allowing one-click transmission of distance values and customizable distance ranges (e.g., 50-130 cm), greatly improving after-sales service convenience. However, existing technology, after normalizing data collected from multiple electric eyes, stores the emission current and sensing threshold values for each distance in a fixed lookup table. Software then uses these values for comparison purposes. This results in the following drawbacks: 1. Imperfect filtering algorithms lead to large fluctuations in the analog-to-digital (Analog-to-Digital) values, resulting in unstable distances. 2. When different sensors read the received signal, the reading timing is prone to offset, resulting in the read AD value not being the maximum amplitude of the received signal. Ultimately, under the same current, the sensing distance is significantly shortened, resulting in a large error between the set distance and the actual sensing distance, with the set distance error being ±15% or even ±20%. 3. Under the same circuit hardware, installation errors cannot be adapted. Each sensor needs to be matched with a separate lookup table, which increases the development workload, the number of software SKU (Stock Keeping Unit) versions, and the difficulty of software management.
[0057] The present application provides a solution that realizes high-precision distance mapping control of photoelectric sensors in complex environments by analyzing the change between the target detection distance and the preset interval and the specific sensing change rate corresponding to each interval, and dynamically generates ADC values in combination with calibration thresholds. It effectively solves the problem of large error in the set distance caused by the traditional fixed lookup table method, greatly improves the control accuracy of the sensor's set distance and actual sensing distance, and at the same time realizes high versatility of software under the same hardware circuit, significantly reduces the development cost of multiple SKU versions and the complexity of software management, and improves the stability and versatility of the system.
[0058] It should be noted that the execution subject of this embodiment may be a computing service device with data processing, network communication, and program execution capabilities, such as a tablet computer, personal computer, or mobile phone, or a photoelectric sensor control device capable of implementing the aforementioned functions. This embodiment and the following embodiments will be described below using a photoelectric sensor control device as the execution subject.
[0059] Based on this, the embodiment of the present application provides a control method for a photoelectric sensor, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the control method of the photoelectric sensor of the present application.
[0060] In this embodiment, the control method of the photoelectric sensor includes steps S10 to S50:
[0061] Step S10 : In response to a sensor control instruction for a photoelectric sensor, determining a target detection distance of the photoelectric sensor according to the sensor control instruction.
[0062] It should be noted that a photoelectric sensor refers to a device that detects physical objects or presence by emitting and receiving light signals (e.g., infrared light, laser, etc.), such as infrared sensors and laser sensors. A sensor control command is a command input by the user or system to set the target detection distance parameter. For example, to set the sensing distance to 80 cm, in this embodiment, the sensor control command is sent by a device such as a host computer or remote control. The target detection distance is the standard distance that the photoelectric sensor is expected to detect.
[0063] It is understandable that after receiving the sensor control instruction for the photoelectric sensor, the sensor control is parsed to determine the target detection distance of the photoelectric sensor.
[0064] Step S20: determining the target detection distance and the interval variation between each distance interval.
[0065] It should be noted that the distance interval is a distance range segment obtained by dividing the effective detection distance range of the photoelectric sensor into multiple small intervals. In this embodiment, taking the effective detection distance range of 50 to 130 cm as an example, the divided distance intervals include distance interval 1: 50 cm to 60 cm; distance interval 2: 60 cm to 70 cm; distance interval 3: 70 cm to 80 cm; distance interval 4: 80 cm to 90 cm; distance interval 5: 90 cm to 100 cm; distance interval 6: 100 cm to 110 cm; distance interval 7: 110 cm to 120 cm; and distance interval 8: 120 cm to 130 cm.
[0066] It is understood that before determining the target detection distance and the interval variation between each distance interval, a calibration distance and the corresponding calibration sensing threshold are first obtained. Each photoelectric sensor is calibrated at the factory to obtain its calibration distance and the corresponding calibration sensing threshold. In this embodiment, the calibration distance is 90 cm, and the calibration sensing threshold is X.
[0067] In a specific implementation, after determining the target detection range, the calibration distance is used as the critical distance, and multiple distance intervals are divided into two regions. The region in which the target detection range is located is determined, and the interval change between the target detection range and each distance interval within the region is calculated. The interval change between the target detection range and each distance interval reflects the positional deviation between the target detection range and each distance interval.
[0068] It can be understood that, taking the calibration distance of 90 cm as an example, the multiple distance intervals within the effective detection distance range of 50 cm to 130 cm are divided into two regions. The distance intervals included in Region A are: Distance Interval 1: 50 cm to 60 cm; Distance Interval 2: 60 cm to 70 cm; Distance Interval 3: 70 cm to 80 cm; Distance Interval 4: 80 cm to 90 cm; and the distance intervals included in Region B are: Distance Interval 5: 90 cm to 100 cm; Distance Interval 6: 100 cm to 110 cm; Distance Interval 7: 110 cm to 120 cm; and Distance Interval 8: 120 cm to 130 cm. When the target detection distance is 125 cm, the interval change between the target detection distance and each distance interval in Region B is calculated. The interval change between the target detection distance and distance interval 5 is 10, the interval change between the target detection distance and distance interval 6 is 10, the interval change between the target detection distance and distance interval 7 is 10, and the interval change between the target detection distance and distance interval 8 is 5. When the target detection distance is 65cm, the interval change between the target detection distance in area A and each distance interval is calculated. The interval change between the target detection distance and distance interval 1 is 0, the interval change between the target detection distance and distance interval 2 is 5, the interval change between the target detection distance and distance interval 3 is 10, and the interval change between the target detection distance and distance interval 4 is 10.
[0069] Step S30 , determining interval change rates corresponding to a plurality of distance intervals based on the effective sensing values at each target position collected by each sample sensor under the corresponding calibration current.
[0070] It should be noted that the calibration current refers to the optimal emission current value determined during the calibration phase. Each sample sensor has a corresponding calibration current. The effective sensing value is the ADC (Analog-to-Digital Converter) value after amplitude offset calibration and filtering. The interval change rate refers to the interval slope, which indicates the change in the ADC value corresponding to a change in the distance interval.
[0071] It can be understood that for each sample sensor: under the calibration current, the effective sensing values at each target position are collected, and the effective sensing values of each distance interval are piecewise linearly fitted to obtain the slope of each distance interval; for each distance interval; the average slope of all sample sensors in the distance interval is calculated, so as to obtain the interval change rate corresponding to multiple distance intervals.
[0072] In this embodiment, the target position includes, but is not limited to, the starting and ending distance positions of each distance interval. Taking the effective detection distance range of 50 cm to 130 cm as an example, the target positions include, but are not limited to, 50 cm, 60 cm, 70 cm, 80 cm, 90 cm, 100 cm, 110 cm, 120 cm, and 130 cm. The type and model of each sample sensor are not limited in this embodiment.
[0073] In a feasible implementation, step S30 may include steps A11 to A12:
[0074] Step A11 : performing segmented fitting based on the effective sensing values at each target position collected by each sample sensor under the corresponding calibration current, and determining the slope of the interval curve of each sample sensor in multiple distance intervals.
[0075] It should be noted that for each sample sensor, effective sensing values at each target location are collected under a calibration current to form a "distance-sensing value" dataset. This dataset is then divided into multiple subsegments based on distance intervals, with each subsegment corresponding to a distance interval. The data for each subsegment is fitted to obtain the slope of the interval curve for each distance interval. The interval curve slope represents the rate at which the sensing value changes with distance within that distance interval. In this embodiment, linear fitting is used as the fitting method, but other fitting methods may also be used and are not limited in this embodiment.
[0076] Step A12: performing mean calculation based on the slopes of the interval curves of each sample sensor in multiple distance intervals to obtain interval change rates corresponding to the multiple distance intervals.
[0077] It should be noted that the slopes of the interval curves for multiple sample sensors within the same distance range are averaged to reduce individual sensor errors and improve data stability and versatility. The interval change rate corresponding to each distance range refers to the average slope value of each distance range obtained through mean calculation, which is used to characterize the overall pattern of sensor value variation with distance within that distance range.
[0078] It is understandable that if Figure 2 As shown, Figure 2The sample value curves are formed by the effective sensing values collected by multiple sample sensors at different target positions under the corresponding calibration current. By performing segmented fitting on each distance interval and taking the average value, the interval change rates of each distance interval are obtained as follows: Distance interval 1: 50cm-60cm interval change rate K0 is 92; Distance interval 2: 60cm-70cm interval change rate K1 is 64; Distance interval 3: 70cm-80cm interval change rate K2 is 46; Distance interval 4: 80cm-90cm interval change rate K3 is 33; Distance interval 5: 90cm-100cm interval change rate K4 is 25; Distance interval 6: 100cm-110cm interval change rate K5 is 18; Distance interval 7: 110cm-120cm interval change rate K6 is 10; Distance interval 8: 120cm-130cm interval change rate K7 is 8.
[0079] Step S40 , determining a target analog-to-digital converter value corresponding to the target detection distance according to the target detection distance and the interval variation between each distance interval, the interval variation rate corresponding to each distance interval, and the calibration sensing threshold corresponding to the photoelectric sensor.
[0080] It should be noted that the ADC sensing threshold corresponding to the target detection distance is obtained by linear fitting or weighted calculation using the photoelectric sensor's calibrated sensing threshold X at the calibrated distance, combined with the interval change between the target distance and each distance interval, and the interval change rate corresponding to each distance interval. In this embodiment, the target ADC (Analog-to-Digital Converter) value refers to the ADC sensing threshold corresponding to the target detection distance.
[0081] In a feasible implementation, step S40 may include steps B11 to B13:
[0082] Step B11: Compare the target detection distance with the calibration distance to determine the size relationship between the target detection distance and the calibration distance.
[0083] Step B12: determining a threshold calculation method according to a size relationship between the target detection distance and the calibration distance.
[0084] It should be noted that the target detection distance is compared with the calibration distance to determine the magnitude relationship between the target detection distance and the calibration distance. Different magnitude relationships correspond to different threshold calculation methods. In this embodiment, when the target detection distance is less than the calibration distance, the threshold calculation method is specifically: target ADC value Y = X + a × K3 + b × K2 + c × K1 + d × K0; when the target detection distance is greater than or equal to the calibration distance, the threshold calculation method is specifically: target ADC value Y = Xe × K4 - f × K5 - g × K6 - h × K7; where a-h are the interval changes between the target detection distance and each distance interval, and K0-K7 are the interval change rates for each distance interval.
[0085] It can be understood that when the sensing distance is closer, the ADC value is larger due to enhanced reflection. Conversely, when the sensing distance is farther, the emission is weakened, so the ADC value is smaller.
[0086] Step B13, performing threshold calculation based on the threshold calculation method, the interval change between the target detection distance and each distance interval, the interval change rate corresponding to each distance interval, and the calibrated sensing threshold corresponding to the photoelectric sensor, to determine the target analog-to-digital converter value corresponding to the target detection distance.
[0087] It should be noted that the target ADC value corresponding to the target detection distance is calculated by substituting the target detection distance and the interval change between each distance interval, the interval change rate corresponding to each distance interval, and the calibrated sensing threshold into the threshold calculation method. For example, if the target detection distance is 125 cm and the calibrated sensing threshold is 870, the threshold calculation method is target ADC value Y = Xe × K4 - f × K5 - g × K6 - h × K7. In this case, the interval change e between the target detection distance and distance interval 5 is 10, the interval change f between the target detection distance and distance interval 6 is 10, the interval change g between the target detection distance and distance interval 7 is 10, and the interval change h between the target detection distance and distance interval 8 is 0. K4 to K7 are 25, 18, 10, and 8, respectively. In this case, the target ADC value Y = 870 - 10 × 25 - 10 × 18 - 10 × 10 - 5 × 8 = 300.
[0088] For example, if the target detection distance is 62 cm and the calibrated sensing threshold is 870, the threshold calculation method is target ADC value Y = X + a × K3 + b × K2 + c × K1 + d × K0. Here, the interval change d between the target detection distance and distance interval 1 is 0, the interval change c between the target detection distance and distance interval 2 is 5, the interval change b between the target detection distance and distance interval 3 is 10, and the interval change a between the target detection distance and distance interval 4 is 10. K0 to K3 are 92, 64, 46, and 33, respectively. In this case, the target ADC value Y = 870 + 10 × 33 + 10 × 46 + 5 × 64 + 0 × 92 = 1988.
[0089] When the target detection distance is 65cm, the interval change between the target detection distance in area A and each distance interval is calculated. The interval change between the target detection distance and distance interval 1 is 0, the interval change between the target detection distance and distance interval 2 is 5, the interval change between the target detection distance and distance interval 3 is 10, and the interval change between the target detection distance and distance interval 4 is 10.
[0090] Step S50: performing detection control according to the target analog-to-digital converter value.
[0091] It should be noted that the photoelectric sensor compares the real-time ADC value with the target ADC value and executes the corresponding control logic, such as outputting a switch signal or triggering an alarm. If the real-time ADC value is greater than the target ADC value, it is determined that an object has been sensed and outputs a high level or triggers an action. If the real-time ADC value is less than or equal to the target ADC value, it is determined that no object has been sensed and outputs a low level or remains in a standby state.
[0092] This embodiment responds to a sensor control instruction for a photoelectric sensor, determines the target detection distance of the photoelectric sensor according to the sensor control instruction; determines the interval change between the target detection distance and each distance interval; determines the interval change rate corresponding to multiple distance intervals based on the effective sensing value collected by each sample sensor at each target position under the corresponding calibration current; determines the target analog-to-digital converter value corresponding to the target detection distance based on the interval change between the target detection distance and each distance interval, the interval change rate corresponding to each distance interval, and the calibration sensing threshold corresponding to the photoelectric sensor; and performs detection control based on the target analog-to-digital converter value. Through the above-mentioned method, by analyzing the change between the target detection distance and the preset interval and the specific sensing change rate corresponding to each interval, and combining the calibration threshold to dynamically generate an ADC value, high-precision distance mapping control of the photoelectric sensor in complex environments is achieved, effectively solving the problem of large set distance error caused by the traditional fixed lookup table method, significantly improving the control accuracy of the sensor set distance and the actual sensing distance, and achieving high software versatility within the same hardware circuit, significantly reducing the development cost of multiple SKU versions and the complexity of software management, and improving the stability and versatility of the system.
[0093] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above embodiment 1 can be referred to the above introduction and will not be described in detail later. Figure 3 The control method of the photoelectric sensor further includes steps S31 to S33 before step S30:
[0094] Step S31 : performing amplitude offset calibration on a plurality of sample sensors to determine a sampling delay time of each sample sensor.
[0095] It should be noted that due to the accuracy error and interruption influence of the internal oscillator of the microcontroller, the upper and lower limits of the accuracy error of different microcontrollers under the same temperature conditions are still relatively large, and the receiving signal delay time t is determined by the instruction cycle of the microcontroller. When the instruction cycles of different microcontrollers are inconsistent, different samples will have sampling offsets; in addition, the hardware parameters of the receiving end are affected. The receiving end is mainly composed of signal reception, signal coupling, signal amplification, signal conversion, and signal output. Since it is difficult to maintain complete consistency in the parameters of each hardware circuit (such as capacitor accuracy, op amp pulse response time, and op amp gain), there will be a time offset error when the actual signal output waveform rises to the highest amplitude.
[0096] As will be appreciated, this embodiment incorporates an amplitude offset calibration method to perform amplitude offset calibration on multiple sample sensors. By adjusting the signal sampling time, this method eliminates amplitude deviations caused by hardware delays or signal transmission, ensuring that the amplitude of the optical signal received by the photoelectric sensor accurately reflects the actual signal strength. In this embodiment, the calibration goal is to find a sampling delay time that maximizes the amplitude of the received signal, avoiding signal distortion caused by sampling too early or too late. In this embodiment, the sampling delay time refers to the delay time required to maximize the ADC value, and each sample sensor has a corresponding sampling delay time.
[0097] Step S32 , calibrating the sensing values collected by each sample sensor under multiple emission currents according to the sampling delay time of each sample sensor, and determining an average of the sensing values of each sample sensor under the multiple emission currents according to the calibration result.
[0098] It should be noted that for each sample sensor: the emission current is gradually reduced from the set maximum, and under different emission currents, the sampling delay time is used to collect the sensing value at the calibration distance, and the multiple sensing values corresponding to each group of emission currents are processed using the median average filtering method to obtain the average sensing value under the emission current.
[0099] Step S33 : determining a calibration current and a calibration sensing threshold of each sample sensor according to an average of the sensing values of each sample sensor under multiple emission currents and a sensing critical value.
[0100] It should be noted that the sensing threshold is a pre-set ADC threshold. When the sensing value is less than the sensing threshold, the sensor is considered to have not detected an object; when it is greater than or equal to the sensing threshold, an object is considered to have been detected. The calibration current refers to the emission current of the sample sensor at the calibration distance that causes the average sensing value to just reach or just fall below the sensing threshold. The calibration sensing threshold refers to the average sensing value corresponding to the calibration current at the calibration distance, which serves as the reference value for determining the presence of an object at that distance.
[0101] It can be understood that for each sample sensor: at the calibration distance, the emission current is gradually reduced from the set maximum current, and the average sensing value corresponding to each emission current is recorded; when the average sensing value decreases to be equal to or less than the sensing critical value for the first time, the emission current at this time is the calibration current, and the corresponding average sensing value is the calibration sensing threshold.
[0102] In a feasible implementation, step S31 further includes steps C11 to C13:
[0103] Step C11 : controlling the plurality of sample sensors to perform data sampling, and determining the original sensing values corresponding to the plurality of delay times of the respective sample sensors.
[0104] It should be noted that for each sample sensor, the light signal is continuously emitted and a preset number of data points are sampled. Each data point corresponds to a different delay time, and the sampled ADC value at that data point is obtained. The sampled ADC value at that data point is the original sensing value corresponding to that delay time. In this embodiment, the preset number can be set as needed. For example, if the sample sensor is controlled to continuously emit and sample 40 data points, the entire received signal width is approximately 60us, the accuracy of the delay time t is equal to the microcontroller instruction cycle = 1 / 8M × 12 = 1.5us, and the maximum amplitude duration is approximately 3us.
[0105] Step C12 , sorting the original sensing values corresponding to the multiple delay times of each sample sensor respectively, and determining the maximum sensing value of each sample sensor among the multiple original sensing values of each sample sensor according to the sorting result.
[0106] Step C13 : determining the sampling delay time of each sample sensor according to the sampling time corresponding to the maximum sensing value of each sample sensor.
[0107] It should be noted that for each sample sensor, the raw sensing values corresponding to each delay time are sorted in either ascending or descending order, which is not limited in this embodiment. After all raw sensing values are sorted, the largest raw sensing value is determined. The delay time corresponding to the largest raw sensing value is used as the sampling delay time for the sample sensor, and the sampling delay time is written to the memory for storage and used as the fixed delay time for each sampling.
[0108] In a specific implementation, in addition to the above method, the following method can also be used to perform amplitude offset calibration to obtain the sampling delay time of each sample sensor: Since the received signal waveform is a sinusoidal wave and a symmetrical waveform, the timer can also be set to edge capture working mode to capture the received signal width. After successfully capturing a complete frame of received signal, the total capture time width T can be obtained through the capture register. At this time, the sampling delay time of the sample sensor is t = T / 2.
[0109] It should be noted that the waveform diagram before sampling amplitude offset calibration is as follows: Figure 4 As shown, the waveform after calibration is as follows Figure 5 As shown, by introducing amplitude offset calibration, it is ensured that the sample sensor can finally receive the maximum amplitude of the signal, solving the problem of distance shortening caused by amplitude misalignment of different sample sensors.
[0110] In a feasible implementation, step S32 further includes steps D11 to D13:
[0111] Step D11 , calibrating the multiple sensing values collected by each sample sensor under multiple emission currents according to the sampling delay time of each sample sensor, to obtain multiple calibrated sensing values of each sample sensor under the multiple emission currents.
[0112] It should be noted that for each sample sensor: at the position of the calibration distance, the emission current is gradually reduced from the set maximum, and multiple sensing values are collected at each emission current. The sampling delay time is used to perform time synchronization correction on the multiple sensing values collected at each emission current to eliminate signal distortion caused by sampling timing errors, thereby obtaining multiple calibrated sensing values of the sample sensor at multiple emission currents.
[0113] In step D12 , extreme value filtering is performed on the calibration sensing values of each sample sensor under multiple emission currents to obtain multiple target sensing values of each sample sensor under multiple emission currents.
[0114] It should be noted that to further improve the accuracy of ADC sampling in calibration mode and reduce sampling fluctuations in ADC values, a median average filtering method is introduced. For each emission current of each sample sensor: Since there are multiple calibration sensing values under each emission current, the multiple calibration sensing values under each emission current are subjected to extreme value filtering, removing the maximum and minimum values. The remaining calibration sensing value is the target sensing value. In this embodiment, there will be multiple target sensing values under each emission current.
[0115] In step D13 , average calculation is performed on the multiple target sensing values of each sample sensor under the multiple emission currents to determine the average of the sensing values of each sample sensor under the multiple emission currents.
[0116] It should be noted that for each emission current of each sample sensor: the arithmetic mean of multiple target sensing values under the same emission current is taken to reduce the influence of random noise, thereby obtaining the mean sensing value under each emission current.
[0117] In a feasible implementation, step S33 further includes steps E11 to E13:
[0118] In step E11 , the average sensing value of each sample sensor at each emission current is compared with the sensing critical value.
[0119] Step E12: When the average of the sensing values of the sample sensors is less than or equal to the sensing critical value, determine the calibrated sensing threshold of each sample sensor.
[0120] Step E13 : determining the calibration current of each sample sensor according to the emission current corresponding to the calibration sensing threshold of each sample sensor.
[0121] It should be noted that for each sample sensor: the mean induction value of each emission current is compared with the induction critical value. When the mean induction value is exactly equal to or less than the induction critical value for the first time, the emission current at this time is the calibration current, and the corresponding mean induction value is the calibration induction threshold.
[0122] It is understandable that in order to determine the calibration sensing threshold and calibration current of each sample sensor at the calibration distance, the sensor will automatically enter the calibration mode when it is powered on. The specific process is as follows: 1. After the electric eye enters the calibration mode at the calibration distance, the electric eye first performs amplitude offset calibration, obtains the sampling delay time for reading the ADC of the sample and saves it, and obtains the ADC value read by the sample at the sampling delay time as the maximum value of the received signal amplitude. 2. After the amplitude offset calibration is completed, the sampling delay time is used as the sampling delay time of the sample, and the emission current is gradually reduced from the maximum value. After filtering, the real-time ADC sensing value under the standard whiteboard is obtained. When the emission current decreases, the ADC sensing value also decreases. When the ADC value decreases to the sensing critical value, the current emission current and the average sensing value are recorded and saved to obtain the calibration sensing threshold and calibration current of the calibration distance.
[0123] In specific implementation, the existing technology will also perform factory calibration during production, but will not perform amplitude calibration. Therefore, when an amplitude offset occurs, the offset electric eye will reach the required threshold by increasing the emission current. However, not all electric eyes need to be offset, so different electric eyes will have very different sensing distances under the same current, that is, the curves are very different, and it is difficult to ensure the distance accuracy in other distance segments. After the amplitude calibration, this embodiment is equivalent to further fitting the different electric eye curves without increasing the production difficulty, so that the distance accuracy is higher.
[0124] In addition, the existing technology assembles multiple samples in the early stage of research and development to read data from different distance segments, processes them through normalization, and averages the data read at different distances as a fixed lookup table. Due to the influence of installation such as rubber pads, shells, and glue potting, it is difficult to control the distance consistency. This embodiment uses the assembled finished electric eye as a benchmark to generate different adaptability tables corresponding to different electric eyes, which greatly improves the consistency of product distance. The table contains the interval change rate corresponding to each distance interval.
[0125] This embodiment performs amplitude offset calibration on multiple sample sensors to determine the sampling delay time for each sample sensor. The sensing values collected by each sample sensor at multiple emission currents are calibrated based on the sampling delay time, and the average sensing value of each sample sensor at multiple emission currents is determined based on the calibration results. The calibration current and calibration sensing threshold of each sample sensor are determined based on the average sensing value and sensing threshold of each sample sensor at multiple emission currents. This approach achieves optimal selection of emission current and precise setting of calibration thresholds.
[0126] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the control method of the photoelectric sensor of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0127] This application also provides a control device for a photoelectric sensor, please refer to Figure 6 , the control device of the photoelectric sensor includes:
[0128] The response module 10 is configured to respond to a sensor control instruction for the photoelectric sensor and determine a target detection distance of the photoelectric sensor according to the sensor control instruction.
[0129] The processing module 20 is configured to determine the target detection distance and the interval variation between each distance interval.
[0130] The processing module 20 is further configured to determine interval change rates corresponding to a plurality of distance intervals based on the effective sensing values at each target position collected by each sample sensor under the corresponding calibration current;
[0131] The processing module 20 is configured to determine a target analog-to-digital converter value corresponding to the target detection distance based on the interval change between the target detection distance and each distance interval, the interval change rate corresponding to each distance interval, and the calibration sensing threshold corresponding to the photoelectric sensor;
[0132] The control module 30 is configured to perform detection control according to the target analog-to-digital converter value.
[0133] Optionally, the processing module 20 is further configured to:
[0134] Amplitude offset calibration is performed on multiple sample sensors to determine the sampling delay time of each sample sensor; the sensing values collected by each sample sensor under multiple emission currents are calibrated according to the sampling delay time of each sample sensor, and the average sensing value of each sample sensor under the multiple emission currents is determined according to the calibration result; the calibration current of each sample sensor and the calibration sensing threshold of each sample sensor are determined according to the average sensing value and the sensing critical value of each sample sensor under the multiple emission currents.
[0135] Optionally, the processing module 20 is further configured to:
[0136] Control multiple sample sensors to perform data sampling and determine the original sensing values corresponding to the multiple delay times of each sample sensor; sort the original sensing values corresponding to the multiple delay times of each sample sensor respectively, and determine the maximum sensing value of each sample sensor among the multiple original sensing values of each sample sensor according to the sorting result; determine the sampling delay time of each sample sensor according to the sampling time corresponding to the maximum sensing value of each sample sensor.
[0137] Optionally, the processing module 20 is further configured to:
[0138] According to the sampling delay time of each sample sensor, the multiple sensing values collected by each sample sensor under multiple emission currents are calibrated to obtain multiple calibration sensing values of each sample sensor under multiple emission currents; the calibration sensing values of each sample sensor under multiple emission currents are respectively subjected to extreme value filtering to obtain multiple target sensing values of each sample sensor under multiple emission currents; the multiple target sensing values of each sample sensor under multiple emission currents are respectively averaged to determine the average sensing value of each sample sensor under multiple emission currents.
[0139] Optionally, the processing module 20 is further configured to:
[0140] The average sensing value of each sample sensor under each emission current is compared with the sensing critical value; when the average sensing value of each sample sensor is less than or equal to the sensing critical value, the calibrated sensing threshold of each sample sensor is determined; and the calibrated current of each sample sensor is determined according to the emission current corresponding to the calibrated sensing threshold of each sample sensor.
[0141] Optionally, the processing module 20 is further configured to:
[0142] The effective induction values at each target position collected by each sample sensor under the corresponding calibration current are segmentedly fitted to determine the slope of the interval curve of each sample sensor in multiple distance intervals. The average of the interval curve slopes of each sample sensor in multiple distance intervals is calculated to obtain the interval change rate corresponding to the multiple distance intervals.
[0143] Optionally, the processing module 20 is further configured to:
[0144] The target detection distance is compared with the calibration distance to determine the size relationship between the target detection distance and the calibration distance; a threshold calculation method is determined based on the size relationship between the target detection distance and the calibration distance; a threshold calculation is performed based on the threshold calculation method, the interval change between the target detection distance and each distance interval, the interval change rate corresponding to each distance interval, and the calibration sensing threshold corresponding to the photoelectric sensor to determine the target analog-to-digital converter value corresponding to the target detection distance.
[0145] The photoelectric sensor control device provided in this application utilizes the photoelectric sensor control method of the aforementioned embodiment, resolving the technical issues of the prior art photoelectric sensors, such as the large discrepancy between the set distance and the actual sensing distance, and the complex software management. Compared to the prior art, the photoelectric sensor control device provided in this application achieves the same beneficial effects as the photoelectric sensor control method of the aforementioned embodiment. Other technical features of the photoelectric sensor control device are the same as those disclosed in the aforementioned embodiment and are not further elaborated here.
[0146] The present application provides a control device for a photoelectric sensor, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the control method for the photoelectric sensor in the above-mentioned embodiment 1.
[0147] Reference below Figure 7 , which shows a schematic diagram of the structure of a control device for a photoelectric sensor suitable for implementing an embodiment of the present application. The control device for the photoelectric sensor in the embodiment of the present application may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 7 The control device of the photoelectric sensor shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0148] like Figure 7As shown, the photoelectric sensor control device may include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes based on programs stored in a read-only memory (ROM) 1002 or programs loaded from a storage device 1003 into a random access memory (RAM) 1004. RAM 1004 also stores various programs and data required for the operation of the photoelectric sensor control device. Processing device 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to I / O interface 1006: input devices 1007 including, for example, a touch screen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage device 1003 including, for example, a magnetic tape, hard disk, etc.; and communication device 1009. The communication device 1009 can allow the photoelectric sensor control device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a photoelectric sensor control device with various systems, it should be understood that it is not required to implement or have all of the systems shown. More or fewer systems may be implemented or provided instead.
[0149] In particular, according to the embodiments disclosed in the present application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program comprising program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0150] The photoelectric sensor control device provided in this application utilizes the photoelectric sensor control method of the aforementioned embodiment, resolving the technical issues of the prior art photoelectric sensors, such as the large discrepancy between the set distance and the actual sensing distance, and the complex software management. Compared to the prior art, the photoelectric sensor control device provided in this application achieves the same beneficial effects as the photoelectric sensor control method of the aforementioned embodiment. Other technical features of the photoelectric sensor control device are the same as those disclosed in the aforementioned embodiment and are not further elaborated here.
[0151] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0152] The above description 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 this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
[0153] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer program) stored thereon, and the computer-readable program instructions are used to execute the control method of the photoelectric sensor in the above embodiment.
[0154] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0155] The computer-readable storage medium may be included in the control device of the photoelectric sensor, or may exist independently without being assembled into the control device of the photoelectric sensor.
[0156] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the control device of the photoelectric sensor, the control device of the photoelectric sensor: responds to the sensor control instruction of the photoelectric sensor, and determines the target detection distance of the photoelectric sensor according to the sensor control instruction; determines the interval change between the target detection distance and each distance interval; determines the interval change rate corresponding to multiple distance intervals according to the effective sensing value at each target position collected by each sample sensor under the corresponding calibration current; determines the target analog-to-digital converter value corresponding to the target detection distance according to the interval change between the target detection distance and each distance interval, the interval change rate corresponding to each distance interval, and the calibration sensing threshold corresponding to the photoelectric sensor; and performs detection control according to the target analog-to-digital converter value.
[0157] Computer program code for performing the operations of the present application may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0158] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, program segment or a part of code, and the module, program segment or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions.
[0159] The modules described in the embodiments of the present application may be implemented in software or hardware, wherein the name of a module does not necessarily limit the unit itself.
[0160] The computer-readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the aforementioned photoelectric sensor control method. This computer-readable storage medium can address the technical issues of prior art photoelectric sensors, such as the large discrepancy between the set distance and the actual sensing distance, and the complex software control. Compared to the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the photoelectric sensor control method provided in the aforementioned embodiments, and are not further elaborated here.
[0161] The present application also provides a computer program product, comprising a computer program, which implements the steps of the above-mentioned method for controlling a photoelectric sensor when executed by a processor.
[0162] The computer program product provided in this application can address the technical issues of existing photoelectric sensors, such as the large discrepancy between the set distance and the actual sensing distance, and the complex software control. Compared to the existing technology, the beneficial effects of the computer program product provided in this application are the same as those of the photoelectric sensor control method provided in the above-mentioned embodiments, and will not be elaborated here.
[0163] The above description is only part of the embodiments of the present application and does not limit the patent scope of the present application. All equivalent structural transformations made by using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect application in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A control method for a photoelectric sensor, characterized in that: The method comprises: In response to a sensor control instruction for a photoelectric sensor, determining a target detection distance of the photoelectric sensor according to the sensor control instruction; Determining the target detection distance and the interval variation between each distance interval; Determine interval change rates corresponding to multiple distance intervals based on effective sensing values at each target position collected by each sample sensor under the corresponding calibration current; Determine a target analog-to-digital converter value corresponding to the target detection distance according to the target detection distance and the interval change amount between each distance interval, the interval change rate corresponding to each distance interval, and the calibration sensing threshold corresponding to the photoelectric sensor; Detection control is performed according to the target analog-to-digital converter value.
2. The method according to claim 1, wherein Before the step of determining interval change rates corresponding to a plurality of distance intervals based on the effective sensing values at each target position collected by each sample sensor under the corresponding calibration current, the method further includes: performing amplitude offset calibration on a plurality of sample sensors to determine a sampling delay time of each sample sensor; Calibrate the sensing values collected by each sample sensor under multiple emission currents according to the sampling delay time of each sample sensor, and determine the average of the sensing values of each sample sensor under the multiple emission currents according to the calibration result; The calibration current of each sample sensor and the calibration sensing threshold of each sample sensor are determined according to the average value of the sensing values of each sample sensor under multiple emission currents and the sensing critical value.
3. The method according to claim 2, wherein The step of performing amplitude offset calibration on a plurality of sample sensors and determining a sampling delay time of each sample sensor includes: Controlling multiple sample sensors to perform data sampling and determining original sensing values corresponding to multiple delay times of each sample sensor; sorting the original sensing values corresponding to the multiple delay times of each sample sensor respectively, and determining the maximum sensing value of each sample sensor among the multiple original sensing values of each sample sensor according to the sorting result; The sampling delay time of each sample sensor is determined according to the sampling time corresponding to the maximum sensing value of each sample sensor.
4. The method according to claim 2, wherein The step of calibrating the sensing values collected by each sample sensor under multiple emission currents according to the sampling delay time of each sample sensor, and determining the average of the sensing values of each sample sensor under the multiple emission currents according to the calibration result includes: Calibrate multiple sensing values collected by each sample sensor under multiple emission currents according to the sampling delay time of each sample sensor to obtain multiple calibration sensing values of each sample sensor under the multiple emission currents; Perform extreme value filtering on the calibration sensing values of each sample sensor under multiple emission currents to obtain multiple target sensing values of each sample sensor under multiple emission currents; The average values of the target sensing values of each sample sensor under the multiple emission currents are calculated respectively to determine the average value of the sensing values of each sample sensor under the multiple emission currents.
5. The method according to claim 2, wherein The step of determining the calibration current of each sample sensor and the calibration sensing threshold of each sample sensor according to the average of the sensing values and the sensing critical value of each sample sensor under multiple emission currents includes: The average sensing value and sensing critical value of each sample sensor at each emission current are compared respectively; When the average of the sensing values of the sample sensors is less than or equal to the sensing critical value, determining the calibration sensing threshold of each sample sensor; The calibration current of each sample sensor is determined according to the emission current corresponding to the calibration sensing threshold of each sample sensor.
6. The method according to any one of claims 1 to 5, characterized in that The step of determining interval change rates corresponding to a plurality of distance intervals based on the effective sensing values at each target position collected by each sample sensor under the corresponding calibration current includes: Performing segmented fitting based on the effective sensing values of each sample sensor at each target position collected under the corresponding calibration current to determine the slope of the interval curve of each sample sensor in multiple distance intervals; The average value of the interval curve slopes of each sample sensor in multiple distance intervals is calculated to obtain the interval change rates corresponding to the multiple distance intervals.
7. The method according to any one of claims 1 to 5, characterized in that The step of determining the target analog-to-digital converter value corresponding to the target detection distance according to the interval change between the target detection distance and each distance interval, the interval change rate corresponding to each distance interval, and the calibration sensing threshold corresponding to the photoelectric sensor includes: Comparing the target detection distance with the calibration distance to determine the magnitude relationship between the target detection distance and the calibration distance; Determine a threshold calculation method according to the size relationship between the target detection distance and the calibration distance; A threshold value is calculated based on the threshold calculation method, the interval change between the target detection distance and each distance interval, the interval change rate corresponding to each distance interval, and the calibrated sensing threshold corresponding to the photoelectric sensor to determine the target analog-to-digital converter value corresponding to the target detection distance.
8. A control device for a photoelectric sensor, characterized in that: The control device of the photoelectric sensor includes: a response module, configured to respond to a sensor control instruction for the photoelectric sensor and determine a target detection distance of the photoelectric sensor according to the sensor control instruction; a processing module, configured to determine a target detection distance and an interval variation between each distance interval; The processing module is further configured to determine interval change rates corresponding to a plurality of distance intervals based on effective sensing values at each target position collected by each sample sensor under a corresponding calibration current; The processing module is used to determine the target analog-to-digital converter value corresponding to the target detection distance based on the interval change between the target detection distance and each distance interval, the interval change rate corresponding to each distance interval, and the calibration sensing threshold corresponding to the photoelectric sensor; A control module is used to perform detection control according to the target analog-to-digital converter value.
9. A control device for a photoelectric sensor, characterized in that: The device includes: a memory, a processor, and a photoelectric sensor control program stored in the memory and executable on the processor, wherein the photoelectric sensor control program is configured to implement the steps of the photoelectric sensor control method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium stores a control program for the photoelectric sensor. When the control program for the photoelectric sensor is executed by the processor, the steps of the method for controlling the photoelectric sensor according to any one of claims 1 to 7 are implemented.