Disclosure of Invention
Aiming at the technical problems, the invention adopts the following technical scheme:
a system for ambient light interference resistance of a photosensor, comprising: the optical signal receiver, first analog switch, filter module, second analog switch, treater and optical signal transmitter concatenate in proper order, and wherein, filter module includes: all-pass filters and d fixed frequency band pass filters, all connected simultaneously with the first module switch and the second analog switch, the d fixed frequency band pass filters comprising at least: 10khz band pass filter, 60khz band pass filter.
When the computer program is executed, the following steps are implemented:
s1, acquiring an interference optical signal information list X= { X in a target environment based on an all-pass filter 1 ,X 2 ,……,X i ,……,X m An ith interference optical signal information X i =(XF i ,XY i ,XP i ),XF i XY for the frequency of the ith interfering light signal in the target environment i XP is the voltage value of the ith interference optical signal in the target environment i Is XF i And the value of i in the corresponding frequency interval is 1 to m, and m is the number of interference optical signals in the target environment.
S2, based on X, acquiring a frequency difference set Q= { Q between the target band-pass filter and the frequency of the interference optical signal 1 ,Q 2 ,……,Q j ,……,Q n A list Q of frequency differences between the jth target bandpass filter and the frequency of the interfering optical signal j ={Q j1 ,Q j2 ,……,Q ji ,……,Q jm },Q ji For the center frequency and XF of the jth target band-pass filter i The absolute value of the difference between the values, j, is 1 to n,n is the number of target band-pass filters, n is less than or equal to d, and the target band-pass filters are fixed frequency band-pass filters which meet the preset frequency condition in the d fixed frequency band-pass filters.
S3, based on Q, acquiring a priority list Y= { Y corresponding to the target band-pass filter 1 ,Y 2 ,……,Y j ,……,Y n },Y j Is Q j Corresponding priority, Y j =min(Q j1 ,Q j2 ,……,Q ji ,……,Q jm )。
S4, based on Y, acquiring a first output voltage value set V= { V corresponding to the target band-pass filter 1 ,V 2 ,……,V j ,……,V n A first output voltage value list V corresponding to the jth target band-pass filter j ={V j1 ,V j2 ,……,V ji ,……,V jm },V ji The voltage value corresponding to the ith interference optical signal output by the jth target band-pass filter is obtained; wherein V is ji Meets the following conditions:
wherein k is
ij Is XF
i Attenuation coefficient in the j-th target bandpass filter.
S5, based on V, obtaining V x The corresponding target band-pass filter is taken as a designated filter, the center frequency corresponding to the designated filter is taken as the frequency of the emitted light signal of the light signal emitter, V x E V and V x The target band-pass filter with the highest priority among the target band-pass filters meeting the first preset voltage condition is adopted; wherein the first preset voltage condition is that each voltage value in the corresponding first output voltage value list is smaller than a preset voltage threshold V 0 。
The invention has at least the following beneficial effects:
(1) The method comprises the steps that a fixed frequency band-pass filter with different frequencies from those of interference light signals in a target environment is selected as a target band-pass filter, the priority corresponding to the target band-pass filter and a first output voltage value list corresponding to the target band-pass filter are calculated, each first voltage output value in the first output voltage value list is compared with a preset voltage threshold value, so that the target band-pass filter with each voltage value smaller than the preset voltage threshold value and the highest priority in the first output voltage value list is selected as a designated filter, interference of the interference light signals in the target environment to the designated filter is avoided, and the designated filter is the target band-pass filter with the largest frequency difference between the frequency of the interference light signals in the nearest target environment in the target band-pass filter meeting the first preset voltage condition; according to the embodiment, the designated filter corresponding to the photoelectric sensor is determined according to the difference of the interference light signals in the target environment, so that the influence of the interference light signals in the target environment on the photoelectric sensor is minimized, the influence of the interference light signals in the target environment on the photoelectric sensor is minimized no matter where the target environment is arranged, and the working accuracy and efficiency of the photoelectric sensor are improved.
(2) When the specified filter is not selected from the fixed frequency band-pass filters, the adaptive band-pass filter is adopted as the specified filter, the use frequency corresponding to the adaptive band-pass filter is obtained, the central frequency of the adaptive band-pass filter with different interference light signal frequencies in the target environment is selected as the target central frequency, the priority corresponding to the target central frequency and a second output voltage value list corresponding to the target central frequency are calculated, each second voltage output value in the second output voltage value list is compared with a preset voltage threshold, and therefore the target central frequency, with each voltage value smaller than the preset voltage threshold and with the highest priority, in the second output voltage value list is selected as the central frequency of the specified filter, interference of the interference light signal in the target environment on the specified filter is avoided, and the specified filter is the target central frequency with the largest frequency difference between the interference light signal frequency in the closest target environment in the target central frequency meeting the second preset voltage condition; according to the embodiment, the center frequency corresponding to the specified filter is determined according to the difference of the interference light signals in the target environment, so that the influence of the interference light signals in the target environment on the photoelectric sensor is minimum, the influence of the interference light signals in the target environment on the photoelectric sensor is minimum no matter where the target environment is arranged, and the working accuracy and efficiency of the photoelectric sensor are improved.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to fall within the scope of the invention.
The invention provides a system for resisting ambient light interference of a photoelectric sensor, which comprises: a memory storing a computer program, and an optical signal receiver, a first analog switch, a filter module, a second analog switch, a processor, and an optical signal transmitter connected in series in sequence, wherein the filter module comprises: all-pass filters and d fixed frequency band-pass filters, all connected simultaneously with the first module switch and the second analog switch, the d fixed frequency band-pass filters comprising at least: 10khz band pass filter, 60khz band pass filter.
Specifically, as shown in fig. 2, the system further includes: the current-voltage converter, the filter module further comprises: the adaptive band-pass filter is connected with the first module switch and the second analog switch; in the embodiment of the invention, an optical signal receiver, a current-to-voltage converter, a first analog switch, a filtering module, a second analog switch, a processor and an optical signal transmitter are sequentially connected in series.
Further, the first analog switch and the second analog switch are all multi-way switches; in a specific embodiment of the present invention, the first analog switch and the second analog switch each include d+2 sub-switches, where the first analog switch and the second analog switch are configured to select any one of an all-pass filter, an adaptive filter, and d fixed frequency band pass filters, and the sub-switches of the first analog switch and the sub-switches of the second analog switch are connected to the same filter, so that the filter connected to the sub-switch corresponding to the sub-switch of the first analog switch and the sub-switch corresponding to the second analog switch is in an operating state, and the filter unconnected to the sub-switch corresponding to the second analog switch is in a non-operating state.
In the embodiment of the invention, the optical signal transmitter is used for transmitting an optical signal with fixed frequency, the optical signal receiver is used for receiving the optical signal, and the current-voltage converter is used for converting the received current signal into a voltage signal.
In the embodiment of the invention, d is more than or equal to 2, preferably d=2, and it can be understood that two fixed-frequency band-pass filters are provided, one is a low-frequency band-pass filter, and can be applied when the high-frequency optical signal in the target environment is greater than the low-frequency optical signal in the target environment, and the other is a high-frequency band-pass filter, and can be applied when the low-frequency optical signal in the target environment is greater than the high-frequency optical signal in the target environment, so that the frequency of the optical signal in the target environment is considered, and as few band-pass filters as possible are provided, and resources are saved.
Further, the center frequencies of the fixed frequency band-pass filters are different from each other.
When the computer program is executed, as shown in fig. 1, it comprises the steps of:
s1, acquiring an interference optical signal information list X= { X in a target environment based on an all-pass filter 1 ,X 2 ,……,X i ,……,X m An ith interference optical signal information X i =(XF i ,XY i ,XP i ),XF i XY for the frequency of the ith interfering light signal in the target environment i XP is the voltage value of the ith interference optical signal in the target environment i Is XF i And the value of i in the corresponding frequency interval is 1 to m, and m is the number of interference optical signals in the target environment.
Specifically, when the all-pass filter is in operation, the filters in the filtering module other than the all-pass filter are in a non-operation state.
Further, the target environment is a place where the photoelectric sensor is located.
Further, the interference light signal in the target environment is all light signals in the target environment that can be received by the all-pass filter, for example, natural light, various artificial lights and light emitted by other photoelectric sensors in the target environment all belong to the interference light signal.
S2, based on X, acquiring a frequency difference set Q= { Q between the target band-pass filter and the frequency of the interference optical signal 1 ,Q 2 ,……,Q j ,……,Q n A list Q of frequency differences between the jth target bandpass filter and the frequency of the interfering optical signal j ={Q j1 ,Q j2 ,……,Q ji ,……,Q jm },Q ji For the center frequency and XF of the jth target band-pass filter i The absolute value of the difference value is 1 to n, n is the number of target band-pass filters, and n is less than or equal to d, wherein the target band-pass filters are fixed frequency band-pass filters which meet the preset frequency condition in the d fixed frequency band-pass filters.
S3, based on Q, acquiring a priority list Y= { Y corresponding to the target band-pass filter 1 ,Y 2 ,……,Y j ,……,Y n },Y j Is Q j Corresponding priority, Y j =min(Q j1 ,Q j2 ,……,Q ji ,……,Q jm )。
In the embodiment of the invention, the higher the priority corresponding to the target bandpass filter, the larger the frequency difference between the target bandpass filter and the frequency of the interference optical signal in the nearest target environment, namely Y j The selection of (2) is from maximum to minimum, i.e. the larger the value, the most preferred the corresponding fixed frequency band pass filter is.
S4, based on Y, acquiring a first output voltage value set V= { V corresponding to the target band-pass filter 1 ,V 2 ,……,V j ,……,V n A first output voltage value list V corresponding to the jth target band-pass filter j ={V j1 ,V j2 ,……,V ji ,……,V jm },V ji The voltage value corresponding to the ith interference optical signal output by the jth target band-pass filter is obtained; wherein V is ji Meets the following conditions:
wherein k is
ij Is XF
i Attenuation coefficient in the j-th target bandpass filter.
Specifically, the first output voltage value is in volts (V).
In an embodiment of the invention, k ij The method comprises the following steps of:
s41, acquiring XP i Corresponding frequency range [ XP i(min) ,XP i(max) ],XP i(min) Is XP i Corresponding minimum frequency value, XP i(max) Is XP i A corresponding maximum frequency value.
Specifically, XP i(max) -XP i(min) =P 0 ,P 0 For presetting the frequency difference, e.g.Such as 1khz.
Further, those skilled in the art can set P according to actual requirements 0 And will not be described in detail herein.
S42 based on XP i(min) XP i(max) Acquiring XF i Attenuation coefficient information P corresponding to amplitude-frequency diagram passing through jth target band-pass filter ij =(P1 ij ,P2 ij ),P1 ij Is XP i(min) Attenuation coefficient corresponding to the amplitude-frequency diagram of the jth target band-pass filter, P2 ij Is XP i(max) And the corresponding attenuation coefficient in the amplitude-frequency diagram of the jth target band-pass filter.
Specifically, as exemplified by the 10khz band-pass filter in fig. 3, the attenuation coefficient is obtained by the ordinate amplitude value in fig. 3, and in the embodiment of the present invention, P1 ij In the amplitude-frequency graph curve corresponding to the jth target band-pass filter, XP i(min) The ordinate value corresponding to the point in which the XP is located can be understood as XP i(min) Amplitude values corresponding to the points; p2 ij In the amplitude-frequency graph curve corresponding to the jth target band-pass filter, XP i(max) The ordinate value corresponding to the point in which the XP is located can be understood as XP i(max) Amplitude values corresponding to the points where the amplitude values are located.
In another embodiment of the present invention, a person skilled in the art can determine the conversion relationship between the amplitude value and the attenuation coefficient according to the requirement in practical implementation, which is not described herein.
S43 based on P ij Obtaining k ij Wherein k is ij Meets the following conditions:
k ij =max(P1 ij ,P2 ij )。
in the above, the minimum frequency value and the maximum frequency value corresponding to the interference optical signal in the target environment are obtained, and then the attenuation coefficient corresponding to the minimum frequency value corresponding to the interference optical signal in the target environment and the attenuation coefficient corresponding to the maximum frequency value corresponding to the interference optical signal in the target environment are obtained, so that the maximum attenuation coefficient corresponding to the interference optical signal in the target environment in the frequency range is selected, the first output voltage value is as large as possible, and the first output voltage value can be understood as the interference voltage value of the interference optical signal on the filter due to the fact that the attenuation coefficient affects the calculation of the first output voltage value, and therefore the influence on the filter caused by the fact that the first output voltage value is too small is avoided.
S5, based on V, obtaining V x The corresponding target band-pass filter is taken as a designated filter, the center frequency corresponding to the designated filter is taken as the frequency of the emitted light signal of the light signal emitter, V x E V and V x The target band-pass filter with the highest priority among the target band-pass filters meeting the first preset voltage condition is adopted; wherein the first preset voltage condition is that each voltage value in the corresponding first output voltage value list is smaller than a preset voltage threshold V 0 。
In the embodiment of the invention, according to the priority list, the first output voltage value list is judged in turn according to the order of the priority from big to small to obtain V x Thereby obtaining the target band-pass filter with the highest priority among the target band-pass filters meeting the first preset voltage condition.
Specifically, when the specified filter is acquired, the specified filter is selected to be in an operating state by controlling the first analog switch and the second analog switch, and the filter except the specified filter in the filter module is in a non-operating state.
Further, a voltage threshold V is preset 0 The unit of which is the same as the unit of the first output voltage value.
Further, the person skilled in the art can set V according to the actual requirement 0 The values of (2) are not described in detail herein.
According to the method, the fixed frequency band-pass filter which is different from the frequency of the interference light signal in the target environment is selected as the target band-pass filter, the priority corresponding to the target band-pass filter and the first output voltage value list corresponding to the target band-pass filter are calculated, each first voltage output value in the first output voltage value list is compared with the preset voltage threshold value, so that the target band-pass filter with the highest priority and each voltage value in the first output voltage value list is selected, the interference of the interference light signal in the target environment to the specified filter is avoided, and the target band-pass filter with the highest priority is selected, so that the influence of the interference light signal in the target environment to the specified filter is the smallest, and no matter where the target environment is arranged, the influence of the interference light signal in the target environment to the specified filter is the smallest, and the working accuracy and efficiency of the photoelectric sensor are improved.
In the embodiment of the present invention, the step S5 further includes:
s51, when each first output voltage value list in V does not accord with the preset voltage condition, the adaptive band-pass filter is used as a designated filter.
S52, obtaining the frequency FE of the adaptive band-pass filter according to a preset rule.
In an embodiment of the present invention, the system further includes: center frequency list Z corresponding to the adaptive band-pass filter and amplitude-frequency diagram corresponding to Z, wherein Z= { Z 1 ,Z 2 ,……,Z y ,……,Z g },Z y The value of y is 1 to g, and g is the number of the center frequencies corresponding to the adaptive band-pass filter;
specifically, the adaptive bandpass filter is composed of a bandpass filter and a digital potentiometer.
In an embodiment of the present invention, the system further includes: and a frequency table corresponding to the resistance value corresponding to the digital potentiometer.
Specifically, the resistance value corresponding to the digital point marker is adjusted by inquiring the frequency table corresponding to the resistance value corresponding to the digital potentiometer, so as to obtain the center frequency corresponding to the adaptive filter.
Further, Z y The method comprises the following steps of:
s501, acquiring an adjustable frequency interval [0-Z ] corresponding to the adaptive band-pass filter max ]Wherein Z is max The maximum adjustable frequency corresponding to the adaptive band-pass filter;
S502、based on Z max Obtaining Z y ,Z y Meets the following conditions:
Z y =Z max /g*y。
specifically, Z max =100khz。
Further, the step S52 includes the following steps:
s521, based on X, obtaining a frequency difference set H= { H between the target center frequency corresponding to the adaptive band-pass filter and the frequency of the interference optical signal 1 ,H 2 ,……,H q ,……,H Q A list H of frequency differences between the q-th target center frequency and the frequency of the interfering optical signal q ={H q1 ,H q2 ,……,H qi ,……,H qm },H qi For the q-th target center frequency and XF i The absolute value of the difference value between the two is 1 to Q, Q is the number of target center frequencies, and the target center frequencies are center frequencies in Z which are different from the frequencies of each interference optical signal in the target environment.
S522, based on H, acquiring a priority list L= { L of the target center frequency 1 ,L 2 ,……,L q ,……,L Q },L q Priority corresponding to the q-th target center frequency, where L q =min(H q1 ,H q2 ,……,H qi ,……,H qm )。
In the embodiment of the invention, the higher the priority corresponding to the target center frequency, the greater the frequency difference between the target center frequency and the frequency of the interference optical signal in the nearest target environment, L q The selection of (2) is from maximum to minimum, i.e. the larger the value, the most preferred the corresponding target center frequency is.
S523, based on L, acquiring a second output voltage value set W= { W corresponding to the target center frequency 1 ,W 2 ,……,W q ,……,W Q A second output voltage value list W corresponding to the q-th target center frequency q ={W q1 ,W q2 ,……,W qi ,……,W qm },W qi The voltage value corresponding to the ith interference optical signal is output when the center frequency of the adaptive filter is the (q) th target center frequency, wherein W qi Meets the following conditions:
wherein k is
qi Is XF
i Attenuation coefficient in the q-th target center frequency amplitude-frequency plot.
Specifically, the unit of the second output voltage value is the same as the unit of the first output voltage value.
In an embodiment of the invention, k qi The method comprises the following steps of:
s530, acquiring XP i Corresponding frequency range [ XP i(min) ,XP i(max) ],XP i(min) Is XP i Corresponding minimum frequency value, XP i(max) Is XP i A corresponding maximum frequency value.
S531 XP-based i(min) XP i(max) Acquiring XF i Attenuation coefficient information P corresponding to the amplitude-frequency pattern of the q-th target center frequency iq =(P3 iq ,P4 iq ),P3 iq Is XP i(min) Corresponding attenuation coefficient in the amplitude-frequency diagram of the q-th target center frequency, P4 iq Is XP i(max) The corresponding attenuation coefficient in the amplitude-frequency diagram of the q-th target center frequency.
Specifically, as exemplified by the 10khz band pass filter in FIG. 3, P3 iq In the graph corresponding to the q-th target center frequency, XP i(min) The ordinate value corresponding to the point in which the XP is located can be understood as XP i(min) Amplitude values corresponding to the points; p4 iq In the graph corresponding to the q-th target center frequency, XP i(max) The ordinate value corresponding to the point in which the XP is located can be understood as XP i(max) Amplitude values corresponding to the points where the amplitude values are located.
S532 based on P iq Obtaining k iq Wherein k is iq Meets the following conditions:
k iq =max(P3 iq ,P4 iq )。
specifically, as exemplified by the 10khz band-pass filter in fig. 3, the attenuation coefficient is obtained by the ordinate amplitude value in fig. 3, and in the embodiment of the present invention, P3 iq In the graph corresponding to the q-th target center frequency, XP i(min) The ordinate value corresponding to the point in which the XP is located can be understood as XP i(min) Amplitude values corresponding to the points; p4 iq In the graph corresponding to the q-th target center frequency, XP i(max) The ordinate value corresponding to the point in which the XP is located can be understood as XP i(max) Amplitude values corresponding to the points where the amplitude values are located.
In another embodiment of the present invention, a person skilled in the art can determine the conversion relationship between the amplitude value and the attenuation coefficient according to the requirement in practical implementation, which is not described herein.
S523, based on W, obtain W t Corresponding target center frequency FE, W t E W and W t The target center frequency with the highest priority among the target center frequencies meeting the second preset voltage condition is selected; wherein the second preset voltage condition is that each voltage value in the corresponding second voltage output value list is smaller than V 0 。
In the embodiment of the invention, the second output voltage value list is sequentially judged according to the priority list from the higher priority to the lower priority to acquire W t Thereby obtaining the target center frequency with the highest priority among the target center frequencies in the target center frequencies meeting the second preset voltage condition.
And S53, taking FE as the designated optical signal frequency of the optical signal transmitter.
According to the method, the center frequency of the adaptive band-pass filter with different interference light signal frequencies in the target environment is selected as the target center frequency, and then the priority corresponding to the target center frequency and the second output voltage value list corresponding to the target center frequency are calculated, each second voltage output value in the second output voltage value list is compared with the preset voltage threshold value, so that the target center frequency with the highest priority and each voltage value in the second output voltage value list is selected, when the specified filter is not selected in the fixed frequency band-pass filter, the adaptive band-pass filter is adopted as the specified filter, the use frequency corresponding to the adaptive band-pass filter is obtained, and the target center frequency with the highest priority is selected while the interference of the interference light signal in the target environment on the specified filter is avoided.
While certain specific embodiments of the invention have been described in detail by way of example, it will be appreciated by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the invention. Those skilled in the art will also appreciate that many modifications may be made to the embodiments without departing from the scope and spirit of the invention. The scope of the invention is defined by the appended claims.