Background
At present, the diffuse reflection type object detection device is very versatile in industry, especially on an automatic device, basically speaking, each device is provided with the diffuse reflection type object detection device, and even a plurality of devices are provided with the diffuse reflection type object detection device.
The diffuse reflection object detection device for industrial application generally uses a red light emitting tube as a transmitting tube, which can emit infrared rays to the outside, and a receiving module composed of an infrared receiving tube and an additional circuit for receiving the infrared rays reflected from an external object. The infrared receiving tube is an electronic element with a light receiving surface, when the light receiving surface is irradiated by light rays in a proper wavelength range, the conduction performance of the receiving tube is changed, and the change is embodied in a circuit as that the voltage output by the receiving module changes, and the change amplitude of the voltage is related to the illumination intensity. Other wavelengths may be used for special applications, such as visible light emitters and receivers when direct viewing of the detection beam by the human eye is desired.
According to the number of the receiving tubes, the diffuse reflection type object detection device can be divided into a single receiving tube type and a multi-receiving tube type, the former is the most common, the appearance of the diffuse reflection type object detection device is usually cylindrical or matchbox-shaped, an infrared transmitting tube and an infrared receiving module (consisting of a receiving tube and an additional circuit) are arranged in the diffuse reflection type object detection device, and the diffuse reflection type object detection device is generally used for judging whether an object with a larger size exists on a certain fixed point; the multi-receiving tube type detection device is generally strip-shaped in appearance, is provided with a plurality of infrared receiving modules and can be used for judging whether objects with small body shapes exist in a large range. The general working principle of the conventional detection device is that an infrared transmitting tube is powered on discontinuously or continuously to emit infrared rays, and simultaneously, the voltage output by an infrared receiving module is detected and compared with a set threshold voltage.
In order to adapt to different environments and objects to be detected, a sensitivity adjusting device is often arranged on the detection device and used for setting threshold voltage for comparison, the common adjusting device is a potentiometer, and an operator needs to manually adjust the threshold voltage of the receiving module according to field conditions. Such a conventional diffuse reflection type detection device has the following disadvantages:
1. the sensitivity of the receiving module of the detection device needs to be manually adjusted by an operator, so that the detection performance of the detection device is related to the use experience of the operator, and the phenomenon of improper adjustment cannot be avoided.
2. For a multi-receiver type detection device, all receiving modules use the same sensitivity (namely, threshold voltage), when the detection device is installed in a narrow space close to a side vertical wall, in order to avoid that partial receiving modules judge objects by mistake due to the reflection of the vertical wall around the detection device, the whole receiving sensitivity can only be adjusted to be lower intentionally, so that the detection capability is poor, and when the reflectivity of the vertical wall is higher or the vertical wall is too close to the detection device, the detection device can not detect the objects normally no matter how the sensitivity is adjusted. Similarly, if a fixed obstacle exists in front of the respective receiving tubes of the detecting device, the detecting device may not detect objects other than the obstacle because of continuously receiving the infrared rays reflected by the obstacle.
3. Since the sensitivity of the receiving module is fixed, the detecting device cannot automatically adapt to the environment, and a slight change in the environment is erroneously determined as the detection of an object when the sensitivity is adjusted too high, and if the sensitivity is set too low, the occurrence of the object may be missed. For example, when the device is used for detecting small-sized workpieces on a conveyor belt, the conventional detection device often makes a misjudgment because the wear of the surface of the conveyor belt and the real workpieces cannot be distinguished.
Disclosure of Invention
In order to overcome the defects of the prior art, one of the objectives of the present invention is to provide a diffuse reflection type object detection method with self-learning function, which can improve the detection performance of the detection device.
Another object of the present invention is to provide an electronic device capable of improving the detection performance of the detection device.
It is a further object of the present invention to provide a computer-readable storage medium that can improve the detection performance of the detection apparatus.
One of the purposes of the invention is realized by adopting the following technical scheme:
a diffuse reflection type object detection method with a self-learning function comprises the following steps:
a receiving step: receiving a self-learning control instruction;
self-learning step: measuring output voltage values of the receiving modules under two conditions of opening or closing the transmitting tube one by one according to the received self-learning instruction;
a calculation step: calculating the difference value of the output voltage of each receiving module under the two conditions of opening or closing the transmitting tube according to the output voltage, and storing the difference value data;
a detection step: and judging whether an object is detected according to the stored voltage difference value of each receiving module.
Further, in the self-learning step: the control device in the detection device can record the process of voltage difference value change of the receiving module caused by the reflectivity change of the environment, and remove the interference caused by the environment factors through an algorithm.
Further, the voltage value is Vnt, and in the detection step, the object is determined to be detected when the receiving module n simultaneously satisfies (| Vn-Vnt |/Vnt) ≧ Csen and | Vn-Vnt | ≧ Vabs, where Vn is a difference between output voltages of the receiving module n in the presence or absence of the irradiation of the emitting tube during the actual detection process, Vabs is a preset constant, and Csen is a preset sensitivity coefficient.
Further, the voltage output by the receiving module is monotonically and positively correlated with the received irradiation intensity, the voltage difference is Vnt, in the detecting step, the number of rounds is preset to be P, when the receiving module n meets (| Vn-Vnt |/Vnt) ≧ Csen in a certain round of detection, the object is not immediately determined to be detected, but the existence of the object is determined when the receiving module n meets the condition in the continuous P rounds of detection, wherein Vn is the difference of the output voltages of the receiving module n under the condition of irradiation of the emitting tube or not in the actual detection process, and Csen is a preset sensitivity coefficient.
Further, the voltage output by the receiving module is monotonically and positively correlated with the received irradiation intensity, the voltage difference is Vnt, in the detection step, when the number of the receiving modules is greater than 1, in one round of detection, it is determined that an object is detected only when not less than T receiving modules simultaneously satisfy (| Vn-Vnt |/Vnt) ≧ Csen, where T is the preset number of receiving modules, Vn is the difference of output voltages of the receiving modules n in the actual detection process under the condition of irradiation of the transmitting tube, and Csen is a preset sensitivity coefficient.
Further, the voltage output by the receiving modules is monotonically and positively correlated with the received irradiation intensity, the voltage difference is Vnt, in the detection step, when the number of the receiving modules is greater than 1, in one round of detection, even if the voltage difference of each receiving module does not satisfy (| Vn-Vnt |/Vnt) ≥ Csen, but adjacent receiving modules greater than or equal to T satisfy (| Vn-Vnt |/Vnt) ≥ Cf simultaneously, it is determined that an object is detected, where Vn is the difference of the output voltages of the receiving modules in the actual detection process with or without irradiation of the transmitting tube, Csen is a preset sensitivity coefficient, Cf is a coefficient less than Csen, and T is the number of the receiving modules.
Further, the sensitivity coefficient Csen is 0.1 or more.
Further, in the self-learning step, the number of detection performed is any value in the middle of 100-600; for the periodically changing environment, the value of the detection times covers more than 1 change period;
when the reflection capability of the workpiece is close to the background of the detection position, firstly changing the background reflection capability of the detection position, and then executing a self-learning step;
the second purpose of the invention is realized by adopting the following technical scheme:
an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing a method of diffuse reflective object detection with self-learning functionality according to any one of the objects of the present invention when executing the computer program.
The third purpose of the invention is realized by adopting the following technical scheme:
a computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out a method of diffuse reflective object detection with self-learning functionality according to any one of the objects of the invention.
Compared with the prior art, the invention has the beneficial effects that:
according to the diffuse reflection type object detection method with the self-learning function, the voltage difference values of all receiving modules in the corresponding environment are learned in advance, different judgment conditions are used according to actual environment conditions, and therefore the influence of side vertical wall reflection, fixed obstacles and environment reflectivity change on the overall detection performance is avoided.
Detailed Description
The present invention will be further described with reference to the accompanying drawings and the detailed description, and it should be noted that any combination of the embodiments or technical features described below can be used to form a new embodiment without conflict.
Example one
As shown in fig. 1, the present embodiment provides a diffuse reflection type object detection method with a self-learning function, including the following steps:
s101: receiving a self-learning control instruction; the object detection device (assuming that the detection device has k receiving modules in total) is installed in an environment needing actual work, and the detection device is ensured not to have the object to be detected in front of the detection surface. Pressing a learning key on the detection device to start a self-learning process of the detection device, wherein the detection device obtains the output voltage of each receiving module according to the following steps:
s102: measuring output voltages output by the receiving modules one by one under the condition that the transmitting tubes are respectively opened or closed by the receiving modules according to the received self-learning control instructions; let the 1 st receiving module measure the output voltage value as V1b when the transmitting tube is opened, the voltage value as V1d when the transmitting tube is closed, the voltage value as Vnb when the transmitting tube is opened, and the voltage value as Vnd when the transmitting tube is closed.
When the above-mentioned detection step was carried out 1 st time, V1b to Vkb were saved as V1bmax to Vkbmax, and V1d to Vkd were saved as V1dmin to Vkdmin. Repeatedly executing the steps for m times (m is a preset value, the preset value is set in a detection device before installation, 300 + 500 is available for a common environment, for an environment with periodically changed reflectivity, m value taking requirement is to ensure that the repeatedly executed process must cover more than 1 environment change period, for example, when detecting articles on a conveyor belt, the repeatedly executed times need to ensure that the repeatedly executed process covers more than 1 whole circle of conveyor belt, after each execution is finished, checking whether the obtained V1 b-Vkb is larger than V1 bmax-Vkbmax one by one, and always storing the maximum value as V1 bmax-Vkbmax; the V1 d-Vkd obtained this time is checked one by one to see if it is smaller than V1 dmin-Vkdmin, and the minimum value is always kept as V1 dmin-Vkdmin.
More preferably, in the step, the number of times of performing the detection is any value in the range of 100-; for a periodically changing environment, the value of the detection times covers more than 1 change period.
S103: calculating the difference value of the output voltage of each receiving module under the two conditions of opening or closing the transmitting tube according to the obtained output voltage of each receiving module and storing the difference value data; and performing difference operation on the Vnbmax value and the Vndmin value obtained by all the k receiving modules to obtain a voltage difference Vnt of the receiving module. The Vnt values calculated by each receiving module are stored in a nonvolatile memory in the detector for use in the working process
S104: and judging whether an object is detected according to the stored voltage difference value of each receiving module. The voltage output by the receiving module is in monotonous positive correlation with the received irradiation intensity, the actual working process of the detection device is similar to the detection mode of the receiving modules one by one in the learning process, the detection device continuously detects the output voltages Vnb and Vnd of the 1 st receiving module to the k th receiving module under the condition of irradiation of a transmitting tube in a circulating mode, the difference Vn of the output voltages Vnb and the output voltage Vnd is calculated, the difference Vn is compared with the voltage difference Vnt of the corresponding receiving module obtained in the learning process, when a certain receiving module n meets the condition that (Vn-Vnt)/Vnt is not less than Csen (Csen is a preset sensitivity coefficient and can be generally set to be 0.1 or more), the module is judged to receive the reflected light of the object, and the detection device detects the object. The above is only the most direct determination method, and in order to actually reduce erroneous determination due to interference factors and improve detection reliability, the following methods may be used alone or in combination.
In addition to the direct detection method, there is a more preferable detection method, which is more convenient for the user to flexibly set for object detection.
More preferably, the voltage difference is Vnt, and in the detecting step, the object is determined to be detected when a certain receiving module n simultaneously satisfies (Vn-Vnt)/Vnt ≧ Csen and (Vn-Vnt) ≧ Vabs, where Vn is the difference of the output voltages of the receiving module n with or without the irradiation of the emitting tube during the actual detection process, Vabs is a preset constant, and Csen is a preset sensitivity coefficient.
More preferably, the voltage difference is Vnt, in the detecting step, the number of rounds is set as P in advance, and when the receiving module n satisfies (Vn-Vnt)/Vnt ≧ Csen in a round of detection, the receiving module n does not immediately determine that an object is detected, but determines the presence of the object when the receiving module n satisfies the condition in consecutive P rounds of detection, where Vn is the difference between the output voltages of the receiving module n with or without the irradiation of the emitter during the actual detection, and Csen is a preset sensitivity coefficient.
More preferably, the voltage difference is Vnt, and in the detecting step, when the number of the receiving modules is greater than 1, the object is determined to be detected only when not less than T receiving modules simultaneously satisfy respective (Vn-Vnt)/Vnt ≧ Csen in one round of detection, where T is the preset number of receiving modules, Vn is the difference between the output voltages of the receiving modules n with or without the irradiation of the transmitting tube during the actual detection, and Csen is a preset sensitivity coefficient.
More preferably, the voltage difference is Vnt, and in the detecting step, when the number of receiving modules is greater than 1, in one round of detection, even if the difference of each receiving module does not satisfy the respective (Vn-Vnt)/Vnt ≧ Csen, but the adjacent receiving modules greater than or equal to T simultaneously satisfy the respective (Vn-Vnt)/Vnt ≧ Cf, it is determined that an object is detected, where Vn is the difference of the output voltages of the receiving modules n with or without the irradiation of the transmitting tube during actual detection, Csen is a preset sensitivity coefficient, Cf is a coefficient slightly smaller than Csen, and T is the preset number of receiving modules.
Example two
The embodiment is an implementation scheme aiming at the condition that the reflecting capacity of an object to be detected is stronger than the background of a detection position, and the core detection principle is that the intensity of the reflected light received by the detection device when the object exists is always stronger than the intensity of the reflected light when the object does not exist, so that the object is determined to be detected once the intensity of the received reflected light is stronger than the intensity of the reflected light during learning and the condition set in the embodiment is met in the actual working process. In the actual production process, the situation that the reflection capability of some objects to be detected is weaker than that of the background of the detection position, for example, dark-colored plastic parts in front of a white wall, can also be encountered, and the detection can be performed by using the method of the second embodiment.
When the reflection capability of the object to be detected is approximate to the background of the detection position, the detection accuracy and reliability can be ensured by changing the background reflection capability in advance.
The embodiment provides a diffuse reflection type object detection method with a self-learning function, which comprises the following steps:
s201: receiving a self-learning control instruction; the object detection device (assuming that the detection device has k receiving modules in total) is installed in an environment needing actual work, and the detection device is ensured not to have the object to be detected in front of the detection surface. Pressing a learning key on the detection device to start a self-learning process of the detection device, wherein the detection device obtains the output voltage of each receiving module according to the following steps:
s202: measuring output voltages output by the receiving modules one by one under the condition that the transmitting tubes are respectively opened or closed by the receiving modules according to the received self-learning control instructions; let the 1 st receiving module measure the output voltage value as V1b when the transmitting tube is opened, the voltage value as V1d when the transmitting tube is closed, the voltage value as Vnb when the transmitting tube is opened, and the voltage value as Vnd when the transmitting tube is closed.
When the above-mentioned detection step was carried out 1 st time, V1b to Vkb were saved as V1bmin to Vkbmin, and V1d to Vkd were saved as V1dmax to Vkdmax. Repeatedly executing the steps for m times (m is a preset value and is set in a detection device before installation, 300 + 500 is available for a common environment, for an environment with periodically changed reflectivity, m value taking requirement is to ensure that the repeatedly executed process must cover more than 1 environment change period, for example, when detecting an article on a conveyor belt, the repeatedly executed times need to ensure that the repeatedly executed process covers and carries away more than 1 whole circle), after each execution is finished, checking whether the obtained V1 b-Vkb is smaller than V1 bmin-Vkbmin one by one, and always storing the minimum value as V1 bmin-Vkbmin; the V1 d-Vkd obtained this time is checked one by one to see whether it is larger than V1 dmax-Vkdmax, and the maximum value is always stored as V1 dmax-Vkdmax.
More preferably, in the step, the number of times of performing the detection is any value in the range of 100-; for a periodically changing environment, the value of the detection times covers more than 1 change period.
S203: calculating the difference value of the output voltage of each receiving module under the two conditions of opening or closing the transmitting tube according to the obtained output voltage of each receiving module and storing the difference value data; and performing difference operation on the Vnbmin value and the Vndmax value obtained by all the k receiving modules to obtain a voltage difference Vnt of the receiving module. The Vnt values calculated by each receiving module are stored in a nonvolatile memory in the detector for use during operation.
S204: and judging whether an object is detected according to the stored voltage difference value of each receiving module. The voltage output by the receiving module is in monotonous positive correlation with the received irradiation intensity, the actual working process of the detection device is similar to the detection mode of the receiving modules one by one in the learning process, the detection device continuously detects the output voltages Vnb and Vnd of the 1 st receiving module to the k th receiving module under the condition of irradiation of a transmitting tube in a circulating mode, the difference Vn of the output voltages Vnb and the output voltages Vnd is calculated, the difference Vn is compared with the voltage difference Vnt of the corresponding receiving module obtained in the learning process, when a certain receiving module n meets the requirement of (Vnt-Vn)/Vnt is larger than or equal to Csen (Csen is a preset sensitivity coefficient and can be generally set to be 0.1 or more), the module is judged to receive the reflected light of the object, and the detection device detects the object. The above is only the most direct determination method, and in order to actually reduce erroneous determination due to interference factors and improve detection reliability, the following methods may be used alone or in combination.
In addition to the direct detection method, there is a more preferable detection method, which is more convenient for the user to flexibly set for object detection.
More preferably, the voltage difference is Vnt, and in the detecting step, it is determined that the object is detected when a certain receiving module n simultaneously satisfies (Vnt-Vn)/Vnt ≧ Csen and (Vnt-Vn) ≧ Vabs, where Vn is the difference between the output voltages of the receiving module n with or without the irradiation of the emitting tube during the actual detection process, Vabs is a preset constant, and Csen is a preset sensitivity coefficient.
More preferably, the voltage difference is Vnt, in the detecting step, the number of rounds is set as P in advance, and when the receiving module n satisfies (Vnt-Vn)/Vnt ≧ Csen in a round of detection, the receiving module n does not immediately determine that an object is detected, but determines the presence of the object when the receiving module n satisfies the condition in consecutive P rounds of detection, where Vn is the difference between the output voltages of the receiving module n with or without the irradiation of the emitter during the actual detection, and Csen is a preset sensitivity coefficient.
More preferably, the voltage difference is Vnt, and in the detecting step, when the number of the receiving modules is greater than 1, the object is determined to be detected only when not less than T receiving modules simultaneously satisfy respective (Vnt-Vn)/Vnt ≧ Csen in one round of detection, where T is the preset number of receiving modules, Vn is the difference between the output voltages of the receiving modules n with or without the irradiation of the transmitting tube during the actual detection, and Csen is a preset sensitivity coefficient.
More preferably, the voltage difference is Vnt, and in the detecting step, when the number of receiving modules is greater than 1, in one round of detection, even if the difference of each receiving module does not satisfy the respective (Vnt-Vn)/Vnt ≧ Csen, but the adjacent receiving modules greater than or equal to T simultaneously satisfy the respective (Vnt-Vn)/Vnt ≧ Cf, it is determined that an object is detected, where Vn is the difference of the output voltages of the receiving modules n with or without the irradiation of the transmitting tube during actual detection, Csen is a preset sensitivity coefficient, Cf is a coefficient slightly smaller than Csen, and T is the preset number of receiving modules.
The diffuse reflection type object detection method with the self-learning function in the first embodiment and the second embodiment has the following advantages:
1. the detection method has an automatic learning function, an operator only needs to press a key to start the adjusting process, and a control device in the detection device can complete the whole adjusting process according to a set algorithm without the intervention of the operator.
2. For a multi-receiver type detection device, different receiving modules have independent basic data for detection and judgment, and the phenomenon that all receiving modules are influenced by side vertical wall reflection or fixed obstacles due to the fact that the same sensitivity set value is used is avoided.
3. The detection device can automatically adapt to the working environment, in the automatic adjustment process, the control device in the detection device can record the whole process of the change of the environmental reflectivity, and the interference caused by environmental factors is removed through an algorithm, so that the detection device is ensured to have good detection performance all the time.
EXAMPLE III
The third embodiment discloses an electronic device, which comprises a processor, a memory and a program, wherein the processor and the memory can adopt one or more programs, the program is stored in the memory and configured to be executed by the processor, and when the processor executes the program, the diffuse reflection type object detection method with the self-learning function of the first embodiment and the second embodiment is realized. The electronic equipment can be a series of electronic equipment such as a single chip microcomputer system, a mobile phone, a computer and a tablet computer.
Example four
The fourth embodiment discloses a computer-readable storage medium storing a program, and the program, when executed by a processor, implements the diffuse reflection type object detection method with the self-learning function of the first and second embodiments.
Of course, the storage medium provided by the embodiment of the present invention contains computer-executable instructions, and the computer-executable instructions are not limited to the method operations described above, and may also perform related operations in the method provided by any embodiment of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes instructions for enabling an electronic device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
It should be noted that, in the foregoing embodiment, each included unit and each included module are only divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
The above embodiments are only preferred embodiments of the present invention, and the protection scope of the present invention is not limited thereby, and any insubstantial changes and substitutions made by those skilled in the art based on the present invention are within the protection scope of the present invention.