Photoelectric sensor driving parameter automatic calibration method, device and system and object recognition method

By combining a photoelectric sensor parameter calibration device with an AI analysis model, the driving parameters of the photoelectric sensor are automatically calibrated, solving the problem of time-consuming and labor-intensive manual calibration in existing technologies. This achieves efficient, accurate, and consistent calibration and object recognition, adapting to various scenarios.

CN123045418APending Publication Date: 2026-11-06HUNAN GREATWALL INFORMATION FINANCIAL EQUIP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611147160.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-30
Publication Date
2026-11-06

AI Technical Summary

Technical Problem

The calibration of existing photoelectric sensor driving parameters relies on manual experience, which is time-consuming, labor-intensive, and inconsistent, making it impossible to quickly and accurately obtain the best fixed driving parameters for a specific scenario.

Method used

By combining a photoelectric sensor parameter calibration device with a host computer and an AI analysis model, the system automatically performs two scans to collect response curves with and without objects. The AI ​​analysis model is then used for verification and feature extraction to predict the optimal drive duty cycle and calculate the equivalent current limiting resistance value and the optimal judgment threshold voltage, thus achieving automatic calibration.

Benefits of technology

It significantly improves calibration efficiency and accuracy, ensures consistency and reproducibility of sensor parameter settings, eliminates differences in human experience, enhances signal discrimination and anti-interference capabilities, adapts to different object types and detection distances, and has good scene adaptability and scalability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123045418A_ABST
    Figure CN123045418A_ABST
Patent Text Reader

Abstract

This application discloses an automatic calibration method, apparatus, system, and object recognition method for photoelectric sensor driving parameters. The calibration method includes: installing the photoelectric sensor to be calibrated onto the calibration device; removing the target object from the detection area and performing a first scan to obtain a response curve without an object; moving the target object into the detection area and performing a second scan to obtain a response curve with an object; sending the two sets of curves to an AI analysis model running on a host computer for verification and feature extraction, and predicting the optimal driving duty cycle. This application also discloses an object recognition method based on calibration parameters, which obtains the net signal at each duty cycle through pulse sequence scanning, determines the presence or absence of an object based on the optimal driving duty cycle, calculates the net signal ratio feature vector, and matches it with a template library to achieve object category recognition. This application can replace manual trial and error to achieve automatic calibration of driving parameters and can utilize the calibration parameters for highly robust online object recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of photoelectric sensor technology, specifically to a method, apparatus, system for automatic calibration of photoelectric sensor driving parameters, and object recognition method. Background Technology

[0002] In devices for object (medium) transmission and intelligent detection, reflective or through-beam infrared photoelectric sensors are widely used. To ensure reliable operation of the sensors at specific distances and when facing objects with different reflectivities, appropriate LED driving parameters (current-limiting resistor values ​​or PWM drive duty cycles) and judgment thresholds must be set. In existing technologies, this process relies entirely on manual labor: engineers manually replace current-limiting resistors with different values ​​or repeatedly modify the PWM duty cycle at the target distance, observing the signal quality at the receiving end, and finally selecting parameters that "can distinguish the presence or absence of objects without signal saturation" based on experience. This method is time-consuming, labor-intensive, and lacks consistency. When a device has many sensors or the objects change frequently, calibration becomes a major bottleneck, making it impossible to quickly and accurately obtain the optimal fixed driving parameters for a specific scenario.

[0003] Therefore, an efficient calibration scheme is needed that can automatically and in one go provide the optimal fixed driving parameters. Summary of the Invention

[0004] The purpose of this application is to provide an automatic calibration method, device, system, and object recognition method for photoelectric sensor driving parameters, which can replace manual trial and error to achieve one-stop automatic calibration of driving parameters. At the same time, the optimal driving parameters obtained by calibration are used to perform highly robust object category recognition, thereby improving calibration efficiency and recognition accuracy.

[0005] The technical solution provided in this application is as follows:

[0006] In a first aspect, this application provides an automatic calibration method for the driving parameters of a photoelectric sensor, comprising the following steps:

[0007] Install the photoelectric sensor to be calibrated onto the photoelectric sensor parameter calibration device, and establish a communication connection between the photoelectric sensor parameter calibration device and the host computer;

[0008] In response to the distance control command sent by the host computer, the target object is driven to move along a preset path to the calibration reference position;

[0009] Perform the first scan: When the target object moves out of the detection area of ​​the photoelectric sensor, the control module outputs PWM drive signals to the transmitter of the photoelectric sensor in sequence according to the preset N duty cycle nodes, and collects the analog voltage value output by the receiver of the photoelectric sensor under each duty cycle node to obtain the response curve without object;

[0010] Perform the second scan: When the target object is placed in the detection area of ​​the photoelectric sensor, the control module outputs PWM drive signals to the transmitter of the photoelectric sensor in sequence according to the preset N duty cycle nodes, and collects the analog voltage value output by the receiver of the photoelectric sensor under each duty cycle node to obtain the object response curve.

[0011] The objectless response curve and the object-containing response curve are sent to the AI ​​analysis model running in the host computer;

[0012] The AI ​​analysis model verifies and extracts features from the response curves without objects and the response curves with objects, and predicts the optimal driving duty cycle.

[0013] The optimal drive duty cycle is output as the calibration parameter of the photoelectric sensor.

[0014] In one possible implementation, the AI ​​analysis model, in addition to predicting the optimal driving duty cycle, can also calculate the equivalent current-limiting resistor value and the optimal decision threshold voltage based on the optimal driving duty cycle. It then outputs the optimal driving duty cycle, the equivalent current-limiting resistor value, and the optimal decision threshold voltage as calibration parameters for the photoelectric sensor. Specifically, the optimal driving duty cycle is used to determine the driving control quantity of the LED, the equivalent current-limiting resistor value is used to determine the driving circuit parameters of the LED, and the optimal decision threshold voltage is used to distinguish between the presence and absence of an object.

[0015] In this scheme, the output equivalent current-limiting resistor value can be directly used for resistor selection and soldering on the main control board, the optimal drive duty cycle can be directly written into the control module firmware, and the optimal judgment threshold voltage can be directly used for software comparison logic for judging the presence or absence of objects, thus achieving seamless connection from calibration results to actual engineering applications.

[0016] In one possible implementation, the AI ​​analysis model verifies and extracts features from the objectless response curve and the object-containing response curve to predict the optimal driving duty cycle, specifically including:

[0017] Verify curve validity: Check whether the simulated voltage value of the object under the minimum duty cycle reaches the preset saturation threshold of the ADC full scale. If it does, prompt to reduce the starting duty cycle of the scan range and re-execute the first and second scans.

[0018] In response to the successful validity check of the curve, the difference between each duty cycle, the trend of curve slope change, and the saturation flag are extracted from the objectless response curve and the object-containing response curve as features.

[0019] The extracted features are combined with scene encoding and input into the AI ​​analysis model. The AI ​​analysis model outputs the optimal driving duty cycle, which ensures that both the simulated voltage value without an object and the simulated voltage value with an object are within the linear range of the ADC and that the difference between the two is maximized.

[0020] In one possible implementation, the calibration method further includes:

[0021] For different object types and / or different target object distances, the first scan and the second scan are performed respectively to obtain multiple sets of object-free response curves and object-containing response curves;

[0022] The AI ​​analysis model is trained or predicted based on the multiple sets of response curves and their corresponding scene codes, and outputs the optimal driving duty cycle corresponding to each scene.

[0023] Secondly, this application provides an automatic calibration device for photoelectric sensor driving parameters, used to implement the above-mentioned automatic calibration method for photoelectric sensor driving parameters, including:

[0024] Sensor interface socket for pluggable mounting of photoelectric sensors to be calibrated;

[0025] The drive mechanism is used to drive the target object to move along a preset path to the calibration reference position in response to the distance control command of the host computer;

[0026] The LED control circuit is used to sequentially output PWM drive signals to the transmitter of the photoelectric sensor according to N preset duty cycle nodes;

[0027] The signal acquisition circuit is used to acquire the analog voltage value output by the photoelectric sensor receiver at each duty cycle node to obtain a response curve without an object when the target object moves out of the detection area of ​​the photoelectric sensor, and to acquire the analog voltage value output by the photoelectric sensor receiver at each duty cycle node to obtain a response curve with an object when the target object is placed in the detection area of ​​the photoelectric sensor.

[0028] The control module is used to upload the response curve without objects and the response curve with objects to the host computer so that the AI ​​analysis model can perform calibration parameter prediction.

[0029] The device adopts a pluggable sensor interface design, which can flexibly replace different types of photoelectric sensors for calibration; the drive mechanism can precisely control the object to move to the set distance, ensuring the consistency and repeatability of calibration conditions.

[0030] Thirdly, this application provides an automatic calibration system for photoelectric sensor driving parameters, including the aforementioned automatic calibration device for photoelectric sensor driving parameters and a host computer. The host computer is used to run an AI analysis model, receive the response curve without an object and the response curve with an object uploaded by the device, perform verification and feature extraction on the curves, predict the optimal driving duty cycle, and calculate the equivalent current limiting resistance value and the optimal judgment threshold voltage based on the optimal driving duty cycle, as the calibration parameters output for the photoelectric sensor.

[0031] In the system, the calibration device is responsible for accurate data acquisition and physical execution, while the host computer AI analysis model is responsible for data processing and parameter decision-making. The two work together to ensure the accuracy and consistency of data acquisition, while giving full play to the advantages of the AI ​​analysis model in optimizing complex parameters.

[0032] Fourthly, this application provides a multi-object recognition method, comprising the following steps:

[0033] Set PWM pulse sequence parameters, which include frequency and N duty cycle nodes;

[0034] In the state of no drive output, the combined reference voltage of ambient light and circuit offset is collected;

[0035] For each of the N types of standard objects, perform the following operations: place the current type of standard object in the detection position, perform scanning according to the PWM pulse sequence, collect the net signal after deducting the reference voltage in the pulse window of each duty cycle node, calculate the ratio between each net signal as the ratio feature vector of the standard object of that type, and store it in the memory to construct a template library containing N templates.

[0036] Remove all objects, and obtain the mean and standard deviation of the net signal without objects by sampling multiple times at the reference duty cycle. Set an existence threshold based on the mean and standard deviation of the net signal without objects. The reference duty cycle is determined by using the above-mentioned automatic calibration method for photoelectric sensor driving parameters to obtain the optimal driving duty cycle corresponding to each type of standard object. The reference duty cycle is determined based on the optimal driving duty cycle corresponding to each type of standard object (e.g., the maximum value among the optimal driving duty cycles corresponding to each type of standard object).

[0037] The object to be tested is scanned to obtain the net signal to be tested at each duty cycle node. If the net signal value corresponding to the reference duty cycle in the net signal to be tested is less than the existence threshold, it is determined that there is no object and the recognition ends.

[0038] If an object is determined to exist, the ratio between the net signals to be measured is calculated as the feature vector of the ratio to be measured. The distance between the feature vector of the ratio to be measured and each template in the template library is calculated, and the corresponding object category is output based on the distance comparison result.

[0039] In one possible implementation, the step of outputting the corresponding object category based on the distance comparison result includes:

[0040] Determine whether the minimum distance between the feature vector of the ratio to be tested and each template in the template library is greater than a preset rejection threshold;

[0041] If the value exceeds the preset rejection threshold, then output "unknown object".

[0042] If the value is not greater than the preset rejection threshold, then the step of outputting the category corresponding to the template with the smallest distance from the feature vector of the test ratio is executed.

[0043] In one possible implementation, acquiring the net signal after subtracting the reference voltage within the pulse window of each duty cycle node specifically includes:

[0044] Each duty cycle node outputs a PWM pulse signal for one complete cycle;

[0045] ADC sampling is performed within the latter half window of the pulse at each duty cycle node to obtain the sampled value;

[0046] The net signal is obtained by subtracting the reference voltage from the sampled value.

[0047] In one possible implementation, the step of acquiring the net signal after subtracting the reference voltage within the pulse window of each duty cycle node further includes:

[0048] After the output of each duty cycle node ends, a no-drive interval is inserted, during which the PWM duty cycle is set to 0% so that the photoelectric sensor receiver can restore the dark state and update the ambient light reference.

[0049] In one possible implementation, the step of acquiring the net signal after subtracting the reference voltage within the pulse window of each duty cycle node further includes:

[0050] The sampling process is repeated multiple times for each duty cycle node, and the average of the multiple sampling results is taken as the net signal for that duty cycle node.

[0051] The specific implementation methods of the second to fourth aspects of this application can refer to the implementation methods of the first aspect, and will not be elaborated here.

[0052] The automatic calibration method, apparatus, system, and object recognition method for photoelectric sensor driving parameters provided in this application have the following beneficial effects:

[0053] This application automatically performs dual scans (without object / with object) via a control module, and automatically completes curve verification, feature extraction, and optimal parameter prediction using an AI analysis model. It outputs the optimal drive duty cycle, replacing the traditional trial-and-error method of repeatedly changing resistors or adjusting the PWM duty cycle manually. This significantly improves calibration efficiency and accuracy, greatly shortens calibration time, increases production efficiency, eliminates human experience differences, and ensures the consistency and reproducibility of sensor parameter settings in mass production. The AI ​​analysis model optimizes by maximizing the difference between the simulated voltage values ​​with and without objects, ensuring both are within the ADC's linear range. This maximizes the signal differentiation between objects and non-object signals, and maximizes the detection signal-to-noise ratio and anti-interference margin. Simultaneously, it verifies whether the simulated voltage value with an object reaches saturation at the minimum duty cycle. If saturation occurs, it automatically prompts for adjustment of the initial duty cycle of the scan range and rescans, avoiding calibration failure caused by the signal entering the non-linear region.

[0054] This application can perform calibration for different object types and detection distances, and input the object type and distance as scene codes into the AI ​​analysis model, so that the method can flexibly adapt to media with different reflectivities and different installation distance requirements, and has good scene adaptability.

[0055] This application acquires the net signal after subtracting the ambient light reference within the pulse window of each duty cycle node, and calculates the ratio between the net signals under each duty cycle as the ratio feature vector, thus eliminating the interference of ambient light fluctuations and aging of photoelectric sensor devices (such as light decay of LEDs and decreased sensitivity of receivers) on the recognition results. By constructing a ratio feature vector template library containing multiple types of standard objects, nearest neighbor matching is used during online recognition. This not only outputs the specific object category, but also rejects unknown objects by comparing the minimum distance with a preset rejection threshold, avoiding false judgments. Furthermore, users can add new standard object templates to the template library as needed without retraining the model or modifying the algorithm, demonstrating good scalability.

[0056] The optimal judgment threshold voltage output by the calibration method of this application is directly used to determine the presence or absence of objects in the identification method. The optimal driving parameters determined by the calibration method provide the optimal signal acquisition conditions for the identification method. The two technologies are closely integrated, forming a complete technology chain from parameter configuration to online detection. Attached Figure Description

[0057] Figure 1 Block diagram of an automatic calibration device for photoelectric sensor driving parameters in one embodiment of this application.

[0058] Figure 2This application includes a block diagram of an automatic calibration system for photoelectric sensor driving parameters in one embodiment.

[0059] Figure 3 This is a schematic diagram of an automatic calibration method for photoelectric sensor driving parameters in one embodiment of this application. Detailed Implementation

[0060] To enable those skilled in the art to better understand the present application, the technical solution of the present application will be further described in detail below with reference to the embodiments and accompanying drawings.

[0061] It should be noted that the terms "comprising" and "having" and any variations thereof in the specification, claims and accompanying drawings of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such process, method, product or device.

[0062] Furthermore, the terms "installation," "setup," "equipped with," "connection," "linked," and "socketing" should be interpreted broadly. For example, "connection" can be a fixed connection, a detachable connection, or an integral structure; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or an internal connection between two devices, components, or parts. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.

[0063] In this embodiment of the disclosure, the character " / " indicates that the objects before and after it are in an "or" relationship. For example, A / B means: A or B.

[0064] The term "and / or" describes an association between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or A and B.

[0065] This application provides an automatic calibration method, device, system, and object recognition method for photoelectric sensor driving parameters, aiming to solve the problems of low calibration efficiency and poor consistency caused by the reliance on repeated manual trials for existing photoelectric sensor driving parameters. By constructing a hardware photoelectric sensor parameter calibration device integrating a pluggable sensor interface, precise stepper motor positioning, PWM / digital potentiometer drive control, and ADC sampling, and in conjunction with a host computer and AI analysis model, the optimal driving parameters (duty cycle, equivalent resistance, and judgment threshold) of the photoelectric sensor are automatically and uniformly calibrated in one step. Based on this, an object recognition method based on pulse sequence ratio feature vectors is further proposed, supporting online classification and rejection of two or more types of objects. This method can be widely applied to object detection such as cards, passbooks, and tickets in card and key issuing devices.

[0066] The specific embodiments of this application will now be described with reference to the accompanying drawings.

[0067] Example 1:

[0068] This embodiment provides an automatic calibration device for photoelectric sensor driving parameters, used to implement an automatic calibration method for photoelectric sensor driving parameters. For example... Figure 1 As shown, the device includes:

[0069] The sensor interface socket is used for pluggable mounting of the photoelectric sensor to be calibrated. The photoelectric sensor includes a transmitter (light-emitting diode) and a receiver (photodiode or phototransistor). Through its pluggable interface design, this device can be adapted to calibrate different models of photoelectric sensors.

[0070] The drive mechanism, including a stepper motor and a sliding guide rail or fixed clamp, is used to drive the target object along a preset path to a calibration reference position in response to distance control commands from the host computer. Specifically, the drive circuit is designed using a DRV8825 stepper driver chip, matched with a 42-stepper motor as the power actuator. It supports custom configuration of motion distance parameters, enabling precise start-stop and position adjustment of the device on the guide rail, and can accurately control the target object to the calibration reference position.

[0071] The LED control circuit provides a PWM drive signal to the photoelectric sensor's emitter (emitting tube), causing the LED to emit light sequentially according to a preset N duty cycle. The LED drive circuit can employ a common anode driving method, with the LED anode connected in series with a current-limiting resistor and then connected to the power supply VCC. The cathode is directly connected to the PWM control pin of the control module (such as a GD32 microcontroller), and the LED's luminous power and brightness are adjusted via the PWM signal.

[0072] The signal acquisition circuit is used to acquire the analog voltage values ​​output by the photoelectric sensor receiver at each duty cycle node to obtain a response curve without an object when the target object moves out of the detection area of ​​the photoelectric sensor, and to acquire the analog voltage values ​​output by the photoelectric sensor receiver at each duty cycle node to obtain a response curve with an object when the target object is placed in the detection area of ​​the photoelectric sensor. The receiving end of the power generation sensor can adopt the common-emitter configuration of an NPN phototransistor. The collector of the phototransistor is connected to the power supply VCC through a pull-up resistor, and the emitter is directly grounded. The detection signal is led out from the collector, and a parallel filter capacitor is used to complete the signal smoothing and noise reduction processing. Finally, it is connected to the ADC sampling pin of the control module to realize the acquisition and amplitude detection of the photoelectric signal analog quantity.

[0073] The control module, which can employ an MCU such as the GD32 microcontroller, is responsible for processing the data acquired by the ADC. It uploads the response curves without and with objects to the host computer for calibration parameter prediction by the AI ​​analysis model. The control module can dynamically adjust the PWM duty cycle to stabilize the luminous power. The control module can interact with the host computer via a USB communication interface circuit, supporting parameter configuration and real-time status monitoring.

[0074] The host computer is used to run the AI ​​analysis model, receive the response curves without objects and the response curves with objects uploaded by the device, perform verification and feature extraction on the curves, predict the optimal driving duty cycle, and calculate the equivalent current limiting resistance value and the optimal judgment threshold voltage based on the optimal driving duty cycle, which are then output as the calibration parameters of the photoelectric sensor.

[0075] In some embodiments, the device further includes a motor drive circuit. The drive circuit can be designed using a DRV8825 stepper driver chip, matched with a 42-stepper motor as the power actuator. It supports custom configuration of motion distance parameters, enabling precise start-stop and position control of the device on the guide rail, and accurately controlling the target object to the calibration reference position.

[0076] In some embodiments, the device further includes a digital potentiometer control circuit. The digital potentiometer is connected in series in the driving circuit of the light-emitting diode (LED) and is equivalent to a programmable current-limiting resistor. The control module can change the driving current of the LED by writing different resistance values ​​to it through a digital interface, thereby realizing dynamic adjustment of the luminous power.

[0077] Example 2:

[0078] This embodiment provides an automatic calibration system for the driving parameters of a photoelectric sensor, such as... Figure 2 As shown, it includes the automatic calibration device for photoelectric sensor driving parameters described in Embodiment 1 and the host computer (PC).

[0079] The host computer is used to run the AI ​​analysis model, receive the response curves without objects and the response curves with objects uploaded by the device, perform verification and feature extraction on the curves, predict the optimal driving duty cycle, and calculate the equivalent current limiting resistance value and the optimal judgment threshold voltage based on the optimal driving duty cycle, which are then output as calibration parameters of the photoelectric sensor.

[0080] Example 3:

[0081] This embodiment provides a method for automatically calibrating the driving parameters of a photoelectric sensor, such as... Figure 3 As shown, the system implementation based on Embodiment 2 includes the following steps:

[0082] Step S1: Install the photoelectric sensor to be calibrated onto the sensor interface socket of the photoelectric sensor calibration device, and establish a communication connection between the device and the host computer.

[0083] Step S2: The host computer sends a distance control command to drive the stepper motor through the motor drive circuit, moving the target object along the preset path to the calibration reference position; after the position calibration is completed, the host computer configures the calibration scene parameters, including key parameters such as sensor model, object type and object physical properties; after the position calibration is completed, the detection position is fixed, and the detection position in subsequent steps is based on this calibration position.

[0084] Step S3: Drive the stepper motor through the motor drive circuit to move the target object out of the detection area of ​​the photoelectric sensor, so that the detection area of ​​the photoelectric sensor is in an object-free state.

[0085] When the detection area of ​​the photoelectric sensor is in an object-free state, the host computer issues a command to control the LED to perform the first scan: the control module outputs PWM drive signals sequentially according to the preset N duty cycle nodes and frequencies, and samples the analog voltage of the photoelectric sensor receiver at each node to obtain the set of analog voltage values ​​output by the photoelectric sensor receiver when there is no object at each duty cycle node, thus forming the object-free response curve (object-free reference curve). Let i = 1 to N, where i is the duty cycle node number and N is the total number of duty cycle nodes; for example, the N duty cycle nodes can be 10 nodes with equally spaced duty cycles from 10% to 100%.

[0086] Step S4: Drive the stepper motor through the motor drive circuit to move the target object from outside the detection area into the detection area of ​​the photoelectric sensor, so that the detection area of ​​the photoelectric sensor is in the state of having an object.

[0087] When the photoelectric sensor's detection area is in an object-containing state, the host computer issues a command to control the LED to perform a second scan: the control module outputs PWM drive signals sequentially according to the same N duty cycle nodes and frequencies as in step S3, and samples the analog voltage at the photoelectric sensor receiver at each node, obtaining the set of analog voltage values ​​output by the photoelectric sensor receiver when an object is present at each duty cycle node, thus forming the object-containing response curve. , i = 1 ~ N;

[0088] Step S5: The photoelectric sensor parameter calibration device will... and The two sets of curve data are packaged and uploaded to the AI ​​analysis model running on the host computer;

[0089] Step S6: The AI ​​analysis model first verifies the validity of the curve: check the minimum duty cycle node (e.g., 10%). Has the preset saturation threshold of the ADC full scale been reached (if it is close to or has reached the ADC full scale, such as setting the preset saturation threshold to 90%)? If saturated, a prompt will appear suggesting adjusting the initial duty cycle of the scan range (e.g., changing the scan range to 5%~50%) and returning to S3 and S4 to re-execute the first and second scans.

[0090] It should be understood that in photoelectric sensors, the larger the duty cycle, the stronger the luminous power, and the stronger the received signal. The stronger the signal, the better. If the luminous power at the minimum duty cycle node has already brought the received signal close to or to the full scale of the ADC, then the received signal at a larger duty cycle node will inevitably also be saturated. This is because a complete signal curve needs to be a full-process curve from "unsaturated" to "saturated" to accurately determine the boundary between the linear region and the saturation region. Lowering the upper limit of the duty cycle (e.g., setting it to 50%) can compress the scanning interval (from the original 0~100%) while ensuring that effective low-end data is found, saving rescanning time and avoiding wasting acquisition time in the known saturated high interval (e.g., 50%~100%). The main purpose of this operation is to acquire effective sensor signal curves to ensure that the AI ​​analysis model always calculates the optimal parameters based on untrimmed linear data, avoiding calibration failure due to hardware overdrive. In response to the successful curve validity check, features are extracted from the two curves, including the difference corresponding to each duty cycle node. Features include: curve slope trend, presence of saturation indicators, etc.; optimal duty cycle prediction: combining extracted features with scene encoding (including distance, object type, etc.), the model outputs the optimal driving duty cycle. This optimal drive duty cycle seems to guarantee... and Both fall within the ADC's linear region (10%~90% of full scale) and the difference between them is... Maximize, that is, maximize the distinction between having / not having an object;

[0091] In some embodiments, the AI ​​analysis model can also be based on power supply voltage. Forward voltage drop of LED and the current-limiting resistor in the calibration circuit Optimal drive duty cycle Converted to equivalent current-limiting resistor value The conversion formula is: This equivalent current-limiting resistor value is suitable for constant resistor drive scenarios, meaning that when the application circuit does not use PWM regulation and only limits current through a fixed resistor, this resistor value can be directly selected. Meanwhile, in The analog voltage values ​​with / without objects are collected. and Calculate the optimal threshold voltage for distinguishing the presence or absence of an object. .

[0092] Step S7: The host computer displays and outputs the optimal drive parameters (duty cycle). Equivalent current limiting resistor value Optimal decision threshold voltage ), which serve as the calibration parameters for this photoelectric sensor in the current scenario. Used to determine the drive control quantity of the LED (control module firmware PWM parameter setting, open-loop control). Used to determine the driving circuit parameters of the LED (such as the selection of the current limiting resistor on the main control board). Used to distinguish between states with objects and states without objects (such as the criterion for comparison logic in software).

[0093] In one embodiment, to further expand the applicability of the calibration method, the first and second scans described above can be performed separately for different object types and / or different target object distances to obtain multiple sets of response curves without objects and response curves with objects. The AI ​​analysis model is trained or predicted based on the multiple sets of response curves and their corresponding scene codes, and outputs the optimal driving duty cycle, equivalent current limiting resistor value, and optimal judgment threshold voltage corresponding to each scene, thereby realizing the construction of a calibration parameter set for multiple scenes.

[0094] Example 4:

[0095] After obtaining the calibration parameters of the photoelectric sensor through the method described in Example 3, this example provides two object recognition methods based on the calibration parameters, which can reliably distinguish two different objects under fixed installation conditions.

[0096] This embodiment learns ratio feature vector templates (F_A, F_B) and an existence threshold under a baseline duty cycle for two types of first and second objects (object A and object B). During online recognition, the Euclidean distance between the feature vector to be tested and the template is calculated, and the category is output according to the nearest neighbor principle. It also supports rejecting unknown objects (if the distance is greater than a preset threshold). This embodiment enables the photoelectric sensor to reliably distinguish between a first object and a second object (such as a white card and a black card) under fixed installation conditions, outputting a binary choice result. The steps are as follows:

[0097] E1-S1. Pulse sequence parameter settings:

[0098] Set the PWM pulse sequence parameters, including the frequency (100Hz~1kHz) and N duty cycle nodes (duty cycle range such as 10%~90%).

[0099] In some embodiments, the PWM frequency can be configured to 100Hz (period 10ms), and the number of duty cycle nodes N=5, with the five duty cycle nodes being 10%, 30%, 50%, 70%, and 90% respectively; this can be extended to N=10, with the nodes increasing in 10% increments. It should be understood that the specific values ​​of the frequency and duty cycle nodes mentioned above are only examples, and can be flexibly adjusted according to the sensor characteristics and detection requirements in actual applications.

[0100] Each duty cycle outputs one complete cycle (10ms). The ADC performs one or more samplings to take the average value in the last 50% window of the pulse (i.e., the 5~10ms interval). After each duty cycle output ends, a no-drive interval (0% duty cycle, the interval duration can be set to 2ms) is inserted to restore the phototransistor to the dark state and update the ambient light reference.

[0101] E1-S2. Ambient Light Reference Acquisition:

[0102] In the no-drive output (0% duty cycle) state, the control module performs ADC sampling to obtain the combined reference voltage V_dark of ambient light and circuit offset, and stores it in memory. All subsequent sampled values ​​are subtracted from this reference to obtain the net signal voltage, eliminating the influence of absolute light intensity fluctuations.

[0103] E1-S3 Template Learning:

[0104] The first object is placed at the detection position, and the control module performs a scan according to the pulse sequence set by E1-S1. Within the pulse window of each duty cycle node, the net signal after subtracting the reference voltage is acquired, for example, to obtain... , , , , .

[0105] Repeat the sampling three times and take the average. Then calculate the ratio between each net signal to construct the first ratio feature vector. :

[0106] ;

[0107] in, , , , ;

[0108] Will Stored in a memory (such as the control module Flash) as the first template.

[0109] Replace with a second object and repeat the above steps to obtain the second ratio feature vector. And store it as a second template.

[0110] Record the net signal of the two objects at the reference duty cycle. and The reference duty cycle is determined by the optimal drive duty cycle obtained by the method described in Example 3 (e.g., the maximum value among the optimal drive duty cycles corresponding to each object).

[0111] E1-S4. Existence Threshold Calibration

[0112] Remove all objects and sample multiple times (e.g., 10 times) at a baseline duty cycle (e.g., 90% duty cycle) to obtain the mean net signal without objects. and standard deviation Set an existence threshold , where k is a preset coefficient (e.g., k=3). It can be understood that the specific value of k can be adjusted according to the requirements of the false alarm rate and false negative rate in the actual application scenario.

[0113] In one embodiment, the reference duty cycle is determined based on the optimal drive duty cycle corresponding to each type of object. For example, the maximum value among the optimal drive duty cycles corresponding to each type of object is taken to ensure that all objects to be identified have sufficient signal strength under a uniform duty cycle.

[0114] E1-S5. Online Recognition:

[0115] Perform the same pulse sequence scan on the object under test to obtain the net signal under test at each duty cycle node, including the net signal value corresponding to the reference duty cycle.

[0116] Existence determination: If the net signal value in the net signal to be measured corresponding to the reference duty cycle is less than the existence threshold. If no object is found, the recognition process ends.

[0117] If an object is determined to exist, then the ratio feature vector of the object to be measured is calculated. .

[0118] Distance calculation: Calculate separately and , Euclidean distance , .

[0119] Decision output:

[0120] like Output "First object";

[0121] like Output "Second object";

[0122] like The output is "unknown object". This is the preset rejection threshold.

[0123] In addition, it should be noted that if (or equal within the preset tolerance range), the object to be tested can be determined as an "unknown object", prompting the user to confirm the detection conditions or supplement the template.

[0124] Example 5:

[0125] After obtaining the calibration parameters of the photoelectric sensor through the method described in Example 2, this example provides a multi-object recognition method based on the calibration parameters, which is suitable for application scenarios that require distinguishing K types (K≥3) of objects with different materials / colors.

[0126] This embodiment constructs a ratio feature template library containing K categories (K≥3) of standard objects; during online recognition, it uses nearest neighbor matching to output the category corresponding to the minimum distance, and has a template library expansion and rejection mechanism. It is suitable for application scenarios that require distinguishing N different materials / colors (N≥3), such as identifying white, black, red, yellow, and blue objects in material sorting.

[0127] E2-S1. Pulse sequence curing and ambient light reference acquisition:

[0128] E1-S1 and E1-S2 are the same as in Example 4, and will not be described again here.

[0129] E2-S2. Construction of Multiple Template Libraries:

[0130] For the k-th type of standard object (k=1~K), place it at the detection position and perform pulse scanning to obtain the net signal at each duty cycle node (e.g., ~ Perform M repeated samplings (e.g., M=10), take the net signal mean at each duty cycle node, and calculate the ratio eigenvector. For example, ,in:

[0131] ;

[0132] ;

[0133] ;

[0134] ;

[0135] in, This indicates taking the average.

[0136] Will As a template for the ratio feature vector of the k-th standard object.

[0137] All templates and category tags are stored in memory, forming a template library. If the number of templates exceeds the storage capacity of the memory, they can be stored on the host computer and loaded via USB power-on.

[0138] E2-S3. Existence threshold calibration:

[0139] Same as E1-S4 in Example 4.

[0140] E2-S4. Online Recognition:

[0141] The object to be tested is scanned to obtain the net signal under each duty cycle node. If the net signal value corresponding to the reference duty cycle in the net signal to be tested is less than the existence threshold, it is determined that there is no object and the recognition ends.

[0142] If an object is determined to exist, then the feature vector of the ratio to be measured is calculated. .

[0143] Distance calculation: Traverse the template library and calculate With each Euclidean distance .

[0144] Nearest neighbor matching and result output: Find the minimum distance The corresponding category is the recognition result.

[0145] Rejection handling: If The output is "unknown object," indicating that the template library needs to be expanded or the detection conditions may have changed. This is the preset rejection threshold.

[0146] This application introduces AI analysis models into the calibration of photoelectric sensor parameters, replacing manual trial and error, and achieving fast, consistent, and reproducible calibration; the recognition method based on pulse sequence ratio characteristics is sensitive to changes in object color and reflectivity, and has strong robustness to ambient light and device aging; the device and algorithm are integrated into a single design, which can flexibly adapt to different sensor models and object scenarios.

[0147] Obviously, those skilled in the art should understand that the various units or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device, or fabricating them separately as individual integrated circuit modules, or fabricating multiple modules or steps into a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.

[0148] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A method for automatically calibrating the driving parameters of a photoelectric sensor, characterized in that, Includes the following steps: Install the photoelectric sensor to be calibrated onto the photoelectric sensor parameter calibration device, and establish a communication connection between the photoelectric sensor parameter calibration device and the host computer; In response to the distance control command sent by the host computer, the target object is driven to move along a preset path to the calibration reference position; Perform the first scan: When the target object moves out of the detection area of ​​the photoelectric sensor, the control module outputs PWM drive signals to the transmitter of the photoelectric sensor in sequence according to the preset N duty cycle nodes, and collects the analog voltage value output by the receiver of the photoelectric sensor under each duty cycle node to obtain the response curve without object; Perform the second scan: When the target object is placed in the detection area of ​​the photoelectric sensor, the control module outputs PWM drive signals to the transmitter of the photoelectric sensor in sequence according to the preset N duty cycle nodes, and collects the analog voltage value output by the receiver of the photoelectric sensor under each duty cycle node to obtain the object response curve. The objectless response curve and the object-containing response curve are sent to the AI ​​analysis model running in the host computer; The AI ​​analysis model verifies and extracts features from the response curves without objects and the response curves with objects, and predicts the optimal driving duty cycle. The optimal drive duty cycle is output as the calibration parameter of the photoelectric sensor.

2. The method according to claim 1, characterized in that, The AI ​​analysis model verifies and extracts features from the objectless response curve and the object-containing response curve, and predicts the optimal driving duty cycle, specifically including: Verify curve validity: Check whether the simulated voltage value of the object under the minimum duty cycle reaches the preset saturation threshold of the ADC full scale. If it does, prompt to reduce the starting duty cycle of the scan range and re-execute the first and second scans. In response to the successful validity check of the curve, the difference between each duty cycle, the trend of curve slope change, and the saturation flag are extracted from the objectless response curve and the object-containing response curve as features. The extracted features are combined with scene encoding and input into the AI ​​analysis model. The AI ​​analysis model outputs the optimal driving duty cycle, which ensures that both the simulated voltage value without an object and the simulated voltage value with an object are within the linear range of the ADC and that the difference between the two is maximized.

3. The method according to claim 1, characterized in that, The calibration method further includes: For different object types and / or different target object distances, the first scan and the second scan are performed respectively to obtain multiple sets of object-free response curves and object-containing response curves; The AI ​​analysis model is trained or predicted based on the multiple sets of response curves and their corresponding scene codes, and outputs the optimal driving duty cycle corresponding to each scene.

4. An automatic calibration device for photoelectric sensor driving parameters, characterized in that, To implement the method according to any one of claims 1 to 3, comprising: Sensor interface socket for pluggable mounting of photoelectric sensors to be calibrated; The drive mechanism is used to drive the target object to move along a preset path to the calibration reference position in response to the distance control command of the host computer; The LED control circuit is used to sequentially output PWM drive signals to the transmitter of the photoelectric sensor according to N preset duty cycle nodes; The signal acquisition circuit is used to acquire the analog voltage value output by the photoelectric sensor receiver at each duty cycle node to obtain a response curve without an object when the target object moves out of the detection area of ​​the photoelectric sensor, and to acquire the analog voltage value output by the photoelectric sensor receiver at each duty cycle node to obtain a response curve with an object when the target object is placed in the detection area of ​​the photoelectric sensor. The control module is used to upload the response curve without objects and the response curve with objects to the host computer so that the AI ​​analysis model can perform calibration parameter prediction.

5. An automatic calibration system for photoelectric sensor driving parameters, characterized in that, The device includes the apparatus of claim 4, and a host computer, wherein the host computer is used to run an AI analysis model, receive the objectless response curve and the object-present response curve uploaded by the device, perform verification and feature extraction on the curves, predict the optimal driving duty cycle, and output the calibration parameters of the photoelectric sensor.

6. A multi-object recognition method, characterized in that, Includes the following steps: Set PWM pulse sequence parameters, which include frequency and N duty cycle nodes; In the state of no drive output, the combined reference voltage of ambient light and circuit offset is collected; For each of the N types of standard objects, perform the following operations: place the current type of standard object in the detection position, perform scanning according to the PWM pulse sequence, collect the net signal after deducting the reference voltage in the pulse window of each duty cycle node, calculate the ratio between each net signal as the ratio feature vector of the standard object of that type, and store it in the memory to construct a template library containing N templates. Remove all objects, and obtain the mean and standard deviation of the net signal without objects by sampling multiple times at the reference duty cycle. Set an existence threshold based on the mean and standard deviation of the net signal without objects. The reference duty cycle is determined by using the automatic calibration method of photoelectric sensor driving parameters as described in claim 3 to obtain the optimal driving duty cycle corresponding to various standard objects. The reference duty cycle is determined based on the optimal driving duty cycle corresponding to various standard objects. The object to be tested is scanned to obtain the net signal to be tested at each duty cycle node. If the net signal value corresponding to the reference duty cycle in the net signal to be tested is less than the existence threshold, it is determined that there is no object and the recognition ends. If an object is determined to exist, the ratio between the net signals to be measured is calculated as the feature vector of the ratio to be measured. The distance between the feature vector of the ratio to be measured and each template in the template library is calculated, and the corresponding object category is output based on the distance comparison result.

7. The method according to claim 6, characterized in that, The step of outputting the corresponding object category based on the distance comparison result includes: Determine whether the minimum distance between the feature vector of the ratio to be tested and each template in the template library is greater than a preset rejection threshold; If the value exceeds the preset rejection threshold, then output "unknown object". If the value is not greater than the preset rejection threshold, then the step of outputting the category corresponding to the template with the smallest distance from the feature vector of the test ratio is executed.

8. The method according to any one of claims 6 to 7, characterized in that, The acquisition of the net signal after subtracting the reference voltage within the pulse window of each duty cycle node specifically includes: Each duty cycle node outputs a PWM pulse signal for one complete cycle; ADC sampling is performed within the latter half window of the pulse at each duty cycle node to obtain the sampled value; The net signal is obtained by subtracting the reference voltage from the sampled value.

9. The method according to claim 8, characterized in that, The step of acquiring the net signal after subtracting the reference voltage within the pulse window of each duty cycle node also includes: After the output of each duty cycle node ends, a no-drive interval is inserted, during which the PWM duty cycle is set to 0% so that the photoelectric sensor receiver can restore the dark state and update the ambient light reference.

10. The method according to claim 8, characterized in that, The step of acquiring the net signal after subtracting the reference voltage within the pulse window of each duty cycle node also includes: The sampling process is repeated multiple times for each duty cycle node, and the average of the multiple sampling results is taken as the net signal for that duty cycle node.