Method and electronic device for proximity detection
By acquiring the integral value of the infrared light detector signal strength within the proximity detection period and comparing the deviation, it is determined whether the proximity light sensor is interfered with by a flickering light source. This solves the problem of proximity light sensor being susceptible to interference and achieves more accurate proximity detection.
Patent Information
- Application Number
- CN202210188731.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-28
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2042-02-28
AI Technical Summary
Proximity light sensors are easily affected by flickering light sources in the environment, resulting in low detection accuracy, misjudgments, and a negative impact on user experience.
By acquiring the integrated value of the infrared detector signal intensity within the proximity detection period and comparing the deviation of the integrated value at different time periods, it is determined whether there is interference from the flickering light source, thereby determining the accuracy of the proximity detection data and avoiding the output of data subject to interference.
The anti-interference capability of the proximity light sensor has been improved, ensuring the accuracy of proximity detection data, avoiding misjudgments, and enhancing the user experience.
Smart Images

Figure CN116699716B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of proximity detection technology, and more particularly to a proximity detection method and electronic device. Background Technology
[0002] Most electronic devices are now equipped with proximity sensors (PS) to detect whether an object is approaching from a specific direction. For example, a proximity sensor installed under the screen of a mobile phone can detect whether an object is approaching the screen.
[0003] Proximity sensors can be categorized into infrared reflective, capacitive, and ultrasonic ranging types, with infrared reflective sensors being the most common. Infrared reflective proximity sensors, also known as proximity optical sensors, work by emitting infrared light from an infrared light source, such as an infrared LED or a vertical-cavity surface-emitting laser (VCSEL), while an infrared photodetector receives the reflected infrared light. The intensity of the reflected infrared light determines whether an object is approaching. Proximity optical sensors typically use an emitting light source with a wavelength primarily of 940nm, although sources with wavelengths around 1000nm or longer can also be used.
[0004] In practical applications, the detection results of proximity light sensors are easily affected by ambient light sources, especially flickering light sources in the environment, resulting in low accuracy. Summary of the Invention
[0005] This application provides a proximity detection method and electronic device to improve the anti-interference capability of proximity optical sensors.
[0006] To achieve the above objectives, this application provides the following technical solution:
[0007] The first aspect of this application provides a proximity detection method applied to an electronic device, comprising:
[0008] The integral value of the infrared detector signal strength is obtained in a second time period close to the detection period, and in a third time period close to the detection period. The second time period is before the third time period, and the switching state of the infrared light source is different in the second time period and the third time period.
[0009] For example, the infrared light source is turned on during the second time period and turned off during the third time period;
[0010] If it is determined from the deviation data that the proximity detection period is not interfered with by the flickering light source, the proximity detection data determined from the integral value in the second time period and the integral value in the third time period is output. The deviation data includes the deviation between the integral value obtained in the proximity detection period and the integral value of the infrared light detector signal strength outside the proximity detection period, and / or the deviation between the integral values obtained in the proximity detection period.
[0011] If the proximity detection cycle is determined to be interfered with by a flickering light source based on the deviation data, the proximity detection data is determined to be abnormal data.
[0012] The beneficial effects of this embodiment are as follows:
[0013] Before outputting proximity detection data, the proximity sensor uses deviation data to determine whether the corresponding proximity detection cycle is interfered with, thus improving the proximity sensor's anti-interference capability.
[0014] In some optional embodiments, the integral value obtained outside the proximity detection period includes the integral value of the infrared light detector signal strength during a first time period prior to the proximity detection period, wherein the switching state of the infrared light source is the same during the first time period and the third time period.
[0015] In some optional embodiments, the deviation data includes the absolute value of the difference between the integral value in the first time period and the integral value in the third time period.
[0016] In some optional embodiments, the step of determining, based on deviation data, that the proximity detection period was not interfered with by the flickering light source includes:
[0017] If the deviation data is not greater than the preset first abnormal threshold, it is determined that the proximity detection cycle is not interfered with by the flickering light source;
[0018] If it is determined from the deviation data that the proximity detection cycle is interfered with by the flickering light source, the following steps are taken:
[0019] The step of determining whether the proximity detection cycle is interfered with by the flickering light source based on the deviation data includes:
[0020] If the deviation data is greater than the first abnormal threshold, it is determined that the proximity detection cycle is interfered with by the flickering light source.
[0021] For detailed implementation of the above embodiments, please refer to Embodiment 1. Figure 5a The process is shown below.
[0022] This embodiment has the following beneficial effects:
[0023] Before performing proximity detection, the proximity sensor obtains the first integral value when the infrared light source is off. By comparing the first integral value with the integral value during the proximity detection process, it determines whether the proximity detection cycle is interfered with by the flickering light source or not. This avoids the proximity sensor outputting proximity detection data obtained during the proximity detection cycle that is interfered with by the flickering light source, thus improving the proximity sensor's anti-interference capability.
[0024] In some optional embodiments, the integral value obtained outside the proximity detection period includes the integral value of the infrared light detector signal strength in a fourth time period after the proximity detection period, wherein the switching state of the infrared light source is the same in the fourth time period and the third time period.
[0025] In some optional embodiments, the deviation data includes the absolute value of the difference between the integral value in the third time period and the integral value in the fourth time period.
[0026] In some optional embodiments, the step of determining, based on deviation data, that the proximity detection period was not interfered with by the flickering light source includes:
[0027] If the deviation data is not greater than the preset second abnormal threshold, it is determined that the proximity detection cycle is not interfered with by the flickering light source;
[0028] If it is determined from the deviation data that the proximity detection cycle is interfered with by the flickering light source, the following steps are taken:
[0029] If the deviation data is greater than the second abnormal threshold, it is determined that the proximity detection cycle is interfered with by the flickering light source.
[0030] In some optional embodiments, the proximity detection data is the difference between the integral value in the second time period and the integral value in the third time period.
[0031] For detailed implementation of the above embodiments, please refer to Embodiment 2. Figure 8 The process is shown below.
[0032] The beneficial effects of this embodiment are as follows:
[0033] After completing a proximity detection, the proximity sensor obtains the fourth integral value when the infrared light source is off. By comparing the fourth integral value with the integral value during the proximity detection process, it can determine whether the proximity detection cycle is interfered with by the flickering light source. This avoids the proximity sensor outputting proximity detection data obtained during the proximity detection cycle that is interfered with by the flickering light source, thus improving the proximity sensor's anti-interference capability.
[0034] In some optional embodiments, the integral value in the second time period includes multiple segmented integral values obtained by integrating multiple times in the second time period, and the integral value in the third time period includes multiple segmented integral values obtained by integrating multiple times in the third time period.
[0035] In some optional embodiments, the deviation data includes: the standard deviation of multiple segmented integral values for the second time period and the standard deviation of multiple segmented integral values for the third time period.
[0036] In some optional embodiments, the step of determining, based on deviation data, that the proximity detection period was not interfered with by the flickering light source includes:
[0037] If the standard deviation of multiple segmented integral values in the second time period and the standard deviation of multiple segmented integral values in the third time period are both not greater than the preset third anomaly threshold, it is determined that the proximity detection cycle is not interfered with by the flickering light source.
[0038] If it is determined from the deviation data that the proximity detection cycle is interfered with by the flickering light source, the following steps are taken:
[0039] If the standard deviation of multiple segmented integral values in the second time period is greater than the third anomaly threshold, or if the standard deviation of multiple segmented integral values in the third time period is greater than the third anomaly threshold, it is determined that the proximity detection cycle is interfered with by a flickering light source.
[0040] For detailed implementation of the above embodiments, please refer to Embodiment 3. Figure 10 The process is shown below.
[0041] The beneficial effects of this embodiment are as follows:
[0042] In this embodiment, the proximity light sensor determines whether the proximity detection period is affected by or not by a flickering light source based on the integral value obtained during the proximity detection period, thereby improving the timeliness of the judgment result and avoiding inconsistencies between the judgment result and the actual situation during the proximity detection process.
[0043] In some optional embodiments, the proximity detection data is the difference between a first cumulative value and a second cumulative value, wherein the first cumulative value is the sum of multiple segmented integral values within the second time period, and the second cumulative value is the sum of multiple segmented integral values within the third time period.
[0044] In some optional embodiments, after determining that the proximity detection data is anomalous, the method further includes:
[0045] Delete the proximity detection data.
[0046] The beneficial effect of this embodiment is that timely deletion of abnormal proximity detection data can prevent abnormal proximity detection data from being falsely reported to the upper-layer system, and prevent the upper-layer system from performing abnormal operations based on abnormal proximity detection data, such as preventing the screen from turning off when the user is looking at the screen normally.
[0047] In some optional embodiments, a preset delay time is set between the second time period and the third time period.
[0048] The beneficial effect of this embodiment is that, due to the influence of the performance of the devices in the circuit, if the proximity light sensor performs multiple integrations continuously, the accuracy of the integration result may be affected. By delaying for a period of time before each integration, the accuracy of the integration result can be improved.
[0049] A second aspect of this application provides an electronic device, including a proximity light sensor;
[0050] The proximity sensor is used to execute preset computer instructions, specifically to implement the proximity detection method provided in any of the first aspects of this application. In this solution, before outputting proximity detection data, the proximity sensor uses deviation data to determine whether the corresponding proximity detection cycle is interfered with, thereby improving the anti-interference capability of the proximity sensor. Attached Figure Description
[0051] Figure 1 A schematic diagram illustrating the working principle of a proximity light sensor in the absence of interference, provided for an embodiment of this application;
[0052] Figure 2a A schematic diagram illustrating a usage scenario of an electronic device with a flickering light source, provided as an embodiment of this application;
[0053] Figure 2b A schematic diagram illustrating another use scenario of an electronic device with a flickering light source, provided in an embodiment of this application;
[0054] Figure 2c A schematic diagram illustrating the interference of a flickering light source on a proximity sensor, provided in an embodiment of this application.
[0055] Figure 2d A schematic diagram illustrating the interference of another flickering light source on a proximity sensor, provided in an embodiment of this application.
[0056] Figure 3a This is a schematic diagram of the structure of a proximity light sensor provided in an embodiment of this application;
[0057] Figure 3b This is a schematic diagram of another proximity light sensor provided in an embodiment of this application;
[0058] Figure 4A schematic diagram illustrating the electrical signal intensity generated by an infrared photodetector when there is a flickering light source, provided as an embodiment of this application;
[0059] Figure 5a A flowchart of a proximity detection method provided in an embodiment of this application;
[0060] Figure 5b A schematic diagram of the register state of a proximity light sensor provided in an embodiment of this application;
[0061] Figure 6 A schematic diagram illustrating the electrical signal intensity generated by an infrared photodetector when there is a flickering light source, as provided in an embodiment of this application;
[0062] Figure 7 A schematic diagram illustrating the electrical signal intensity generated by an infrared photodetector when there is a flickering light source, as provided in another embodiment of this application;
[0063] Figure 8 A flowchart of another proximity detection method provided in the embodiments of this application;
[0064] Figure 9 A schematic diagram illustrating the electrical signal intensity generated by an infrared photodetector when there is a flickering light source, as provided in an embodiment of this application;
[0065] Figure 10 A flowchart illustrating yet another proximity detection method provided in this application embodiment;
[0066] Figure 11 This application also provides a schematic diagram of the electrical signal intensity generated by an infrared photodetector when there is a flashing light source. Detailed Implementation
[0067] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. The terminology used in the following embodiments is for the purpose of describing specific embodiments only and is not intended to be a limitation of this application. As used in the specification and appended claims of this application, the singular expressions "a," "an," "the," "the," "the," and "this" are intended to also include expressions such as "one or more," unless the context clearly indicates otherwise. It should also be understood that in the embodiments of this application, "one or more" refers to one, two, or more; "and / or" describes the relationship between related objects, indicating that three relationships may exist; for example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship.
[0068] A proximity sensor is a widely used sensor in various electronic devices such as mobile phones and tablets. By emitting infrared light and detecting the intensity of the reflected infrared light, a proximity sensor can obtain proximity detection data reflecting the distance between an object and the electronic device. Applications in electronic devices can then use this proximity detection data to determine if an object is approaching the device.
[0069] To better understand the embodiments of this application, the working principle of the proximity light sensor will be explained below in conjunction with a typical application scenario of a proximity light sensor in a mobile phone, namely a mobile phone voice call scenario.
[0070] A proximity sensor may include an infrared light source and an infrared light detector. The infrared light source may be a light-emitting diode (LED) that emits infrared light, or an infrared vertical-cavity surface-emitting laser (VCSEL). The operating wavelength of the infrared light source may be around 940nm, or closer to 1100nm, 1300nm, or other wavelengths. This embodiment does not limit the infrared light source used in the proximity sensor or its operating wavelength, as long as the proximity or distance of an external object is determined optically.
[0071] An infrared light detector can be a photodiode (PD) that can detect infrared light. When a photodiode is illuminated, it generates an electrical signal. The intensity of the electrical signal is proportional to the intensity of the light. In other words, the intensity of the electrical signal output by the photodiode can reflect the intensity of the light illuminating the photodiode.
[0072] Proximity sensors can have various structures and forms, and this embodiment does not limit the specific structure and form of the proximity sensor. For example, the infrared light source and infrared photodetector mentioned above can be integrated into the proximity sensor, or they can be combined into a proximity sensor based on discrete structures.
[0073] As an example, an independent infrared light source can be attached to an infrared light detector. The infrared light detector and the attached infrared light source work together to detect whether an object is moving away or approaching. Therefore, it can also be regarded as a proximity light sensor.
[0074] Please see Figure 1This is a schematic diagram illustrating the working principle of a proximity light sensor in the absence of interference, provided in an embodiment of this application. When a user makes or receives a call, they may bring the phone close to their face for voice communication. The phone can use the proximity light sensor to detect whether the user is bringing the phone close to their face. When the phone is close to the face, the screen is turned off, and when the phone is not close to the face, the screen is turned on. In this way, the screen-on time is shortened, reducing the phone's power consumption.
[0075] like Figure 1 As shown in (1), when a user looks at the phone screen, their face is relatively far from the screen. At this time, an infrared light source located under the glass cover of the phone screen, close to the light sensor, turns on and off at a specific frequency, thereby periodically emitting infrared light. For example, the infrared light source turns on and emits infrared light during the time interval T0 to T1, and turns off during the time interval T1 to T2. The duration of T0 to T1 is equal to the duration of T1 to T2.
[0076] When the infrared light source is on, the proximity sensor calculates the integral of the intensity of the infrared light detector's electrical signal over time during this period, for example, the integral from T0 to T1, and records the result as integral value 1. When the infrared light source is off, the proximity sensor calculates the integral of the intensity of the infrared light detector's electrical signal over time during this period, for example, the integral from T1 to T2, and records the result as integral value 2. The difference between integral value 1 and integral value 2 (or the absolute value of the difference) can be used as a proximity detection data obtained by the proximity sensor. The process of controlling the infrared light source to turn on and off and calculating a proximity detection data can be regarded as a proximity detection process of the proximity sensor. In this embodiment, the actions performed by the proximity sensor during the period from T0 to T2 can be regarded as a proximity detection process.
[0077] In this application, such as Figure 1 The time interval from T0 to T2 shown in (1) can be defined as the proximity detection cycle required for the proximity sensor to perform proximity detection. That is, the proximity sensor can complete one proximity detection and obtain one proximity detection data within one proximity detection cycle. The duration K of the proximity detection cycle is related to the performance of the proximity sensor and can generally be hundreds of microseconds (µs). Of course, it can also be other orders of magnitude. In this embodiment, the specific value of K is not limited.
[0078] During the time interval T0 to T2, the user's face is far from the phone screen, resulting in a very low intensity of infrared light reflected to the infrared detector. The intensity of the electrical signal generated by the infrared detector during the time interval T0 to T1 is also very low, close to the intensity of the detector's electrical signal when the infrared light source is turned off during the time interval T1 to T2. Therefore, the difference between integral value 1 and integral value 2 is less than the set proximity threshold. Based on this comparison result, the phone determines that no object is close to the screen, turns on the screen, and allows the user to view the content on the screen and operate the phone normally.
[0079] The proximity threshold can be understood as the proximity detection data obtained by the proximity sensor when an object approaches a specific distance from the screen under undisturbed conditions. Based on this, if the proximity detection data obtained by the proximity sensor is greater than or equal to the proximity threshold, the distance between the screen and the object can be considered to be less than or equal to the aforementioned specific distance; if the proximity detection data is less than the proximity threshold, the distance between the screen and the object can be considered to be greater than the aforementioned specific distance.
[0080] For example, the proximity detection data obtained by the proximity sensor when the distance between the object and the screen is 3 mm can be used as the proximity threshold. During proximity detection, if the proximity detection data is greater than or equal to the proximity threshold, the distance between the screen and the object can be considered to be less than or equal to 3 mm; if the proximity detection data is less than the proximity threshold, the distance between the screen and the object can be considered to be greater than 3 mm.
[0081] like Figure 1 As shown in (2), when a user's mobile phone receives a call from another mobile phone, the user holds the phone close to their face to make a voice call. During the call, the infrared light source can also periodically emit infrared light. For example, the infrared light source turns on and emits infrared light during the time period T3 to T4, and turns off during the time period T4 to T5. The duration of T3 to T4 is equal to the duration of T4 to T5.
[0082] Similarly, the proximity sensor calculates the integral of the detector's electrical signal intensity over time when the infrared light source is on, and the result is recorded as integral value 3. It also calculates the integral of the detector's electrical signal intensity over time when the infrared light source is off, and the result is recorded as integral value 4. The difference between integral value 3 and integral value 4 (or the absolute value of the difference) can be used as another proximity detection data obtained by the proximity sensor.
[0083] During the period from T3 to T5, the user holds the phone close to their face. During the period from T3 to T4, when the infrared light source is on, the intensity of the infrared light reflected to the infrared photodetector is very high, and the infrared photodetector generates a high-intensity electrical signal accordingly. However, during the period from T4 to T5, when the infrared light source is off, the infrared photodetector does not receive the reflected infrared light, so the intensity of the detector's electrical signal is very low. Therefore, the difference between the integral value 3 when the infrared light source is on and the integral value 4 when the infrared light source is off is greater than the proximity threshold. Based on this comparison result, the phone determines that the user's face is close to the screen and then turns off the screen.
[0084] In practical applications, the differences between integral values 1 and 2, and between integral values 3 and 4, can be represented in the form of digital or analog signals.
[0085] As an example, after the integrator outputs integral values 3 and 4 (or integral values 1 and 2) in the form of analog signals, the analog-to-digital converter converts integral values 3 and 4 (or integral values 1 and 2) into digital signals, and then subtracts the two to obtain the difference in digital signal form.
[0086] As another example, the difference between the integral values 3 and 4 (or 1 and 2) in the form of the analog signal output by the integrator circuit can also be obtained by directly subtracting the integral values 3 and 4 (or 1 and 2) in the form of the analog signal. The analog signal can be a voltage signal or a current signal.
[0087] Figure 1 The scenario shown is just one application of proximity sensors. In other scenarios, proximity sensors can also detect the approach or departure of objects other than faces. For example, in an anti-accidental touch scenario, a proximity sensor can detect whether the screen is close to clothing fabric, thus determining whether the phone is being held or placed in a pocket; when the phone is placed indoors, a proximity sensor can detect whether the tabletop is close to the screen, thus determining whether the phone is placed face up or face down on the table (or other object surface).
[0088] It should be noted that the above scenario is an example of the application of proximity sensors. In other application scenarios, electronic devices can also perform other specific operations based on whether an object is approaching the screen. For example, the touch screen can be locked to prevent accidental triggering, or the screen backlight can be turned off when an object is approaching. This is not limited to turning off the screen as in the example above.
[0089] In summary, the proximity sensor can control the periodic on and off of its infrared light source, calculate the integral of the detector's electrical signal intensity over time when the infrared light source is on, and the integral of the detector's electrical signal intensity over time when the infrared light source is off. The difference between the integral values when the light source is on and when it is off is output as proximity detection data. The upper-level system (such as the processor of an electronic device or the sensor control module, i.e., sensorhub) can determine whether an object is approaching by checking whether the proximity detection data is greater than a set proximity threshold.
[0090] Proximity sensors are susceptible to interference from various light sources in their environment, especially flickering light sources. When a proximity sensor is affected by flickering light, the output proximity detection data cannot accurately reflect the approach of an object, leading to misjudgments by electronic devices, abnormal phenomena, and a poor user experience.
[0091] Taking mobile phones as an example, in many everyday usage scenarios, the proximity sensor of a mobile phone can be interfered with by flickering light sources in the environment.
[0092] As an example, see Figure 2a This is a schematic diagram of a usage scenario with a flickering light source. When a user moves around in the shade of a tree during the day and looks at their phone screen, sunlight generally contains light waves with the same wavelength as infrared light sources. For example, the wavelength of infrared light sources is around 940nm, and sunlight also contains light waves around 940nm. Therefore, light waves near 940nm in sunlight can be detected by proximity sensors.
[0093] Sunlight itself has a low frequency of intensity change, meaning that the intensity does not change rapidly over time. However, when a user moves quickly under the shade of a tree or when the light and dark areas under the shade are very close, the sunlight shining on the phone may flicker at a frequency close to the aforementioned proximity detection cycle. Therefore, the alternation of light and dark areas can be regarded as a flickering light source. When the phone is in the shade, it can be regarded as a flickering light source that does not emit light. When the phone is in the light spot, it can be regarded as a flickering light source that emits light.
[0094] As another example, see Figure 2b This diagram illustrates another scenario where a flickering light source exists. Indoor lighting fixtures often flicker at a certain frequency. The causes of this flickering can include the actual switching frequency of the fixture's driver, voltage or current fluctuations in the power supply due to various factors, the fixture's own luminous characteristics, or the inherent frequency of the AC power supply driving the fixture. For example... Figure 2bAs shown, when a user views a mobile phone screen indoors, indoor lighting fixtures exhibiting the aforementioned flickering characteristics can be considered a flickering light source. The frequency of such flickering light sources may be tens of Hz, tens of kHz, or even higher.
[0095] It should be noted that the flickering described in this application can refer to the alternation between two states of light and dark, or the alternation between a high-brightness state and one or more low-brightness states.
[0096] For example, interference from flickering light sources may cause the following abnormal phenomena in mobile phones:
[0097] When a user views their phone screen in an environment with flickering light, the proximity sensor may generate incorrect proximity detection data due to interference from the flickering light. The upper-level system may then misjudge that the user has brought the screen close to their face based on this incorrect proximity detection data, and thus turn off the screen, making it impossible for the user to view it. Alternatively, the proximity sensor may be interfered with and intermittently generate incorrect proximity detection data, causing the upper-level system to intermittently misjudge that the user has brought the screen close to their face, resulting in the phone screen intermittently turning on and off, exhibiting a random flickering state.
[0098] In particular, since most electronic devices now widely use full-screen and punch-hole screen structures to increase screen ratio, proximity sensors have to be installed under the glass cover of the screen. In order to overcome the attenuation of the transmitted infrared light by the glass cover and OLED screen, electronic device manufacturers need to significantly improve the gain and sensitivity of the infrared light detector of the proximity sensor. This makes the proximity sensor more susceptible to interference from flickering light sources in the environment.
[0099] The following example illustrates how a flickering light source can interfere with the detection results of a proximity sensor. Please refer to [link / reference]. Figure 2c This is a schematic diagram illustrating the interference of a flickering light source on a proximity sensor provided in an embodiment of this application.
[0100] In this example, the screen of the electronic device is not near any other objects. Specifically, the use case of the electronic device in this example could be... Figure 1 The scenario shown in (1) is the scenario where the user holds the mobile phone and looks at the mobile phone screen.
[0101] Figure 2c(1) represents the intensity of infrared light emitted from the infrared light source of the proximity sensor and reflected by the object to the infrared light detector. It can be seen that the infrared light source is turned off during the time period from T1 to T2. Therefore, it can be assumed that no infrared light is emitted from the infrared light source and reflected to the infrared light detector. The intensity of the reflected infrared light can be regarded as 0. During the time period from T0 to T1, the infrared light source is turned on and emits infrared light. However, since the object is far away from the proximity sensor, the intensity of the infrared light that reaches the infrared light detector after being reflected by the object is also very low, close to the intensity of the infrared light reflected when the infrared light source is turned off.
[0102] Figure 2c (2) represents the light intensity of the scintillation light source received by the infrared light detector. The scintillation light source starts emitting light before time T0, and after time T1, the scintillation light source dims rapidly and remains dim until after time T2. Combining the aforementioned scenario of moving under the shade of a tree, the time period during which the scintillation light source emits light can be considered as the time period during which the user's mobile phone is within the light spot, and the time period during which the scintillation light source dims can be considered as the time period during which the user's mobile phone is within the shadow area.
[0103] Because infrared light detectors have high sensitivity and gain, both infrared light reflected from objects and visible light emitted from flashing light sources will cause the infrared light detector to generate electrical signals. In other words, when there is a flashing light source, the intensity of the electrical signal generated by the infrared light detector depends on the sum of the intensity of the visible light illuminating the infrared light detector from the flashing light source and the intensity of the infrared light reflected from the object.
[0104] Therefore, please see Figure 2c (3) During the T0 to T1 period, the intensity of infrared light reflected from distant objects is very weak, but the flashing light source is bright at this time. The intensity of visible light illuminating the infrared detector by the flashing light source is relatively high. Therefore, the intensity of the detector's electrical signal is relatively high during the T0 to T1 period, and the integral value 1 obtained by integrating the intensity of the detector's electrical signal during this period is relatively large.
[0105] During the time interval T1 to T2, the intensity of infrared light reflected from the object is weak, and the scintillation light source is relatively dim for most of the time. Therefore, the intensity of the detector's electrical signal is weak for most of the time during this period, and the integral value 2 obtained by integrating the intensity of the detector's electrical signal during this period is relatively small.
[0106] In summary, if the ambient light source changes from bright to dark during a proximity detection by the proximity sensor, even if no object is approaching the screen, the proximity detection data output by the proximity sensor (i.e., the difference between integral value 1 and integral value 2) will still be large. This may cause the upper-level system to mistakenly determine that an object is approaching the screen and turn off the screen of the electronic device (or perform other operations when an object is approaching).
[0107] Please see Figure 2d This is a schematic diagram illustrating the interference of another flickering light source on a proximity light sensor, as provided in an embodiment of this application.
[0108] Figure 2d (1) represents the intensity of infrared light emitted from the infrared light source of the proximity sensor and reflected by the object to the infrared light detector. It can be seen that the infrared light source is turned off during the time period from T1 to T2. Therefore, it can be assumed that no infrared light is emitted from the infrared light source and reflected to the infrared light detector. The intensity of the reflected infrared light can be regarded as 0. During the time period from T0 to T1, the infrared light source is turned on and emits infrared light. However, since the object is far away from the proximity sensor, the intensity of the infrared light that reaches the infrared light detector after being reflected by the object is also very low, close to the intensity of the infrared light reflected when the infrared light source is turned off.
[0109] Figure 2d (2) represents the light intensity of the scintillation light source received by the infrared light detector. Figure 2d In the scenario, the flickering light source is initially dark, then brightens after time T1 and remains bright until after time T2. Considering the aforementioned scene of moving under the shade of a tree, the period during which the flickering light source is illuminated can be considered the period during which the user's phone is within the light spot, and the period during which the flickering light source dims can be considered the period during which the user's phone is within the shadow area.
[0110] Received Figure 2d As shown in (2), due to the interference of the flickering light source, the integral value 2 obtained when the infrared light source is off is actually greater than the integral value 1 obtained when the infrared light source is on. Therefore, the proximity detection data output by the proximity sensor (i.e., the difference between integral value 1 and integral value 2) is less than 0, and naturally also less than the aforementioned proximity threshold. The electronic device determines that the object is moving away from the display screen based on the proximity detection data, and then lights up the display screen.
[0111] Combination Figure 2c and Figure 2d It can be seen that when a user views the content of an electronic device's display screen in an environment with flickering light sources, the proximity detection data output by the proximity sensor may fluctuate repeatedly between being greater than and less than the proximity threshold due to interference from the flickering light source. Consequently, the electronic device will exhibit screen flickering (i.e., the display screen turns off and on intermittently), resulting in a poor user experience.
[0112] To reduce the interference of flickering light sources in the environment on proximity sensors, embodiments of this application provide a proximity detection method and a corresponding proximity sensor.
[0113] Please see Figure 3a This is a schematic diagram of the proximity light sensor provided in an embodiment of this application.
[0114] A proximity light sensor includes an infrared light source, an infrared photodetector, a drive circuit, a signal front-end (SFE), an analog-to-digital converter (ADC), and a controller. The infrared light source is connected to the drive circuit, the infrared photodetector is connected to the signal front-end, the signal front-end is connected to the ADC, and the signal front-end, drive circuit, and ADC are all connected to and controlled by the controller.
[0115] As mentioned earlier, proximity sensors can also use external infrared light sources. Please see [link to relevant documentation]. Figure 3b This is a schematic diagram of another proximity light sensor provided in an embodiment of this application.
[0116] exist Figure 3b The proximity sensor shown includes an infrared photodetector, SFE, ADC, and controller internally, and an infrared light source and driving circuit externally. The anode of the infrared light source can be connected to the driving circuit, while the cathode is connected to the controller via a signal line. The controller controls the infrared light source to turn on and off by controlling the cathode to conduct or deconduct.
[0117] The infrared light source receives a driving voltage from the driving circuit and emits infrared light under the influence of that voltage. The driving voltage output by the driving circuit is controlled by the controller. Figure 2c For example, the controller can control the drive circuit to output a high voltage during the T0 to T1 period, such as a 5V drive voltage, thereby driving the infrared light source to emit light during the T0 to T1 period. Then, the controller can control the drive circuit to output a low voltage during the T1 to T2 period, such as a 0V voltage, so that the infrared light source does not emit light during the T1 to T2 period.
[0118] In other embodiments, the controller can also control the infrared light source to turn on or off by controlling the current to the cathode of the infrared light source. This embodiment does not limit the specific control method.
[0119] Infrared light emitted by an infrared source reaches an infrared photodetector after being emitted by an object. The infrared photodetector generates an electrical signal based on the received light signal (which may include infrared light and some visible light). For example, this electrical signal may be a voltage corresponding to the light intensity generated by the infrared photodetector under the illumination of infrared light and some visible light, or it may also be a current signal or voltage signal generated by other means. This embodiment does not limit the specific working method of the infrared photodetector.
[0120] The signal front end may include one or more integrating circuits. Using these integrating circuits, the signal front end can integrate the electrical signal generated by the infrared photodetector over time. The integrating circuit can have various specific structures, and this embodiment does not limit the specific structure of the integrating circuit.
[0121] As an example, the signal front end may include Figure 3a The diagram shows an integrating circuit consisting of an amplifier, a capacitor, and a switch S1. The specific connections are shown in the figure. Switch S1 is controlled by a controller. The controller can control the integration time of the signal front-end by controlling the connection and disconnection of S1. For example, by controlling the connection and disconnection of S1, the signal front-end can... Figure 2c The signal strength during the time period from T0 to T1 is integrated, and the signal strength during the time period from T1 to T2 is also integrated.
[0122] An analog-to-digital converter (ADC) is used to convert an analog signal, which is integrated at the signal front end, into a digital signal.
[0123] The controller is used to control the operation of the aforementioned drive circuit, signal front end and analog-to-digital converter, and to output proximity detection data to the upper-level system.
[0124] The proximity detection method provided in the embodiments of this application will be described below in conjunction with the structure of the proximity light sensor.
[0125] Example 1
[0126] Please see Figure 4 This is a schematic diagram of the electrical signal strength generated by the infrared photodetector when there is interference from a flickering light source, as provided in the embodiments of this application.
[0127] In this embodiment, before the controller begins a proximity detection process, it controls the infrared light source to turn off for a period of time. Generally, this period of time can be consistent with the time the infrared light source is turned off during the proximity detection process. Figure 4 For example, in (1), the controller controls the infrared light source to be turned off for a period of time before time T0, specifically controlling the infrared light source to be turned off during the time period from Ta to T0.
[0128] Under the control of the controller, the signal front end integrates the intensity of the detector's electrical signal during the period when the infrared light source is turned off before the proximity detection process, and the obtained calculation result is recorded as the integral value X.
[0129] Alternatively, if the infrared light source is already off during the time period corresponding to the integral value X, the controller can directly control the signal front end to perform integration, and then control the infrared light source to turn on after obtaining the integral value X.
[0130] In some embodiments, the parameters of the circuit elements in the integrator circuit when obtaining the integral value X and the parameters of the circuit elements in the integrator circuit when obtaining the integral value 2 may be the same or different, but they may satisfy a specific proportional relationship.
[0131] When there exists such Figure 4 When using the flashing light source shown in (2), the flashing light source is bright during the time period from Ta to T1, and dim for most of the time during the time period from T1 to T2. The intensity of the light received by the infrared photodetector during the time period from Ta to T0 is higher than the intensity of the light received during the time period from T1 to T2. In the embodiments of this application, a bright flashing light source can mean that the flashing light source emits strong light, and a dim flashing light source can include situations such as the flashing light source not emitting light or emitting weak light.
[0132] Therefore, as Figure 4 As shown in (3), the intensity of the electrical signal generated by the infrared light detector during the period from Ta to T0 is greater than the intensity of the electrical signal generated by the infrared light detector during the period from T1 to T2. Accordingly, the integral value X obtained by integration during the period from Ta to T0 and the integral value 2 obtained during the period from T1 to T2 will have a large deviation. That is to say, the absolute value of the difference between the integral value 2 and the integral value X is greater than the preset abnormal threshold.
[0133] For comparison, see [link to relevant document] Figure 1 (1) If there is no interference from the flickering light source, the intensity of the detector electrical signal during the period from Ta to T0 is basically the same as the intensity of the detector electrical signal during the period from T1 to T2. Therefore, the deviation between the integral value X and the integral value 2 is small and will not exceed the set abnormal threshold.
[0134] It should be noted that the proximity detection method provided in this embodiment can function under interference from various flickering light sources and is not limited to this method. Figure 4 The flickering light source shown in (2) is as follows.
[0135] In most everyday use cases, there is a significant difference between the flickering frequency of a flashing light source and the frequency of an infrared light source switch. For example, the frequency of an infrared light source switch might be 3kHz, while the frequency of most flashing light sources in everyday use is likely no more than 1kHz. Furthermore, the phase of the flashing light source and the phase of the infrared light source switch also often differ considerably.
[0136] Therefore, under normal circumstances, the state of the flashing light source before the infrared light source is turned on is inconsistent with the state of the flashing light source after the infrared light source has been turned on for a period of time and then turned off again. That is to say, under normal circumstances, if the flashing light source does not emit light during the time period corresponding to the integral value X, then the flashing light source emits light during the time period corresponding to the integral value 2; if the flashing light source emits light during the time period corresponding to the integral value X, then the flashing light source does not emit light during the time period corresponding to the integral value 2.
[0137] Regardless of which of the above situations occurs, the absolute value of the difference between the integral value X and the integral value 2 will be greater than the set abnormal threshold. Therefore, the proximity sensor can determine whether the proximity detection process is interfered with by the flickering light source in the environment based on whether the absolute value of the difference between the integral value X and the integral value 2 is greater than the abnormal threshold.
[0138] Proximity sensors can be obtained in the following ways Figure 4 The integral value X shown is:
[0139] One way to obtain this value is to save the integral value when the infrared light source was turned off during the previous proximity detection process when the proximity light sensor performs multiple proximity detections continuously. This integral value is then used as the integral value X used to determine whether the proximity detection is affected by the flickering light source.
[0140] The beneficial effects of the above-mentioned acquisition method are as follows:
[0141] By reusing the integral value from the previous proximity detection process when the infrared light source was turned off, the proximity sensor does not need to turn off the infrared light source before performing proximity detection, thus determining more quickly whether the current proximity detection is interfered with by a flickering light source.
[0142] Another method is to, when the proximity sensor only performs proximity detection at intervals, if the proximity sensor determines that proximity detection is needed, the proximity sensor first turns off the infrared light source for a period of time. During this period, the signal front end of the proximity sensor integrates to obtain the integral value X, and then the proximity sensor starts to perform the proximity detection process.
[0143] according to Figure 4 For example, we can derive the following: Figure 5a The proximity detection method shown:
[0144] In some embodiments, the controller of the proximity sensor can control the various devices in the proximity sensor by executing pre-configured instructions, so that the proximity sensor performs the various steps in this method.
[0145] S101, acquire the first integral value of the signal strength of the infrared detector in the first time period, the second integral value in the second time period, and the third integral value in the third time period.
[0146] The first time period precedes the second time period, the second time period precedes the third time period, and the durations of the first, second, and third time periods can be equal.
[0147] During the first and third time periods, the infrared light source is turned off; during the second time period, the infrared light source is turned on.
[0148] In some optional embodiments, the infrared light source may be turned on during the first and third time periods, and turned off during the second time period.
[0149] Based on the previous examples, the first time period could be Figure 4 The second time period, from Ta to T0, can be... Figure 4 The third time period shown is the time interval from T0 to T1. Figure 4 The first integral value for the time period from T1 to T2 shown can be... Figure 4 The integral value X shown can be the second integral value. Figure 4 The integral value shown is 1, and the third integral value can be... Figure 4 The integral value shown is 2.
[0150] S102, determine whether the absolute value of the difference between the first integral value and the third integral value is greater than the preset abnormal threshold.
[0151] If the absolute value of the difference between the first integral value and the third integral value is not greater than the abnormal threshold, it is determined that the current proximity detection process was not interfered with by the flickering light source, and the proximity detection data obtained in this proximity detection is not abnormal data. Step S103 is executed. If the absolute value of the difference between the first integral value and the third integral value is greater than the abnormal threshold, it is determined that the current proximity detection process was interfered with by the flickering light source, and the proximity detection data obtained in this proximity detection is abnormal data. Step S104 is executed.
[0152] In practical applications, a register can be integrated inside the proximity sensor. The proximity sensor can be connected to the processor of an electronic device (e.g., a system-on-chip, SoC). The processor can send Serial Peripheral Interface (SPI) protocol commands, Inter-Integrated Circuit (I2C) protocol commands, or Universal Asynchronous Receiver / Transmitter (UART) protocol commands to the controller. These commands carry the aforementioned abnormal threshold. After receiving these commands, the controller writes the abnormal threshold carried in them into the register to implement step S102.
[0153] Alternatively, the above-mentioned abnormal threshold can be close to the default value in the optical sensor.
[0154] The processor can obtain the abnormal threshold from the server after connecting to the network, or technicians can preset the abnormal threshold in the memory of the electronic device when it leaves the factory. Thus, the processor can read the preset abnormal threshold from the memory of the electronic device.
[0155] In subsequent embodiments, the proximity light sensor can obtain the abnormal threshold in the same way, which will not be described again.
[0156] S103, output proximity detection data, which is the difference between the second integral value and the third integral value.
[0157] Based on the previous example, proximity detection data can be the difference between integral value 1 and integral value 2.
[0158] S104, The proximity detection data is determined to be abnormal data.
[0159] In practical applications, proximity sensors can set an exception flag bit in the proximity detection data to mark whether the data is abnormal. If a proximity detection data is determined to be abnormal, the exception flag bit is set to 1; if a proximity detection data is determined not to be abnormal, the exception flag bit is set to 0.
[0160] The above marking method is only an example of a method to distinguish abnormal data. In other optional embodiments, other methods can also be used to distinguish abnormal data from normal data. This embodiment does not limit the specific distinction method.
[0161] by Figure 5b For example, the controller can write proximity detection data into a register, and the processor of the electronic device can read the proximity detection data from the register. In this embodiment, the controller can pre-designate a specific bit in the register as an anomaly flag bit. After the controller determines whether the proximity detection data obtained in this proximity detection is abnormal data through step S102, if the proximity detection data is abnormal data, the controller sets the anomaly flag bit in the register to 1. When the processor reads the proximity detection data, it can detect that the proximity detection data is abnormal through the anomaly flag bit; if the proximity detection data is not abnormal data, the controller sets the anomaly flag bit in the register to 0. When the processor reads the proximity detection data, it can detect that the proximity detection data is not abnormal through the anomaly flag bit.
[0162] In some optional embodiments, when the proximity sensor completes a proximity detection and determines that the obtained proximity detection data is abnormal, it can delete the proximity detection data and then output the proximity detection data that was not abnormal data obtained before this proximity detection; or, after deleting the abnormal data obtained this time, the proximity sensor can perform a second proximity detection, and after determining that the proximity detection data obtained in the second proximity detection is not abnormal data, it can output the proximity detection data of the second proximity detection.
[0163] The beneficial effects of deleting abnormal proximity detection data are:
[0164] Deleting abnormal proximity detection data in a timely manner can prevent it from being falsely reported to the upper-level system, thus preventing the upper-level system from performing abnormal operations based on the abnormal proximity detection data, such as preventing the screen from turning off when the user is looking at the screen normally.
[0165] Alternatively, when the proximity sensor detects abnormal proximity detection data, it reports a pre-agreed special value to the upper-level system, such as 0, or other values with specific judgment. After the upper-level system detects that the data obtained in this proximity detection is abnormal through this special value, it can use historical proximity detection data or directly force the reporting of a predetermined state, such as reporting that the object is away from the screen, thereby resisting external interference.
[0166] This embodiment has the following beneficial effects:
[0167] Before performing proximity detection, the proximity sensor obtains the first integral value when the infrared light source is off. By comparing the first integral value with the integral value during the proximity detection process, it determines whether the proximity detection process is interfered with by the flickering light source. This avoids the proximity sensor outputting proximity detection data that is interfered with by the flickering light source, thus improving the proximity sensor's anti-interference capability.
[0168] Example 2
[0169] In this implementation, after a proximity detection is completed, the controller controls the infrared light source to be turned off for a period of time. The signal front end integrates the intensity of the detector's electrical signal during this period and records the result as the integral value Y. The controller compares the integral value Y with the integral value 2 obtained when the infrared light source is turned off during the proximity detection process to determine whether the proximity detection process is interfered with by the flickering light source.
[0170] Please see Figure 6 This is a schematic diagram of the electrical signal strength generated by the infrared photodetector when there is interference from a flickering light source, as provided in the embodiments of this application.
[0171] like Figure 6 As shown in (1), the proximity sensor starts proximity detection at time T0. During the period from T0 to T1, the controller turns on the infrared light source, and the signal front end integrates the intensity of the electrical signal of the infrared light detector during the period from T0 to T1 to obtain the integral value 1. During the period from T1 to T2, the controller turns off the infrared light source, and the signal front end integrates the intensity of the electrical signal of the infrared light detector during the period from T1 to T2 to obtain the integral value 2.
[0172] After obtaining the integral value 2, the infrared light source remains off. The signal front end integrates the intensity of the electrical signal from the infrared photodetector over a period of time after T2 to obtain the corresponding integral value. For example, in... Figure 6In (1), the signal front end integrates the intensity of the electrical signal during the time period from T2 to Tb to obtain the integral value Y.
[0173] The length of the time interval from T2 to Tb can be equal to the length of the time interval from T1 to T2. The parameters of the circuit elements in the integrator circuit when obtaining the integral value Y can be the same as or different from the parameters of the circuit elements in the integrator circuit when obtaining the integral value 2, but they must satisfy a specific proportional relationship.
[0174] like Figure 6 As shown in (2), the proximity sensor is interfered with by the flickering light source in the environment when performing proximity detection. The flickering light source emits light during the T0 to T1 period and dims at a certain moment during the T1 to T2 period.
[0175] During the time interval from T1 to T2, the scintillation light source is lit for part of the time and dark for part of the time. After T2, it remains dark. The infrared light source remains off after T1. Therefore, as shown in Figure (3), after T1, when the scintillation light source is lit, the intensity of the detector's electrical signal is high. When the scintillation light source dims, the intensity of the detector's electrical signal weakens significantly.
[0176] Due to the change in the electrical signal strength, the integral value 2 is significantly greater than the integral value Y, and the absolute value of the difference between the integral value 2 and the integral value Y is greater than the abnormal threshold.
[0177] In contrast, if the proximity detection is not interfered with by the flickering light source during the T0 to T2 period, the intensity of the light received by the infrared detector after time T1 will be relatively constant, and the intensity of the detector's electrical signal will also be relatively constant. In this case, the difference between the integral value 2 and the integral value Y is small and will not exceed the abnormal threshold.
[0178] Since the above judgment is based on the absolute value of the difference between integral value 2 and integral value Y, even if the flickering light source goes dark first and then bright during the T0 to Tb period, it will not affect the final judgment result.
[0179] In summary, in this embodiment, after completing a proximity detection process, the proximity sensor can determine whether the absolute value of the difference between the integral value Y and the integral value 2 is greater than a preset abnormal threshold. If the absolute value of the difference between the integral value Y and the integral value 2 is greater than the abnormal threshold, it is considered that the proximity detection was interfered with by a flickering light source. If the absolute value of the difference between the integral value Y and the integral value 2 is not greater than the abnormal threshold, it is considered that the proximity detection was not interfered with by a flickering light source.
[0180] It should be noted that in this embodiment, the time periods during which the proximity light sensor obtains integral value 1, integral value 2, and integral value Y can be discontinuous. That is, after the proximity light sensor obtains integral value 1, it can wait for a period of time before starting to integrate the intensity of the detector's electrical signal. Similarly, after obtaining integral value 2, it can also wait for a period of time before starting to integrate the intensity of the detector's electrical signal.
[0181] As an example, see Figure 7 After time T1, the infrared light source remains off. The signal front end integrates the intensity of the detector's electrical signal again after a delay of t1 to obtain the integral value 2. Then, the signal front end waits for a delay of t2. After the delay of t2, the signal front end continues to integrate the intensity of the detector's electrical signal to obtain the integral value Y.
[0182] The delays t1 and t2 mentioned above can be equal or unequal. The length of the delay can be set according to the actual situation or can be dynamically changed as needed; this embodiment does not limit this.
[0183] In some embodiments, to ensure that the difference between integral value Y and integral value 2 can accurately reflect the interference situation in the proximity detection process, the delay t1 and delay t2 can be limited to no more than 50 milliseconds (ms) to avoid misjudgment due to excessive delay.
[0184] Setting a certain delay time before each integration has the following beneficial effects:
[0185] Due to the performance of components in the circuit, the accuracy of the integration result obtained by the proximity light sensor may be affected if it performs multiple integrations continuously. The accuracy of the integration result can be improved by delaying the integration for a period of time before each integration.
[0186] according to Figure 6 and Figure 7 For example, we can derive the following: Figure 8 The proximity detection method shown:
[0187] In some embodiments, the controller of the proximity sensor can control the various devices in the proximity sensor by executing pre-configured instructions, so that the proximity sensor performs the various steps in this method.
[0188] S201, acquire the second integral value of the signal strength of the infrared detector in the second time period, the third integral value in the third time period, and the fourth integral value in the fourth time period.
[0189] The second time period precedes the third time period, the third time period precedes the fourth time period, and the durations of the second, third, and fourth time periods can be equal.
[0190] During the second time period, the infrared light source is turned on; during the third and fourth time periods, the infrared light source is turned off.
[0191] In some alternative embodiments, the infrared light source may be turned off during the second time period and turned on during the third and fourth time periods.
[0192] Based on the previous examples, the second time period could be Figure 6 The third time period shown is the time interval from T0 to T1. Figure 6 The fourth time period, which is shown as T1 to T2, can be... Figure 6 The second integral value for the time interval from T2 to Tb shown can be... Figure 6 The integral value shown is 1, and the third integral value can be... Figure 6 The integral value shown is 2, and the fourth integral value can be... Figure 6 The integral value Y is shown.
[0193] S202, determine whether the absolute value of the difference between the third integral value and the fourth integral value is greater than the preset abnormal threshold.
[0194] If the absolute value of the difference between the third and fourth integral values is not greater than the abnormal threshold, it is determined that the current proximity detection process is not interfered with by the flickering light source, and step S203 is executed. If the absolute value of the difference between the third and fourth integral values is greater than the abnormal threshold, it is determined that the current proximity detection process is interfered with by the flickering light source, and step S204 is executed.
[0195] S203, output proximity detection data, which is the difference between the second integral value and the third integral value.
[0196] Based on the previous example, proximity detection data can be the difference between integral value 1 and integral value 2.
[0197] S204, The proximity detection data has been determined to be abnormal.
[0198] This embodiment has the following beneficial effects:
[0199] After completing a proximity detection, the proximity sensor obtains the fourth integral value when the infrared light source is off. By comparing the fourth integral value with the integral value during the proximity detection process, it can determine whether the proximity detection process is interfered with by the flickering light source. This avoids the proximity sensor outputting proximity detection data that is interfered with by the flickering light source, thus improving the proximity sensor's anti-interference capability.
[0200] Furthermore, this embodiment helps the proximity light sensor identify interference from flickering light sources in certain special circumstances.
[0201] If during the period when the integral value of 2 is obtained (for example) Figure 6During the T1 to T2 time period, the flashing light source is bright for a longer time and dark for a shorter time, so the integral value 2 and the value before detection (e.g.) Figure 6 The integral value X obtained before time T0 is small, and the integral value 2 and the integral value after proximity detection (e.g.) Figure 6 The integral value Y obtained after time T2 has a large deviation. Therefore, under the above conditions, the proximity detection method provided in this embodiment can accurately identify interference from flickering light sources, further improving the anti-interference capability of the proximity light sensor.
[0202] Example 3
[0203] During a proximity detection process, the proximity light sensor can perform multiple integrations during the period when the infrared light source is on and multiple integrations during the period when the infrared light source is off. If there is no interference from a flickering light source during the proximity detection process, the multiple integration values obtained when the infrared light source is on should be basically consistent, and the multiple integration values obtained when the infrared light source is off should also be basically consistent. Therefore, if the proximity light sensor finds that the multiple integration values when the infrared light source is on or when the infrared light source is off have large deviations, it can be considered that there is interference from a flickering light source in the proximity detection process.
[0204] Please see Figure 9 This is a schematic diagram illustrating the electrical signal strength generated by an infrared photodetector when there is interference from a flickering light source, as provided in another embodiment of this application.
[0205] like Figure 9 As shown in (1), the proximity sensor performs a proximity detection once during the period from T0 to T2, wherein the infrared light source is turned on during the period from T0 to T1 and turned off during the period from T1 to T2.
[0206] The proximity detection process has the following characteristics: Figure 9 The interference of the flickering light source shown in (2) is that the flickering light source is bright during the period from T0 to T1, and dims after T1 and continues until the end of this proximity detection, that is, until after T2.
[0207] During this proximity test, if Figure 9 As described in (3), the proximity sensor performs three integrations during the T0 to T1 period when the infrared light source is on, obtaining the corresponding integration values A, B, and C. During the period when the infrared light source is off, it performs three integrations, obtaining the corresponding integration values D, E, and F. Specifically, when the infrared light source is on, the duration of each integration by the proximity sensor is equal, i.e., the durations corresponding to integration values A, B, and C are equal. When the infrared light source is off, the duration of each integration by the proximity sensor is equal, i.e., the durations corresponding to integration values D, E, and F are equal.
[0208] It should be noted that the above integration count is just an example. In practical applications, the proximity sensor can determine the number of integrations when the infrared light source is on and the number of integrations when the infrared light source is off, depending on the actual situation. Furthermore, the number of integrations when the infrared light source is on and the number of integrations when the infrared light source is off can be the same or different.
[0209] The proximity sensor can acquire the aforementioned multiple integral values over a period of time that can be continuous or discontinuous. Figure 9 For example, after the proximity sensor obtains the integral value A, it waits for a period of time before starting the second integration to obtain the integral value B, and then waits for a period of time before starting the third integration to obtain the integral value C, and so on.
[0210] from Figure 9 As can be seen from (3), when the proximity detection process is affected Figure 9 When the interference of the scintillation light source shown in (2) occurs, the infrared light source remains on during the time period from T0 to T1, and the scintillation light source continues to be lit. Therefore, the intensity of the detector's electrical signal remains basically unchanged. The integral values A, B, and C obtained by multiple integrations during this time period are basically the same.
[0211] During the time interval T1 to T2, the infrared light source remains off, while the flashing light source dims after illuminating for a period of time. This results in the detector's electrical signal strength being significantly higher when the flashing light source is on than when it is off during the T1 to T2 time interval. Consequently, among the integrated values D, E, and F obtained by the proximity sensor during the T1 to T2 time intervals, there is a significant difference between the integrated value D obtained when the flashing light source is on and the integrated values E and F obtained when the flashing light source is off. In other words, the deviation between the integrated values D, E, and F is too large. Therefore, the proximity sensor can determine that the proximity detection process is interfered with by the flashing light source.
[0212] The proximity sensor can be evaluated using various methods to determine whether the deviation between multiple integral values is too large. This embodiment does not limit the specific evaluation method.
[0213] As an example, a proximity sensor can calculate the variance or standard deviation of multiple integral values, compare the calculation results with a preset abnormal threshold, and if the variance or standard deviation of multiple integral values is greater than the abnormal threshold, then the deviation between these integral values is considered to be too large.
[0214] by Figure 9For example, in (3), the proximity light sensor can calculate the variance of the integral values A, B and C. If the variance is greater than the abnormal threshold, the integral values A, B and C are considered to have excessive deviation. If the variance is less than the abnormal threshold, the integral values A, B and C are considered to have small deviation. Similarly, the proximity light sensor can calculate the variance of the integral values D, E and F. If the variance is greater than the abnormal threshold, the integral values D, E and F are considered to have excessive deviation. If the variance is less than the abnormal threshold, the integral values D, E and F are considered to have small deviation.
[0215] As another example, a proximity sensor can calculate the difference between any two integral values among multiple integral values. If the absolute value of the difference between any two integral values is greater than a preset abnormal threshold, then the deviation of the multiple integral values is considered to be too large.
[0216] by Figure 9 Taking (3) as an example, the proximity sensor calculates the difference between integral values A and B, the difference between integral values B and C, and the difference between integral values A and C. The absolute values of these three differences are all less than the abnormal threshold, so the proximity sensor determines that the deviations of integral values A, B, and C are small. Similarly, the proximity sensor calculates the difference between integral values D and E, the difference between integral values E and F, and the difference between integral values D and F. It finds that the absolute values of the difference between integral values D and E, and the absolute values of the difference between integral values D and F are all greater than the abnormal threshold, so the proximity sensor determines that the deviations of integral values D, E, and F are large.
[0217] According to such Figure 9 The example shown can yield the following results: Figure 10 One approach detection method shown:
[0218] In some embodiments, the controller of the proximity sensor can control the various devices in the proximity sensor by executing pre-configured instructions, so that the proximity sensor performs the various steps in this method.
[0219] S301, acquire multiple segmented integral values of the signal strength of the infrared detector in the second time period, and multiple segmented integral values in the third time period.
[0220] The second time period precedes the third time period, and the lengths of the second and third time periods can be equal. During the second time period, the infrared light source near the light sensor is turned on, and during the third time period, the infrared light source near the light sensor is turned off.
[0221] The multiple segmented integral values within the second time period are obtained by the proximity sensor performing multiple integrations within the second time period. For example, the multiple segmented integral values within the second time period can be... Figure 9 The integral values A, B, and C are shown.
[0222] The multiple segmented integral values within the third time period are obtained by the proximity sensor performing multiple integrations within the third time period. For example, the multiple segmented integral values within the third time period can be... Figure 9 The integral values D, E, and F are shown.
[0223] S302, determine whether the deviation of multiple segmented integral values in the second time period is too large, and whether the deviation of multiple segmented integral values in the third time period is too large.
[0224] If the deviations of multiple segment integral values are small in the second time period and the deviations of multiple segment integral values are small in the third time period, then proceed to step S303; if the deviations of multiple segment integral values are too large in the second time period or the deviations of multiple segment integral values are too large in the third time period, then proceed to step S304.
[0225] Referring to the aforementioned example, step S302 can be implemented by determining whether the variance or standard deviation of multiple segmented integral values in the second time period is greater than an abnormal threshold, and determining whether the variance or standard deviation of multiple segmented integral values in the third time period is greater than an abnormal threshold.
[0226] If the variance or standard deviation of multiple segmented integral values in the second time period is greater than the abnormal threshold, the deviation of multiple segmented integral values in the second time period is considered to be too large. If the variance or standard deviation of multiple segmented integral values in the second time period is not greater than the abnormal threshold, the deviation of multiple segmented integral values in the second time period is considered to be small.
[0227] Similarly, if the variance or standard deviation of multiple segmented integral values in the third time period is greater than the abnormal threshold, it is considered that the deviation of multiple segmented integral values in the third time period is too large. If the variance or standard deviation of multiple segmented integral values in the third time period is not greater than the abnormal threshold, it is considered that the deviation of multiple segmented integral values in the third time period is small.
[0228] The implementation of step S302 can also be to determine whether the difference between every two segment integral values in the second time period is greater than the abnormal threshold, and to determine whether the difference between every two segment integral values in the third time period is greater than the abnormal threshold.
[0229] If the difference between any two segment integral values in the second time period is greater than the abnormal threshold, then the deviation of multiple segment integral values in the second time period is considered to be too large. If the difference between any two segment integral values in the second time period is not greater than the abnormal threshold, then the deviation of multiple segment integral values in the second time period is considered to be small.
[0230] Similarly, if the difference between any two segment integral values in the third time period is greater than the abnormal threshold, then the deviation of multiple segment integral values in the third time period is considered to be too large. If the difference between any two segment integral values in the third time period is not greater than the abnormal threshold, then the deviation of multiple segment integral values in the third time period is considered to be small.
[0231] S303, output proximity detection data, which is the difference between the first cumulative value and the second cumulative value. The first cumulative value is the sum of multiple segmented integral values in the second time period, and the second cumulative value is the sum of multiple segmented integral values in the third time period.
[0232] by Figure 9 For example, in (3), the first cumulative value can be the sum of integral values A, B and C, and the second cumulative value can be the sum of integral values D, E and F.
[0233] S304, The proximity detection data has been determined to be abnormal.
[0234] In this embodiment, the proximity detection data can be the difference between a first cumulative value and a second cumulative value, wherein the first cumulative value is the sum of multiple integral values obtained when the infrared light source is turned on, and the second cumulative value is the sum of multiple integral values obtained when the infrared light source is turned off.
[0235] This embodiment has the following beneficial effects:
[0236] In this embodiment, the proximity light sensor determines whether the proximity detection process is interfered with by a flickering light source based on the integral value obtained during the proximity detection process, thereby improving the timeliness of the judgment result and avoiding inconsistencies between the judgment result and the actual situation during the proximity detection process.
[0237] It should be noted that the abnormal thresholds used in Examples 1 to 3 above may be the same or different.
[0238] For example, the abnormal threshold in Embodiment 1 can be a first abnormal threshold, the abnormal threshold in Embodiment 2 can be a second abnormal threshold, and the abnormal threshold in Embodiment 3 can be a third abnormal threshold. The first abnormal threshold, the second abnormal threshold, and the third abnormal threshold are all different from each other.
[0239] In some alternative embodiments, the proximity light sensor can be combined with any one or more of the embodiments one to three described above for proximity detection.
[0240] As an example, the proximity light sensor can simultaneously execute the methods of Embodiments 1 to 3.
[0241] Combination Figure 4 , Figure 6 and Figure 9 For example, a proximity sensor keeps the infrared light source off before initiating a proximity detection, such as... Figure 4 During the time interval from Ta to T0, the infrared light source is kept off, and an integration is performed once when the infrared light source is off to obtain the result as follows: Figure 4 The integral value X shown is then used to approach the light sensor to begin detection.
[0242] During the proximity detection process, the proximity light sensor turns on the infrared light source during the time interval T0 to T1. During this period, the proximity light sensor performs multiple integrations according to the method in Example 3 to obtain multiple integration values, for example... Figure 9 The integral values A, B, and C are then obtained. Subsequently, during the time period T1 to T2, the infrared light source is turned off. While the infrared light source is off, the proximity sensor performs multiple integrations according to the method in Example 3 to obtain multiple integral values, for example... Figure 9 The integral values D, E, and F are obtained, and the intensity of the detector electrical signal of the proximity optical sensor is integrated over the entire T1 to T2 period to obtain the integral value 2.
[0243] After time T2, the proximity sensor keeps the infrared light source off, for example... Figure 6 The infrared light source is kept off during the time period from T2 to Tb. Then, the intensity of the detector's electrical signal during this time period is integrated to obtain the integral value Y.
[0244] Finally, the proximity sensor determines whether the absolute value of the difference between the integral value X and the integral value 2 is greater than the first abnormal threshold, whether the absolute value of the difference between the integral value Y and the integral value 2 is greater than the second abnormal threshold, whether the deviations of the integral values A, B and C are too large, and whether the deviations of the integral values D, E and F are too large.
[0245] If any one or more of the above judgments are true, the proximity sensor determines that the current proximity detection process is interfered with by the flickering light source. If the result of each of the above judgments is false, the proximity sensor determines that the current proximity detection process is not interfered with by the flickering light source.
[0246] The beneficial effect of the proximity detection method provided in the combined embodiments one to three is that it can further improve the anti-interference capability of the proximity light sensor. Even if the flicker frequency of the flashing light source is similar to the switching frequency of the infrared light source, the proximity light sensor can still detect the interference of the flashing light source.
[0247] by Figure 11 For example, this embodiment provides a schematic diagram of the electrical signal strength generated by an infrared photodetector when it is interfered with by a flashing light source of the same frequency.
[0248] like Figure 11 As shown in (2), when the proximity sensor performs a proximity detection during the T0 to T2 period, it is interfered with by the flashing light source, and the flashing frequency of the flashing light source is basically the same as the frequency of the infrared light source switch.
[0249] In this case, such as Figure 11As shown in (3), the integral value X obtained before proximity detection is basically the same as the integral value 2 obtained during proximity detection. That is to say, the absolute value of the difference between integral value X and integral value 2 is less than the corresponding first abnormal threshold.
[0250] According to the method provided in Example 2, by adding a period of infrared light source shutdown after proximity detection, the corresponding integral value Y can be obtained. Figure 11 As can be seen from (3), the flashing light source is bright for a longer period of time in the time period corresponding to the integral value Y, while the flashing light source is bright for a shorter period of time in the time period corresponding to the integral value 2. Therefore, the absolute value of the difference between the integral value 2 and the integral value Y may be greater than the corresponding second abnormal threshold. Thus, the proximity sensor can detect that the proximity detection is interfered with by the flashing light source.
[0251] Even if the absolute value of the difference between integral value 2 and integral value Y is not greater than the second abnormal threshold, as shown in Example 3, the proximity light sensor can still detect that the deviation of integral values A, B and C obtained by segmented integration when the infrared light source is turned on is too large, and thus find that the proximity detection is interfered with by the flickering light source.
[0252] The following examples illustrate the application of the proximity detection method provided in this application in real-world scenarios.
[0253] by Figure 2a Taking the scenario shown as an example, on a sunny day, a user walks under the shade of a tree while browsing news on their phone. During this time, the phone's proximity sensor performs multiple proximity detections according to the proximity detection method described in Example 1.
[0254] Suppose that during a certain proximity detection process, in the second time period, i.e. the period when the infrared light source is on, the user is located in a bright area under the shade of a tree, and in the third time period, i.e. the period when the infrared light source is off, the user is located in a dark area under the shade of a tree.
[0255] Understandably, in this situation, the light illuminating the detector is stronger in the second period, resulting in a higher intensity of the electrical signal output by the detector, while the light illuminating the detector is weaker in the third period, resulting in a lower intensity of the electrical signal output by the detector.
[0256] Therefore, in this proximity detection process, the second integral value output by the signal front end is larger in the second time period and the third integral value output by the signal front end is smaller in the third time period, resulting in the absolute value of the difference between the second integral value and the third integral value being greater than the proximity threshold.
[0257] If the proximity sensor directly reports the proximity detection data obtained during this proximity detection process, the upper-level system will determine that an object is close to the screen based on the proximity detection data, causing the phone screen to suddenly turn off when the user is browsing the news.
[0258] In this example, prior to this proximity detection process, the proximity light sensor controls the infrared light source to turn off and obtains the corresponding first integral value during the first period before the second period. During the first and second periods, the user is always in the bright area under the shade of the tree.
[0259] Therefore, the light illuminating the detector in the first time period is significantly stronger than the light illuminating the detector in the third time period. The first integral value obtained in the first time period is significantly greater than the third integral value obtained in the third time period. The proximity sensor determines that the absolute value of the difference between the first integral value and the third integral value is greater than the abnormal threshold, thus determining that the proximity detection data obtained this time is abnormal data interfered with by the flickering light source. It does not report to the upper-level system, thus avoiding the mobile phone from turning off the screen due to mistakenly thinking that an object is approaching the screen.
[0260] This application also provides an electronic device, which includes a proximity light sensor.
[0261] The proximity sensor is used to execute pre-configured computer instructions to implement the proximity detection method provided in any embodiment of this application.
[0262] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0263] The "multiple" mentioned in the embodiments of this application refers to two or more. It should be noted that in the description of the embodiments of this application, terms such as "first" and "second" are used only for the purpose of distinguishing descriptions and should not be construed as indicating or implying relative importance, nor should they be construed as indicating or implying order.
Claims
1. A proximity detection method applied to electronic devices, characterized in that, include: The integral value of the infrared detector signal strength is obtained in a second time period close to the detection period, and in a third time period close to the detection period. The second time period is before the third time period. The switching state of the infrared light source is different in the second time period and the third time period. The integral value in the second time period includes multiple segmented integral values obtained by multiple integrations in the second time period. The integral value in the third time period includes multiple segmented integral values obtained by multiple integrations in the third time period. If the deviation data is not greater than the preset third abnormal threshold, it is determined that the proximity detection cycle is not interfered with by the flickering light source, and the proximity detection data determined based on the integral value in the second time period and the integral value in the third time period is output. The deviation data includes at least the standard deviation of multiple segmented integral values in the second time period and the standard deviation of multiple segmented integral values in the third time period. If any of the aforementioned deviation data exceeds the third abnormal threshold, it is determined that the proximity detection cycle is interfered with by the flickering light source, and the proximity detection data is determined to be abnormal data.
2. The method according to claim 1, characterized in that, The deviation data also includes the deviation between the integral value obtained during the proximity detection period and the integral value of the infrared light detector signal intensity outside the proximity detection period, wherein the integral value obtained during the proximity detection period and the integral value of the infrared light detector signal intensity outside the proximity detection period are obtained under the condition that the switching state of the infrared light source is the same.
3. The method according to claim 2, characterized in that, The integral value obtained outside the proximity detection period includes the integral value of the infrared light detector signal strength during a first time period before the proximity detection period, wherein the switching state of the infrared light source is the same during the first time period and the third time period.
4. The method according to claim 3, characterized in that, The deviation between the integral value obtained in the proximity detection period and the integral value of the infrared light detector signal intensity outside the proximity detection period includes the absolute value of the difference between the integral value in the first time period and the integral value in the third time period.
5. The method according to claim 4, characterized in that, If all deviation data are not greater than a preset third abnormal threshold, determining that the proximity detection period is not interfered with by the flickering light source includes: If the absolute value of the difference in the deviation data is not greater than the preset first abnormal threshold, and the standard deviation of the segmented integral values is not greater than the third abnormal threshold, it is determined that the proximity detection cycle is not interfered with by the flickering light source. If any of the aforementioned deviation data is greater than the third anomaly threshold, it includes: If the absolute value of the difference in the deviation data is greater than the first abnormal threshold, and / or the standard deviation of the segmented integral value is greater than the third abnormal threshold, it is determined that the proximity detection cycle is interfered with by the flickering light source.
6. The method according to claim 2, characterized in that, The integral value obtained outside the proximity detection period includes the integral value of the infrared light detector signal strength in the fourth time period after the proximity detection period, wherein the switching state of the infrared light source is the same in the fourth time period and the third time period.
7. The method according to claim 6, characterized in that, The deviation between the integral value obtained in the proximity detection period and the integral value of the infrared light detector signal intensity outside the proximity detection period includes the absolute value of the difference between the integral value in the third time period and the integral value in the fourth time period.
8. The method according to claim 7, characterized in that, If all deviation data are not greater than a preset third abnormal threshold, determining that the proximity detection period is not interfered with by the flickering light source includes: If the absolute value of the difference in the deviation data is not greater than the preset second abnormal threshold, and the standard deviation of the segmented integral values is not greater than the third abnormal threshold, it is determined that the proximity detection cycle is not interfered with by the flickering light source. If all deviation data are not greater than a preset third abnormal threshold, determining that the proximity detection period is not interfered with by the flickering light source includes: If the absolute value of the difference in the deviation data is greater than the second abnormal threshold, and / or the standard deviation of the piecewise integral value is greater than the third abnormal threshold, it is determined that the proximity detection cycle is interfered with by the flickering light source.
9. The method according to claim 1, characterized in that, The proximity detection data is the difference between the integral value in the second time period and the integral value in the third time period.
10. The method according to claim 1, characterized in that, The proximity detection data is the difference between a first cumulative value and a second cumulative value. The first cumulative value is the sum of multiple segmented integral values within the second time period, and the second cumulative value is the sum of multiple segmented integral values within the third time period.
11. The method according to any one of claims 1 to 10, characterized in that, After determining that the proximity detection data is abnormal, the process further includes: Delete the proximity detection data.
12. The method according to any one of claims 1 to 10, characterized in that, A preset delay time is set between the second time period and the third time period.
13. An electronic device, characterized in that, Including proximity light sensors; The proximity sensor is used to execute preset computer instructions, specifically to implement the proximity detection method as described in any one of claims 1 to 12.
Citation Information
Patent Citations
Electrode substrate, a display device equipped with the electrode substrate and touch screen
CN104584434A
