Stylus pen deviation detection method and electronic device
By using Hall sensors on electronic devices to detect the offset of the stylus' adsorption position, and combining it with the quality factor of the transmitting coil, the problem of users' difficulty in accurately adsorbing the stylus is solved, achieving more efficient charging and user experience.
Patent Information
- Application Number
- CN202310453470.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-24
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2043-04-24
AI Technical Summary
When the user attaches the stylus to the electronic device, it is difficult to accurately determine the position of the transmitting coil and the receiving coil, causing the stylus adsorption position to shift and affecting charging efficiency.
The first and second Hall sensors are used respectively on the left and right sides of the transmitting coil. By detecting the intensity and direction of magnetic induction, the processor receives the signal value and determines whether the stylus is offset, and combines the quality factor of the transmitting coil to improve detection accuracy. , and indicate the user's movement direction through a prompt screen.
Effectively detects and corrects the adsorption position deviation of the stylus to ensure charging efficiency and user experience, and improves the contact stability between the stylus and electronic devices.
Smart Images

Figure CN117130496B
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic technology, and in particular to a stylus deviation detection method and electronic equipment. Background Art
[0002] Electronic devices such as tablet computers that can input information by touch can be equipped with a stylus. Users can use the stylus to input information such as text and graphics on the electronic device. In the related art, the stylus can be attached to the electronic device by a magnet. After the stylus is attached to the correct position on the electronic device, electrical energy can be transmitted between the transmitting coil in the electronic device and the receiving coil in the stylus, so that the electronic device can charge the stylus. However, since the user cannot know the specific positions of the transmitting coil and the receiving coil, when the user attaches the stylus to the electronic device, the attachment position of the stylus on the electronic device may shift, which will affect the electronic device's charging of the stylus. Based on this, there is an urgent need for a stylus offset detection method to detect whether the attachment position of the stylus on the electronic device is offset. Summary of the invention
[0003] The present application provides a stylus deviation detection method and an electronic device, which can detect whether the adsorption position of the stylus on the electronic device is offset. The technical solution is as follows:
[0004] In a first aspect, a stylus offset detection method is provided. The stylus offset detection method is applied to an electronic device. The electronic device includes a first Hall sensor, a second Hall sensor, a transmitting coil, and a processor. The first Hall sensor is located on the left side of the transmitting coil, and the second Hall sensor is located on the right side of the transmitting coil. The first Hall sensor, the second Hall sensor, and the transmitting coil are all connected to the processor.
[0005] The stylus pen offset detection method comprises the following steps: a processor receives a first signal value output by a first Hall sensor and a second signal value output by a second Hall sensor; the processor determines whether a stylus pen offset occurs according to the first signal value and the second signal value. The stylus pen offset refers to the position of the stylus pen attached to the electronic device being offset to the left or right relative to a preset position.
[0006] In the embodiment of the present application, the first Hall sensor is located on the left side of the transmitting coil, and can detect the magnetic induction intensity and direction of its position, and output a first signal value. The second Hall sensor is located on the right side of the transmitting coil, and can detect the magnetic induction intensity and direction of its position, and output a second signal value. In this way, after receiving the first signal value and the second signal value, the processor can obtain the magnetic induction intensity and direction of the position of the first Hall sensor, and the magnetic induction intensity and direction of the position of the second Hall sensor. That is, the magnetic induction intensity and direction of the left side of the transmitting coil and the magnetic induction intensity and direction of the right side of the transmitting coil are obtained. Based on this, it is possible to determine whether the stylus is offset and the offset direction when the stylus is offset according to the magnetic induction intensity and direction of the left side of the transmitting coil and the magnetic induction intensity and direction of the right side of the transmitting coil.
[0007] In some embodiments, the stylus deviation detection method may further include the following step: detecting the quality factor of the transmitting coil.
[0008] In this case, when the processor executes the step of "the processor determines whether the stylus offset occurs according to the first signal value and the second signal value", it can be specifically: the processor determines whether the stylus offset occurs according to the first signal value, the second signal value and the quality factor of the transmitting coil.
[0009] Specifically, since the quality factor of the transmitting coil is different when the stylus is offset and when it is not offset, the stylus offset detection method can also detect the quality factor of the transmitting coil and determine whether the stylus offset occurs in combination with the quality factor of the transmitting coil, thereby improving the detection accuracy of the stylus offset.
[0010] In some embodiments, when the processor executes the step of "the processor determines whether the stylus offset occurs according to the first signal value, the second signal value and the quality factor of the transmitting coil", it can be specifically: the processor obtains the corresponding position indication information from the correspondence between the signal value and the position indication information according to the first signal value and the second signal value; the processor determines whether the stylus offset occurs according to the position indication information and the quality factor of the transmitting coil. The position indication information is used to indicate whether the position is offset to the left, offset to the right or not offset relative to the preset adsorption position. The correspondence between the signal value and the position indication information can be a correspondence table between the signal value and the position indication information.
[0011] In some embodiments, the electronic device has a contact surface. When the stylus is adsorbed on the electronic device, it contacts the contact surface of the electronic device. A direction perpendicular to the contact surface and pointing to the inside of the electronic device is defined as a preset direction. Based on this, in an embodiment of the present application, when the magnetic induction intensity of the first Hall sensor at the location along the preset direction is greater than the preset intensity, the first signal value output is 1. When the magnetic induction intensity of the first Hall sensor at the location along the opposite direction of the preset direction is greater than the preset intensity, the first signal value output is -1. When the magnetic induction intensity of the first Hall sensor at the location along the preset direction and the magnetic induction intensity along the opposite direction of the preset direction are both less than or equal to the preset intensity, the first signal value output is 0. When the magnetic induction intensity of the second Hall sensor at the location along the preset direction is greater than the preset intensity, the first signal value output is 1, and the preset direction is perpendicular to the contact surface and points to the inside of the electronic device. When the magnetic induction intensity of the second Hall sensor at the location along the opposite direction of the preset direction is greater than the preset intensity, the first signal value output is -1. When the magnetic induction intensity of the second Hall sensor at the location along the preset direction and the magnetic induction intensity along the opposite direction of the preset direction are both less than or equal to the preset intensity, the first signal value output is 0.
[0012] In some embodiments, in the correspondence between the signal value and the position indication information, the position indication information corresponding to the first signal value of -1 and the second signal value of 0 indicates a leftward shift. The position indication information corresponding to the first signal value of 0 and the second signal value of -1 indicates a rightward shift. The position indication information corresponding to the first signal value of 0 and the second signal value of 1 indicates a rightward shift or no shift. The position indication information corresponding to the first signal value of 1 and the second signal value of 0 indicates a leftward shift or no shift.
[0013] In some embodiments, when the processor executes the step of "the processor determines whether the stylus pen offset occurs according to the position indication information and the quality factor of the transmitting coil", specifically: if the position indication information indicates a leftward offset, and the quality factor of the transmitting coil is less than the first threshold, it is determined that the adsorption position of the stylus pen is offset to the left relative to the preset adsorption position. If the position indication information indicates a rightward offset, and the quality factor of the transmitting coil is less than the first threshold, it is determined that the adsorption position of the stylus pen is offset to the right relative to the preset adsorption position. If the position indication information indicates a leftward offset or no offset, and the quality factor of the transmitting coil is less than the first threshold, it is determined that the adsorption position of the stylus pen is offset to the left relative to the preset adsorption position. If the position indication information indicates a leftward offset or no offset, and the quality factor of the transmitting coil is greater than the second threshold, it is determined that the stylus pen offset does not occur. If the position indication information indicates a rightward offset or no offset, and the quality factor of the transmitting coil is less than the first threshold, it is determined that the adsorption position of the stylus pen is offset to the right relative to the preset adsorption position. If the position indication information indicates a rightward shift or no shift, and the quality factor of the transmitting coil is greater than the second threshold, it is determined that no stylus shift occurs.
[0014] In some embodiments, after executing the step of "the processor receives the first signal value output by the first Hall sensor and the second signal value output by the second Hall sensor", the processor is further used to execute the following steps: the processor obtains the corresponding position indication information from the correspondence between the signal value and the position indication information according to the first signal value and the second signal value; the processor configures the screen resources according to the position indication information. Among them, the screen resources are the resources required when displaying the prompt screen corresponding to the position indication information, and the prompt screen is used to prompt the stylus to move in the opposite direction of the offset direction. For example, when the position indication information indicates an offset to the left, the prompt screen is used to prompt the stylus to move to the right. When the position indication information indicates an offset to the right, the prompt screen is used to prompt the stylus to move to the left.
[0015] Furthermore, after executing the step of "the processor determines whether a stylus offset occurs based on the first signal value, the second signal value and the quality factor of the transmitting coil", the processor is also used to execute the following steps: if a stylus offset occurs, the processor uses screen resources to display a prompt screen.
[0016] In some embodiments, before executing the step of "the processor determines whether the stylus pen is offset according to the first signal value, the second signal value and the quality factor of the transmitting coil", the processor is further configured to execute the following step: the processor sends a communication signal to the stylus pen.
[0017] In this case, when the processor executes the step of "the processor determines whether the stylus offset occurs based on the first signal value, the second signal value and the quality factor of the transmitting coil", it can specifically be: if a feedback signal for the communication signal is received within a preset time length after the communication signal is sent, the processor determines whether the stylus offset occurs based on the first signal value, the second signal value and the quality factor of the transmitting coil.
[0018] The process of "the processor detecting the quality factor of the transmitting coil" is described below.
[0019] In some embodiments, the electronic device further includes a capacitor, and the first plate of the capacitor is connected to the first end of the transmitting coil. In this case, when the processor executes the step of "the processor detects the quality factor of the transmitting coil", it can be specifically: the processor charges the capacitor and the transmitting coil until the capacitor and the transmitting coil are both in a steady state; the processor controls the second plate of the capacitor to be connected to the second end of the transmitting coil, so that an oscillating electrical signal is generated between the first plate of the capacitor and the first end of the transmitting coil; the processor determines the quality factor of the transmitting coil based on the n-1th amplitude and the nth amplitude of the multiple amplitudes of the oscillating electrical signal. Wherein, n is an integer greater than or equal to 2.
[0020] Specifically, the electronic device further includes a first switch, a second switch, and a third switch. The first end of the first switch is used to connect to the positive pole of the power supply, the second end of the first switch is connected to the second plate of the capacitor and the first end of the second switch, the first end of the third switch is connected to the second end of the transmitting coil, and the second end of the second switch and the second end of the third switch are both used to connect to the negative pole of the power supply. In this case, when the processor executes the step of "the processor charges the capacitor and the transmitting coil", it can be specifically: the processor controls the second switch to turn off, and controls the first switch and the third switch to turn on, so as to charge the capacitor and the transmitting coil. When the processor executes the step of "the processor controls the second plate of the capacitor to be connected to the second end of the transmitting coil", it can be specifically: the processor controls the first switch to turn off, and controls the second switch and the third switch to turn on, so that the second plate of the capacitor is connected to the second end of the transmitting coil.
[0021] In some embodiments, when the processor executes the step of "the processor determines the quality factor of the transmitting coil according to the n-1th amplitude and the nth amplitude among the multiple amplitudes of the oscillating electrical signal", it can be specifically: the processor determines the quality factor of the transmitting coil according to the n-1th amplitude and the nth amplitude by the following formula:
[0022]
[0023]
[0024] Where Q is the quality factor of the transmitting coil, F((n-1)T) is the n-1th amplitude, F(nT) is the nth amplitude, π is pi, and ln( ) is the logarithm with the natural constant as the base.
[0025] In a second aspect, a stylus offset detection method is provided. The stylus offset detection method is applied to an electronic device, and includes the following steps: a processor receives a first signal value output by a first Hall sensor and a second signal value output by a second Hall sensor; if the processor determines that a stylus offset occurs based on the first signal value and the second signal value, a reminder message is output. The reminder message is used to remind that a stylus offset occurs. The stylus offset refers to the fact that the adsorption position of the stylus adsorbed on the electronic device is offset to the left or right relative to a preset adsorption position.
[0026] In some embodiments, the stylus deviation detection method may further include the following step: detecting the quality factor of the transmitting coil.
[0027] In this case, when the processor executes the step of "if the processor determines that the stylus offset occurs based on the first signal value and the second signal value, then outputting a reminder message", it can specifically be: if the processor determines that the stylus offset occurs based on the first signal value, the second signal value and the quality factor of the transmitting coil, then outputting a reminder message.
[0028] In some embodiments, the reminder information is further used to remind the user to move the stylus pen in the opposite direction of the offset direction.
[0029] According to a third aspect, an electronic device is provided. The electronic device includes a transmitting coil, a first Hall sensor, a second Hall sensor, a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, a method according to any one of the first and second aspects is implemented.
[0030] In a fourth aspect, an electronic device is provided, the electronic device comprising a transmitting coil, a first Hall sensor, a second Hall sensor, a memory, a processor, and a computer program stored in the memory and executable on the processor. The first Hall sensor can detect the magnetic induction intensity and direction of the position and output a first signal value, and the first signal value is used to characterize the magnetic induction intensity and direction of the position where the first Hall sensor is located. The second Hall sensor can detect the magnetic induction intensity and direction of the position and output a second signal value, and the second signal value is used to characterize the magnetic induction intensity and direction of the position where the second Hall sensor is located. The processor is used to receive the first signal value and the second signal value.
[0031] In some embodiments, when the computer program is executed by a processor, the processor detects a quality factor of the transmitting coil.
[0032] The technical effects obtained by the above-mentioned second aspect, third aspect and fourth aspect are similar to the technical effects obtained by the corresponding technical means in the above-mentioned first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 This is a schematic diagram of an application scenario of an electronic device and a stylus provided in an embodiment of the present application;
[0034] Figure 2 is a schematic diagram of an adsorption scenario of an electronic device and a stylus provided in an embodiment of the present application;
[0035] Figure 3 This is a schematic diagram of the positional relationship between the first electronic device and the stylus provided in an embodiment of the present application;
[0036] Figure 4 This is a schematic diagram of the adsorption relationship between the first electronic device and the stylus provided in the embodiment of the present application;
[0037] Figure 5 is a schematic diagram of the positional relationship between a second electronic device and a stylus provided in an embodiment of the present application;
[0038] Figure 6 is a schematic diagram of the adsorption relationship between the second electronic device and the stylus provided in an embodiment of the present application;
[0039] Figure 7 is a schematic diagram of the positional relationship between a third electronic device and a stylus provided in an embodiment of the present application;
[0040] Figure 8 is a schematic diagram of the adsorption relationship between a third electronic device and a stylus provided in an embodiment of the present application;
[0041] Fig. 9 is a schematic diagram of the positional relationship between a fourth electronic device and a stylus provided in an embodiment of the present application;
[0042] Fig.10 is a schematic diagram of the adsorption relationship between the fourth electronic device and the stylus provided in an embodiment of the present application;
[0043] Fig.11 is a schematic diagram of the positional relationship between a fifth electronic device and a stylus provided in an embodiment of the present application;
[0044] Fig.12 is a schematic diagram of the adsorption relationship between the fifth electronic device and the stylus provided in an embodiment of the present application;
[0045] Fig.13 is a schematic diagram of the positional relationship between a sixth electronic device and a stylus provided in an embodiment of the present application;
[0046] Fig.14 is a schematic diagram of the adsorption relationship between the sixth electronic device and the stylus provided in an embodiment of the present application;
[0047] Fig.15 is a schematic diagram of the positional relationship between a seventh electronic device and a stylus provided in an embodiment of the present application;
[0048] Fig.16 is a schematic diagram of the adsorption relationship between the seventh electronic device and the stylus provided in an embodiment of the present application;
[0049] Fig.17 is a schematic diagram of the positional relationship between an eighth electronic device and a stylus provided in an embodiment of the present application;
[0050] Fig.18 is a schematic diagram of the adsorption relationship between an eighth electronic device and a stylus provided in an embodiment of the present application;
[0051] Fig.19 is a schematic diagram of the positional relationship between a ninth electronic device and a stylus provided in an embodiment of the present application;
[0052] Fig. 20 is a schematic diagram of the adsorption relationship between a ninth electronic device and a stylus provided in an embodiment of the present application;
[0053] Fig.21 is a schematic diagram of the positional relationship between a tenth electronic device and a stylus provided in an embodiment of the present application;
[0054] Fig. 22 is a schematic diagram of the adsorption relationship between the tenth electronic device and the stylus provided in the embodiment of the present application;
[0055] Fig.23 is a schematic diagram of the positional relationship between an eleventh electronic device and a stylus provided in an embodiment of the present application;
[0056] Fig.24 is a schematic diagram of the adsorption relationship between an eleventh electronic device and a stylus provided in an embodiment of the present application;
[0057] Fig.25 is a schematic diagram of the positional relationship between a twelfth electronic device and a stylus provided in an embodiment of the present application;
[0058] Fig.26 is a schematic diagram of the adsorption relationship between a twelfth electronic device and a stylus provided in an embodiment of the present application;
[0059] Fig. 27 is a schematic diagram of the positional relationship between a thirteenth electronic device and a stylus provided in an embodiment of the present application;
[0060] Fig.28is a schematic diagram of the adsorption relationship between the thirteenth electronic device and the stylus provided in the embodiment of the present application;
[0061] Fig.29 is a schematic diagram of the positional relationship between a fourteenth electronic device and a stylus provided in an embodiment of the present application;
[0062] Fig.30 is a schematic diagram of the adsorption relationship between the fourteenth electronic device and the stylus provided in the embodiment of the present application;
[0063] Fig.31 It is a module structure diagram of a first electronic device provided in an embodiment of the present application;
[0064] Fig.32 is a circuit structure diagram of an electronic device provided in an embodiment of the present application;
[0065] Fig.33 It is a schematic diagram of an orientation provided in an embodiment of the present application;
[0066] Fig.34 is a waveform diagram of an oscillating electrical signal provided in an embodiment of the present application;
[0067] Fig.35 is a schematic structural diagram of a third adsorption magnet provided in an embodiment of the present application;
[0068] Fig.36 is a flow chart of a first stylus deviation detection method provided in an embodiment of the present application;
[0069] Fig.37 is a flow chart of a second stylus deviation detection method provided in an embodiment of the present application;
[0070] Fig.38 is a schematic diagram of a first prompt screen provided in an embodiment of the present application;
[0071] Fig.39 is a schematic diagram of a second first prompt screen provided in an embodiment of the present application;
[0072] Fig.40 is a schematic diagram of a first second prompt screen provided in an embodiment of the present application;
[0073] Fig.41 is a schematic diagram of a second prompt screen provided in an embodiment of the present application;
[0074] Fig.42 is a flow chart of a third stylus deviation detection method provided in an embodiment of the present application;
[0075] Fig.43 is a flow chart of a fourth stylus deviation detection method provided in an embodiment of the present application;
[0076] Fig.44 It is a module structure diagram of the second electronic device provided in an embodiment of the present application.
[0077] The meanings of the figures are as follows:
[0078] 10. Electronic equipment;
[0079] 102. Camera;
[0080] 104. Contact surface;
[0081] 110. Transmitting coil;
[0082] 122. A first Hall sensor;
[0083] 124. A second Hall sensor;
[0084] 130. A first adsorption magnet;
[0085] 132. The first sub-magnet;
[0086] 134, second sub-magnet;
[0087] 140. A second adsorption magnet;
[0088] 142. The third sub-magnet;
[0089] 144. The fourth sub-magnet;
[0090] 150. Processor;
[0091] 152. a first sub-processor;
[0092] 154. A second sub-processor;
[0093] 160. Memory;
[0094] 20. Stylus;
[0095] 202, metal frame;
[0096] 210, receiving coil;
[0097] 220. Detection magnet;
[0098] 230, third adsorption magnet;
[0099] 232. The fifth sub-magnet;
[0100] 234, the sixth sub-magnet;
[0101] 240, fourth adsorption magnet;
[0102] 242, the seventh sub-magnet;
[0103] 244. The eighth sub-magnet. DETAILED DESCRIPTION
[0104] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0105] It should be understood that the "multiple" mentioned in this application refers to two or more. In the description of this application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in order to facilitate the clear description of the technical solution of this application, the words "first" and "second" are used to distinguish between the same items or similar items with basically the same functions and effects. Those skilled in the art can understand that the words "first" and "second" do not limit the quantity and execution order, and the words "first" and "second" do not limit them to be different.
[0106] Before explaining the stylus deviation detection method provided in the embodiment of the present application in detail, the application scenario of the stylus deviation detection method is first explained.
[0107] Figure 1 1 is a schematic diagram of an application scenario of an electronic device 10 and a stylus pen 20 provided in an embodiment of the present application. Figure 1 As shown, an electronic device 10 such as a tablet computer that can input information by touch can be equipped with a stylus 20. A user can input information such as text and graphics on the electronic device 10 by using the stylus 20. Figure 2 Schematic diagram of an adsorption scene of an electronic device 10 and a stylus 20 provided in an embodiment of the present application. Figure 2 As shown, the stylus pen 20 can be adsorbed on the electronic device 10 .
[0108] Figure 3 is a schematic diagram of the positional relationship between an electronic device 10 and a stylus pen 20 provided in an embodiment of the present application. Figure 4 is a schematic diagram of an adsorption relationship between an electronic device 10 and a stylus pen 20 provided in an embodiment of the present application. Figure 4 The devices shown in the figure are Figure 3 Devices in region A. Figure 3 and Figure 4As shown, the electronic device 10 includes a transmitting coil 110, a first Hall sensor 122, a second Hall sensor 124, a first adsorption magnet 130 and a second adsorption magnet 140. The first adsorption magnet 130 includes a first sub-magnet 132 and a second sub-magnet 134. The second adsorption magnet 140 includes a third sub-magnet 142 and a fourth sub-magnet 144. The stylus 20 includes a receiving coil 210, a detection magnet 220, a third adsorption magnet 230 and a fourth adsorption magnet 240. The third adsorption magnet 230 includes a fifth sub-magnet 232 and a sixth sub-magnet 234. The fourth adsorption magnet 240 includes a seventh sub-magnet 242 and an eighth sub-magnet 244. The first adsorption magnet 130, the second adsorption magnet 140, the third adsorption magnet 230 and the fourth adsorption magnet 240 all use a Halbach Array to enhance the adsorption force. A transverse magnet is also provided between the two sub-magnets in each adsorption magnet. The detection magnet 220 in the stylus 20 is a separate magnet. In the following description, the relative position of the first Hall sensor 122 and the transmitting coil 110 is defined as: the first Hall sensor 122 is located on the left side of the transmitting coil 110. In this case, the second Hall sensor 124 is located on the right side of the transmitting coil 110. At the same time, in the embodiment of the present application, for ease of understanding, the "left" in the text description is the same direction as the left direction along the paper direction in the drawings, and the "right" in the text description is the same direction as the right direction along the paper direction in the drawings.
[0109] After the stylus pen 20 is adsorbed at the correct position on the electronic device 10, the transmitting coil 110 in the electronic device 10 and the receiving coil 210 in the stylus pen 20 can transmit electric energy, so that the electronic device 10 can charge the stylus pen 20. The correct position here refers to the preset adsorption position of the stylus pen 20 adsorbed on the electronic device 10. At the preset adsorption position, the adsorption positions of the electronic device 10 and the stylus pen 20 are not offset. In the embodiment of the present application, the preset adsorption position includes the following two different situations.
[0110] (A) In the first case, if Figure 3 and Figure 4 As shown, when the tip of the stylus pen 20 faces left, the first sub-magnet 132 and the fifth sub-magnet 232 are attracted to each other, the second sub-magnet 134 and the sixth sub-magnet 234 are attracted to each other, the third sub-magnet 142 and the seventh sub-magnet 242 are attracted to each other, and the fourth sub-magnet 144 and the eighth sub-magnet 244 are attracted to each other. When the adsorption relationship between the electronic device 10 and the stylus pen 20 is as shown in FIG. Figure 4As shown, the transmitting coil 110 and the receiving coil 210 are located at corresponding positions, and the first Hall sensor 122 and the detecting magnet 220 are located at corresponding positions. In this case, the detecting magnet 220 triggers the first Hall sensor 122, and at this time, the transmitting coil 110 in the electronic device 10 outputs electric energy, and the receiving coil 210 in the stylus 20 can receive electric energy, so that the electronic device 10 can wirelessly charge the stylus 20.
[0111] (B) In the second case, Figure 5 2 is a schematic diagram of the position relationship between another electronic device 10 and a stylus pen 20 provided in an embodiment of the present application, wherein the adsorption relationship between the electronic device 10 and the stylus pen 20 is as shown in FIG. Figure 6 As shown. Figure 5 and Figure 6 As shown, when the tip of the stylus pen 20 faces right, the first sub-magnet 132 and the eighth sub-magnet 244 are attracted to each other, the second sub-magnet 134 and the seventh sub-magnet 242 are attracted to each other, the third sub-magnet 142 and the sixth sub-magnet 234 are attracted to each other, and the fourth sub-magnet 144 and the fifth sub-magnet 232 are attracted to each other. When the adsorption relationship between the electronic device 10 and the stylus pen 20 is as shown in FIG. Figure 6 As shown, the transmitting coil 110 and the receiving coil 210 are located at corresponding positions, and the second Hall sensor 124 and the detecting magnet 220 are located at corresponding positions. In this case, the detecting magnet 220 triggers the second Hall sensor 124, and at this time, the transmitting coil 110 in the electronic device 10 outputs electric energy, and the receiving coil 210 in the stylus 20 can receive electric energy, so that the electronic device 10 can wirelessly charge the stylus 20.
[0112] Since the user cannot know the specific positions of the transmitting coil 110 and the receiving coil 210, when the user attaches the stylus pen 20 to the electronic device 10, the user will subconsciously place the stylus pen 20 in the middle of the electronic device 10 based on general usage habits. Figure 3 and Figure 5 As shown, since the camera 102 is disposed in the middle of the electronic device 10, the transmitting coil 110, the first adsorption magnet 130 and the second adsorption magnet 140 are usually disposed at the left (not shown) or right position in the electronic device 10. In this case, the adsorption position of the stylus pen 20 on the electronic device 10 may be offset. In addition, even if the user knows that the stylus pen 20 should be adsorbed at the left or right position of the electronic device 10, the user cannot accurately determine the adsorption position of the stylus pen 20 due to the lack of clear position prompts, which may easily lead to the emission of the adsorption position offset of the stylus pen 20 on the electronic device 10.
[0113] Twelve possible situations of adsorption position deviation that may occur when the stylus pen 20 is adsorbed on the electronic device 10 are described below.
[0114] (1) In the first case, if Figure 7 and Figure 8 As shown, the tip of the stylus pen 20 faces left, and the adsorption force mainly comes from the third sub-magnet 142 and the sixth sub-magnet 234 that attract each other.
[0115] (2) In the second case, if Fig. 9 and Fig.10 As shown, the tip of the stylus pen 20 faces left, and the adsorption force mainly comes from the second sub-magnet 134 and the seventh sub-magnet 242 that attract each other.
[0116] (3) In the third case, if Fig.11 and Fig.12 As shown, the tip of the stylus pen 20 faces left, and the adsorption force mainly comes from the fourth sub-magnet 144 and the fifth sub-magnet 232 that attract each other.
[0117] (4) In the fourth case, if Fig.13 and Fig.14 As shown, the tip of the stylus pen 20 faces left, and the adsorption force mainly comes from the first sub-magnet 132 and the eighth sub-magnet 244 that attract each other.
[0118] (5) In the fifth case, if Fig.15 and Fig.16 As shown, the tip of the stylus pen 20 faces left, and the adsorption force mainly comes from the third adsorption magnet 230 and the transmitting coil 110 that attract each other, and the second adsorption magnet 140 and the receiving coil 210 that attract each other.
[0119] (6) In the sixth case, if Fig.17 and Fig.18 As shown, the tip of the stylus pen 20 faces left, and the adsorption force mainly comes from the first adsorption magnet 130 and the receiving coil 210 that attract each other, and the fourth adsorption magnet 240 and the transmitting coil 110 that attract each other.
[0120] (7) In the seventh case, if Fig.19 and Fig. 20 As shown, the tip of the stylus pen 20 faces right, and the adsorption force mainly comes from the second sub-magnet 134 and the sixth sub-magnet 234 that attract each other.
[0121] (8) In the eighth case, if Fig.21 and Fig. 22 As shown, the tip of the stylus pen 20 faces rightward, and the adsorption force mainly comes from the third sub-magnet 142 and the seventh sub-magnet 242 that attract each other.
[0122] (9) In the ninth case, if Fig.23 and Fig.24As shown, the tip of the stylus pen 20 faces rightward, and the adsorption force mainly comes from the first sub-magnet 132 and the fifth sub-magnet 232 that attract each other.
[0123] (10) In the tenth case, if Fig.25 and Fig.26 As shown, the tip of the stylus pen 20 faces right, and the adsorption force mainly comes from the fourth sub-magnet 144 and the eighth sub-magnet 244 that attract each other.
[0124] (11) In the eleventh case, if Fig. 27 and Fig.28 As shown, the tip of the stylus pen 20 faces rightward, and the adsorption force mainly comes from the first adsorption magnet 130 and the receiving coil 210 that attract each other, and the third adsorption magnet 230 and the transmitting coil 110 that attract each other.
[0125] (12) In the twelfth case, if Fig.29 and Fig.30 As shown, the tip of the stylus pen 20 faces right, and the adsorption force mainly comes from the fourth adsorption magnet 240 and the transmitting coil 110 that attract each other, and the second adsorption magnet 140 and the receiving coil 210 that attract each other.
[0126] See also Figures 7 to 30 It can be seen that when the adsorption position of the stylus pen 20 on the electronic device 10 is offset, the transmitting coil 110 and the receiving coil 210 are not in corresponding positions, which will affect the electronic device 10 charging the stylus pen 20. Based on this, the present application provides a stylus pen 20 offset detection method and an electronic device 10, which can detect whether the adsorption position of the stylus pen 20 on the electronic device 10 is offset.
[0127] In the embodiment of the present application, the adsorption force between the electronic device 10 and the stylus 20 is simulated and analyzed for two cases in the preset adsorption position and twelve cases in the above adsorption position offset, and the simulation results are shown in Table 1. The unit of the adsorption force in Table 1 is Newton (N).
[0128] Table 1
[0129]
[0130]
[0131] According to Table 1, when the adsorption positions of the electronic device 10 and the stylus pen 20 are not offset, the adsorption force between the electronic device 10 and the stylus pen 20 is the largest, and is much larger than the twelve cases where the adsorption positions are offset, which is 1.9178 N. For two cases with different pen tip orientations but the same actual adsorption relationship, such as cases (1) and (7), cases (2) and (8) ... cases (6) and (12), the adsorption force between the electronic device 10 and the stylus pen 20 is also the same. The difference in adsorption force between different cases is also affected by the detection magnet 220.
[0132] According to Table 1, when the adsorption positions of the electronic device 10 and the stylus 20 are offset, there is also an adsorption force between the electronic device 10 and the stylus 20. In the four cases (3), (4), (9), and (10), since the adsorption position offset of the electronic device 10 and the stylus 20 is the most serious, the adsorption force between the electronic device 10 and the stylus 20 is also relatively small, so the user can clearly feel that the adsorption position of the stylus 20 on the electronic device 10 is offset. Based on this, the stylus 20 offset detection method provided in the embodiment of the present application mainly performs adsorption position offset detection for the eight cases (1), (2), (5), (6), (7), (8), (11), and (12).
[0133] First, the electrical structure of the electronic device 10 to which the stylus 20 offset detection method provided in the embodiment of the present application is applied is described. In the embodiment of the present application, the connection between the two electronic devices is an electrical connection, where the electrical connection refers to the transmission of electrical signals between the two electronic devices through the connection. The electrical connection between the two electronic devices can be a direct connection through a wire or an indirect connection through other electronic devices.
[0134] Fig.31 1 is a module structure diagram of an electronic device 10 provided in an embodiment of the present application. Fig.31 As shown, the electronic devices in the electronic device 10 may include a first Hall sensor 122 , a second Hall sensor 124 , a transmitting coil 110 , and a processor 150 .
[0135] The Hall sensor (including the first Hall sensor 122 and the second Hall sensor 124) is a magnetic field sensor made according to the Hall effect, which can be used to detect the magnetic induction intensity and direction of the location where the Hall sensor is located. In the embodiment of the present application, the first Hall sensor 122 can output a first signal value when working, and the first signal value is used to characterize the magnetic induction intensity and direction of the location where the first Hall sensor 122 is located. The second Hall sensor 124 can output a second signal value when working, and the second signal value is used to characterize the magnetic induction intensity and direction of the location where the second Hall sensor 124 is located.
[0136] The transmitting coil 110 may include ferrite and a metal wire wound around the ferrite. The electronic device 10 may output an electrical signal through the transmitting coil 110 , thereby charging the stylus pen 20 or / and communicating with the stylus pen 20 .
[0137] The first Hall sensor 122 and the second Hall sensor 124 are both connected to the processor 150, so that the processor 150 can receive the first signal value output by the first Hall sensor 122 and the second signal value output by the second Hall sensor 124. The processor 150 is also connected to the transmitting coil 110, so that the processor 150 can output an electrical signal to the transmitting coil 110 and can detect the electrical signal in the transmitting coil 110. As a possible embodiment, the processor 150 may have a first end, a second end, and a third end. The first end of the processor 150 is connected to the first Hall sensor 122, the second end of the processor 150 is connected to the transmitting coil 110, and the third end of the processor 150 is connected to the second Hall sensor 124.
[0138] It is understood that in the embodiment of the present application, the processor 150 refers to an integrated circuit with a processing function, and the processor 150 is not limited to a chip formed by packaging. Fig.32 1 is a circuit diagram of an electronic device 10 provided in an embodiment of the present application. Fig.32 As shown, in some embodiments, the processor 150 may include a first sub-processor 152 and a second sub-processor 154 connected to each other. The first sub-processor 152 may be packaged together with the first switch Q1, the second switch Q2, the third switch Q3, and the fourth switch Q4 to form a transmission (transport, TX) chip in the electronic device 10. The second sub-processor 154 may be a system on chip (SOC) in the electronic device 10. The SOC includes a central processing unit 150 (CPU), a graphics processing unit 150 (GPU), a baseband, etc. Fig.32 The illustrated embodiment is not intended to limit the locations of the various electronic components.
[0139] In some embodiments, Fig.32As shown, the first Hall sensor 122 and the second Hall sensor 124 are both connected to the first sub-processor 152. The electronic device 10 also includes a capacitor C. The first plate of the capacitor C is connected to the first end of the transmitting coil 110, and the first end of the transmitting coil 110 is connected to the first sub-processor 152. The first switch Q1, the second switch Q2, the third switch Q3, and the fourth switch Q4 are all three-terminal switch devices, that is, the first switch Q1, the second switch Q2, the third switch Q3, and the fourth switch Q4 all have a first end, a second end, and a control end. The first end of the first switch Q1 and the first end of the fourth switch Q4 are both used to connect to the positive electrode of the power supply, and the second end of the first switch Q1 is connected to the second plate of the capacitor C and the first end of the second switch Q2. The second end of the fourth switch Q4 and the first end of the third switch Q3 are both connected to the second end of the transmitting coil 110, and the second end of the second switch Q2 and the second end of the third switch Q3 are both used to connect to the negative electrode of the power supply. Fig.32 In the illustrated embodiment, the positive pole of the power supply is represented by the symbol “+”, and the negative pole of the power supply is represented by the symbol “-”. The first sub-processor 152 may also be connected to the control terminals of the first switch Q1, the second switch Q2, the third switch Q3, and the fourth switch Q4 (the connection relationship is not shown in the figure) to control the on and off of the first switch Q1, the second switch Q2, the third switch Q3, and the fourth switch Q4.
[0140] The principle of the stylus pen 20 deviation detection method provided in the embodiment of the present application is described below. Here, the principle of the stylus pen 20 deviation detection method includes two steps: "determining the possible deviation direction of the adsorption position of the stylus pen 20 on the electronic device 10 according to the first signal value output by the first Hall sensor 122 and the second signal value output by the second Hall sensor 124" and "determining whether the adsorption position of the stylus pen 20 on the electronic device 10 is deflected according to the quality factor of the transmitting coil 110".
[0141] Step 1: determining a possible deviation direction of the adsorption position of the stylus pen 20 on the electronic device 10 according to the first signal value output by the first Hall sensor 122 and the second signal value output by the second Hall sensor 124 .
[0142] As mentioned above, the first Hall sensor 122 and the second Hall sensor 124 can be used to detect the magnetic induction intensity and direction of the position. In the embodiment of the present application, the magnetic induction intensity and direction detected by the first Hall sensor 122 and the magnetic induction intensity and direction detected by the second Hall sensor 124 are statistically analyzed for the two cases in the preset adsorption position and the twelve cases in the above-mentioned adsorption position offset, and the specific data are as follows.
[0143] For the situations where the tip of the stylus pen 20 is facing left, namely, situation (A) in the preset adsorption position and situations (1), (2), (3), (4), (5), and (6) in the adsorption position offset, the magnetic induction intensity and direction detected by the first Hall sensor 122 and the magnetic induction intensity and direction detected by the second Hall sensor 124 are shown in Table 2 below.
[0144] Table 2
[0145]
[0146]
[0147] The unit of magnetic induction intensity is millitesla (mT). Fig.33 As shown, direction X refers to the direction from the transmitting coil 110 to the second Hall sensor 124, that is, the direction along the right side of the paper. Direction Y refers to the direction from the display screen of the electronic device 10 to the back of the electronic device 10, that is, the direction perpendicular to the paper and inward. In this embodiment, the electronic device 10 also has a contact surface 104. The contact surface 104 can be a frame of the electronic device 10. The stylus 20 is in contact with the contact surface 104 when it is adsorbed on the electronic device 10. Direction Z refers to the direction perpendicular to the contact surface 104 and pointing to the inside of the electronic device 10, that is, the direction downward along the paper. X, Y, and Z are perpendicular to each other. Fig.33 In the illustrated embodiment, the reference numeral "10" points to the electronic device through a curved indexing line, and the reference numeral "104" points to the surface of the electronic device through a curved indexing line with an arrow.
[0148] In different situations in Table 2, for any one of the X, Y, and Z directions, when the magnetic induction intensity is a positive value, it indicates that the magnetic induction direction of the position where the Hall sensor is located is along this direction; when the magnetic induction intensity is a negative value, it indicates that the magnetic induction direction of the position where the Hall sensor is located is along the opposite direction of this direction. For example, in situation (A), the first Hall sensor 122 detects a magnetic induction intensity of 37.358 mT along the Z direction, and the second Hall sensor 124 detects a magnetic induction intensity of 0.61303 mT in the opposite direction of the X direction. In situation (5), the first Hall sensor 122 detects a magnetic induction intensity of 0.54061 mT in the opposite direction of the Z direction, and the second Hall sensor 124 detects a magnetic induction intensity of 91.95 mT in the Z direction.
[0149] According to Table 2, in the case of the preset adsorption position (A), the first Hall sensor 122 is acted upon by the north (north, N) pole of the detection magnet 220, and detects a large magnetic induction intensity along the Z direction, and the magnetic induction intensity in the X direction and the Y direction are very small. The magnetic induction intensity in the X direction, the Y direction, and the Z direction detected by the second Hall sensor 124 are all very small.
[0150] In the case (1) of the adsorption position shift, the second Hall sensor 124 is located near the seventh sub-magnet 242, and is affected by the south (S) pole of the seventh sub-magnet 242, and detects a large magnetic induction intensity in the opposite direction along the Z direction, and a very small magnetic induction intensity in the Y direction. In addition, affected by the transverse magnet between the seventh sub-magnet 242 and the eighth sub-magnet 244, the second Hall sensor 124 also detects a large magnetic induction intensity in the opposite direction along the X direction. The magnetic induction intensities in the X direction, Y direction, and Z direction detected by the first Hall sensor 122 are all very small.
[0151] In the case (2) of the adsorption position shift, the first Hall sensor 122 is located near the sixth sub-magnet 234, and under the action of the S pole of the sixth sub-magnet 234, it detects a large magnetic induction intensity in the opposite direction along the Z direction, and a very small magnetic induction intensity in the Y direction. In addition, under the action of the transverse magnet between the fifth sub-magnet 232 and the sixth sub-magnet 234, the first Hall sensor 122 also detects a large magnetic induction intensity in the X direction. The magnetic induction intensities in the X, Y, and Z directions detected by the second Hall sensor 124 are all very small.
[0152] In the case (3) of the adsorption position deviation, the second Hall sensor 124 is located between the third adsorption magnet 230 and the fourth adsorption magnet 240. In this case, the magnetic induction intensities in the X, Y, and Z directions detected by the second Hall sensor 124 are all very small. The magnetic induction intensities in the X, Y, and Z directions detected by the first Hall sensor 122 are all very small.
[0153] In the case (4) of the adsorption position deviation, the first Hall sensor 122 is located between the third adsorption magnet 230 and the fourth adsorption magnet 240. In this case, the magnetic induction intensities in the X, Y, and Z directions detected by the first Hall sensor 122 are all very small. The magnetic induction intensities in the X, Y, and Z directions detected by the second Hall sensor 124 are all very small.
[0154] In the case of the adsorption position shift (5), the second Hall sensor 124 is located near the eighth sub-magnet 244, and is affected by the N pole of the eighth sub-magnet 244, detecting a large magnetic induction intensity along the Z direction, and a very small magnetic induction intensity along the Y direction. In addition, affected by the transverse magnet between the seventh sub-magnet 242 and the eighth sub-magnet 244, the second Hall sensor 124 also detects a large magnetic induction intensity in the opposite direction of the X direction. The magnetic induction intensities detected by the first Hall sensor 122 in the X direction, the Y direction, and the Z direction are all very small.
[0155] In the case of the adsorption position shift (6), the first Hall sensor 122 is located near the fifth sub-magnet 232, and is affected by the N pole of the fifth sub-magnet 232, and detects a large magnetic induction intensity along the Z direction, and a very small magnetic induction intensity in the Y direction. In addition, affected by the transverse magnet between the fifth sub-magnet 232 and the sixth sub-magnet 234, the first Hall sensor 122 also detects a large magnetic induction intensity along the X direction. The magnetic induction intensities in the X direction, Y direction, and Z direction detected by the second Hall sensor 124 are all very small.
[0156] According to the above description, except for the cases (3) and (4) of the adsorption position offset, other cases where the pen tip is facing left can be obtained by the magnetic induction intensity and direction detected by the first Hall sensor 122 and the magnetic induction intensity and direction detected by the second Hall sensor 124. As mentioned above, the stylus pen 20 offset detection method provided in the embodiment of the present application does not perform adsorption position offset detection for the cases (3) and (4) of the adsorption position offset. Therefore, the magnetic induction intensity and direction detected by the first Hall sensor 122 and the magnetic induction intensity and direction detected by the second Hall sensor 124 in cases (3) and (4) can be removed from Table 2, thereby obtaining the following Table 3.
[0157] Table 3
[0158]
[0159] Based on the five cases shown in Table 3, in some specific embodiments, the first Hall sensor 122 and the second Hall sensor 124 may be switch-type Hall sensors, and the threshold value of the switch-type Hall sensor may be 10 mT.
[0160] Specifically, when the first Hall sensor 122 is a switch type Hall sensor with a threshold value, if the magnetic induction intensity along the X direction at the location of the first Hall sensor 122 is greater than the threshold value, the first Hall sensor 122 outputs a signal value of 1 along the X direction. If the magnetic induction intensity along the opposite direction of the X direction at the location of the first Hall sensor 122 is greater than the threshold value, the first Hall sensor 122 outputs a signal value of -1 along the X direction. If the magnetic induction intensity along the X direction and the magnetic induction intensity along the opposite direction of the X direction at the location of the first Hall sensor 122 are both less than or equal to the threshold value, the first Hall sensor 122 outputs a signal value of 0 along the X direction. Similarly, if the magnetic induction intensity along the Z direction at the location of the first Hall sensor 122 is greater than the threshold value, the first Hall sensor 122 outputs a signal value of 1 along the Z direction. If the magnetic induction intensity along the opposite direction of the Z direction at the location of the first Hall sensor 122 is greater than the threshold value, the first Hall sensor 122 outputs a signal value of -1 along the Z direction. If the magnetic induction intensity in the Z direction and the magnetic induction intensity in the opposite direction of the Z direction at the position where the first Hall sensor 122 is located are both less than or equal to the threshold value, the signal value output by the first Hall sensor 122 in the Z direction is 0. The same is true for the Y direction, which will not be repeated.
[0161] Similarly, when the second Hall sensor 124 is a switch type Hall sensor with a threshold value, if the magnetic induction intensity along the Z direction at the position where the second Hall sensor 124 is located is greater than the threshold value, the second Hall sensor 124 outputs a signal value along the Z direction of 1. If the magnetic induction intensity along the opposite direction of the Z direction at the position where the second Hall sensor 124 is located is greater than the threshold value, the second Hall sensor 124 outputs a signal value along the Z direction of -1. If the magnetic induction intensity along the Z direction and the magnetic induction intensity along the opposite direction of the Z direction at the position where the second Hall sensor 124 is located are both less than or equal to the threshold value, the second Hall sensor 124 outputs a signal value along the Z direction of 0. The same is true for the X direction and the Y direction, which will not be repeated.
[0162] Based on this, when the threshold values of the first Hall sensor 122 and the second Hall sensor 124 are both 10 mT, the above Table 3 can be simplified to the following Table 4.
[0163] Table 4
[0164]
[0165] According to Table 4, in the five cases (A), (1), (2), (5), and (6), different cases can be distinguished only by the signal value outputted by the first Hall sensor 122 along the Z direction and the signal value outputted by the second Hall sensor 124 along the Z direction. Therefore, the first Hall sensor 122 and the second Hall sensor 124 can be further simplified to single-axis switch Hall sensors. That is, the first Hall sensor 122 and the second Hall sensor 124 no longer detect the magnetic induction intensity in the X direction and the Y direction, but only detect the magnetic induction intensity in the Z direction, and output signal values of -1, 0, and 1 according to the magnetic induction intensity in the Z direction and the threshold value. In this case, the signal value along the Z direction outputted by the first Hall sensor 122 is called the first signal value, and the signal value along the Z direction outputted by the second Hall sensor 124 is called the second signal value, and Table 4 can be further simplified to the following Table 5.
[0166] Table 5
[0167]
[0168] Similarly, for the various situations in which the tip of the stylus pen 20 is facing right, namely, situation (B) in the preset adsorption position and situations (7), (8), (9), (10), (11), and (12) in the adsorption position offset, the magnetic induction intensity and direction detected by the first Hall sensor 122 and the magnetic induction intensity and direction detected by the second Hall sensor 124 are shown in Table 6 below.
[0169] Table 6
[0170]
[0171] According to Table 6, in the case of the preset adsorption position (B), the second Hall sensor 124 is acted upon by the N pole of the detection magnet 220, and detects a large magnetic induction intensity along the Z direction, and the magnetic induction intensity in the X direction and the Y direction are very small. The magnetic induction intensity in the X direction, the Y direction, and the Z direction detected by the first Hall sensor 122 are all very small.
[0172] In the case of the adsorption position shift (7), the first Hall sensor 122 is located near the seventh sub-magnet 242, and under the action of the south pole of the seventh sub-magnet 242, it detects a large magnetic induction intensity in the opposite direction along the Z direction, and a very small magnetic induction intensity in the Y direction. In addition, under the action of the transverse magnet between the seventh sub-magnet 242 and the eighth sub-magnet 244, the first Hall sensor 122 also detects a large magnetic induction intensity in the opposite direction along the X direction. The magnetic induction intensities detected by the second Hall sensor 124 in the X direction, the Y direction, and the Z direction are all very small.
[0173] In the case of the adsorption position shift (8), the second Hall sensor 124 is located near the sixth sub-magnet 234, and under the action of the S pole of the sixth sub-magnet 234, it detects a large magnetic induction intensity in the opposite direction along the Z direction, and a very small magnetic induction intensity in the Y direction. In addition, under the action of the transverse magnet between the fifth sub-magnet 232 and the sixth sub-magnet 234, the second Hall sensor 124 also detects a large magnetic induction intensity in the X direction. The magnetic induction intensities in the X direction, Y direction, and Z direction detected by the first Hall sensor 122 are all very small.
[0174] In the case of the adsorption position deviation (9), the first Hall sensor 122 is located between the third adsorption magnet 230 and the fourth adsorption magnet 240. In this case, the magnetic induction intensities in the X, Y, and Z directions detected by the first Hall sensor 122 are all very small. The magnetic induction intensities in the X, Y, and Z directions detected by the second Hall sensor 124 are all very small.
[0175] In the case of the adsorption position shift (10), the second Hall sensor 124 is located between the third adsorption magnet 230 and the fourth adsorption magnet 240. In this case, the magnetic induction intensities in the X, Y, and Z directions detected by the second Hall sensor 124 are all very small. The magnetic induction intensities in the X, Y, and Z directions detected by the first Hall sensor 122 are all very small.
[0176] In the case of the adsorption position shift (11), the first Hall sensor 122 is located near the eighth sub-magnet 244, and is affected by the N pole of the eighth sub-magnet 244, detecting a large magnetic induction intensity along the Z direction, and a very small magnetic induction intensity in the Y direction. In addition, affected by the transverse magnet between the seventh sub-magnet 242 and the eighth sub-magnet 244, the first Hall sensor 122 also detects a large magnetic induction intensity in the opposite direction of the X direction. The magnetic induction intensities detected by the second Hall sensor 124 in the X direction, the Y direction, and the Z direction are all very small.
[0177] In the case of the adsorption position shift (12), the second Hall sensor 124 is located near the fifth sub-magnet 232, and is affected by the N pole of the fifth sub-magnet 232, and detects a large magnetic induction intensity along the Z direction, and a very small magnetic induction intensity in the Y direction. In addition, affected by the transverse magnet between the fifth sub-magnet 232 and the sixth sub-magnet 234, the second Hall sensor 124 also detects a large magnetic induction intensity along the X direction. The magnetic induction intensities in the X direction, Y direction, and Z direction detected by the first Hall sensor 122 are all very small.
[0178] According to the above description, except for the cases (9) and (10) of the adsorption position offset, other cases where the pen tip is facing right can be obtained by the magnetic induction intensity and direction detected by the first Hall sensor 122 and the magnetic induction intensity and direction detected by the second Hall sensor 124. As mentioned above, the stylus pen 20 offset detection method provided in the embodiment of the present application does not perform adsorption position offset detection for the cases (9) and (10) of the adsorption position offset. Therefore, the magnetic induction intensity and direction detected by the first Hall sensor 122 and the magnetic induction intensity and direction detected by the second Hall sensor 124 in the cases (9) and (10) can be removed from Table 6, thereby obtaining the following Table 7.
[0179] Table 7
[0180]
[0181] Based on the five cases shown in Table 7, similarly, the first Hall sensor 122 and the second Hall sensor 124 can be switch-type Hall sensors with a threshold value of 10 mT. In this case, the above Table 7 can be simplified to the following Table 8.
[0182] Table 8
[0183]
[0184] According to Table 8, in the five cases (B), (7), (8), (11), and (12), different cases can be distinguished only by the signal value along the Z direction output by the first Hall sensor 122 and the signal value along the Z direction output by the second Hall sensor 124. Therefore, the first Hall sensor 122 and the second Hall sensor 124 can be further simplified to single-axis switch-type Hall sensors. In this case, the signal value along the Z direction output by the first Hall sensor 122 is called the first signal value, and the signal value along the Z direction output by the second Hall sensor 124 is called the second signal value, and Table 8 can be further simplified to the following Table 9.
[0185] Table 9
[0186]
[0187]
[0188] According to the above description and the accompanying drawings, in the embodiment of the present application, the adsorption positions of case (A) and case (B) are preset adsorption positions, that is, the adsorption position of the stylus pen 20 on the electronic device 10 is not offset. In cases (1), (5), (8), and (12), the adsorption position of the stylus pen 20 on the electronic device 10 is offset to the right, and in cases (2), (6), (7), and (11), the adsorption position of the stylus pen 20 on the electronic device 10 is offset to the left. In this case, in combination with Table 5 and Table 9, the corresponding relationship between the signal value and the position indication information shown in Table 10 below can be obtained.
[0189] Table 10
[0190]
[0191] In Table 10, the symbol "×" indicates that the situation does not exist. That is, when the first Hall sensor 122 and the second Hall sensor 124 are both single-axis switch Hall sensors with a threshold value of 10 mT along the Z direction, if the first signal value output by the first Hall sensor 122 is -1 and the second signal value output by the second Hall sensor 124 is 0, it can be obtained that the adsorption position of the stylus pen 20 on the electronic device 10 is offset to the left relative to the preset adsorption position. If the first signal value output by the first Hall sensor 122 is 0 and the second signal value output by the second Hall sensor 124 is -1, it can be obtained that the adsorption position of the stylus pen 20 on the electronic device 10 is offset to the right relative to the preset adsorption position. If the first signal value output by the first Hall sensor 122 is 0 and the second signal value output by the second Hall sensor 124 is 1, it can be obtained that the adsorption position of the stylus pen 20 on the electronic device 10 is offset to the right relative to the preset adsorption position or is not offset. If the first signal value output by the first Hall sensor 122 is 1 and the second signal value output by the second Hall sensor 124 is 0, it can be obtained that the adsorption position of the stylus pen 20 on the electronic device 10 is offset to the left relative to the preset adsorption position or is not offset. For the case not present in Table 10 , it is possible that foreign objects with a magnetic field are close to the first Hall sensor 122 and the second Hall sensor 124 .
[0192] Thus, based on the correspondence between the signal value and the position indication information shown in Table 10, the possible offset direction of the adsorption position of the stylus 20 on the electronic device 10 can be determined according to the first signal value output by the first Hall sensor 122 and the second signal value output by the second Hall sensor 124 .
[0193] However, based only on the correspondence between the signal value and the position indication information shown in Table 10, when the first signal value is 0 and the second signal value is 1, it is impossible to determine whether the adsorption position of the stylus pen 20 on the electronic device 10 is offset to the right or not relative to the preset adsorption position; when the first signal value is 1 and the second signal value is 0, it is impossible to determine whether the adsorption position of the stylus pen 20 on the electronic device 10 is offset to the left or not relative to the preset adsorption position. Therefore, the stylus pen 20 offset detection method provided in the embodiment of the present application can further determine whether the adsorption position of the stylus pen 20 on the electronic device 10 is offset according to the quality factor of the transmitting coil 110.
[0194] Step 2: determining whether the adsorption position of the stylus pen 20 on the electronic device 10 is offset according to the quality factor of the transmitting coil 110 .
[0195] (1) A process of determining the quality factor of the transmitting coil 110.
[0196] The processor 150 is connected to the transmitting coil 110 so that the processor 150 can detect the electrical signal in the transmitting coil 110. In the embodiment of the present application, the processor 150 can detect the quality factor of the transmitting coil 110 by detecting the electrical signal in the transmitting coil 110. Fig.32 Taking the circuit structure of the electronic device 10 as an example, the first sub-processor 152 can detect the quality factor of the transmitting coil 110 by detecting the electrical signal in the transmitting coil 110 .
[0197] Specifically, when the first sub-processor 152 is working, the second switch Q2 and the fourth switch Q4 can be controlled to be turned off, and the first switch Q1 and the third switch Q3 can be turned on. At this time, a path can be formed starting from the positive electrode of the power supply, passing through the first switch Q1, the capacitor C, the transmitting coil 110 and the third switch Q3 and returning to the negative electrode of the power supply, so that the capacitor C and the transmitting coil 110 are charged.
[0198] When the capacitor C and the transmitting coil 110 are fully charged, a steady state is reached, at which point the capacitor C and the transmitting coil 110 cannot continue to charge. In this case, the first sub-processor 152 can control the first switch Q1 and the fourth switch Q4 to turn off, and the second switch Q2 and the third switch Q3 to turn on, so that the second plate of the capacitor C is connected to the second end of the transmitting coil 110 through the second switch Q2 and the third switch Q3. At this time, an oscillating electrical signal will be generated in the loop formed by the capacitor C, the transmitting coil 110, the second switch Q2 and the third switch Q3. Since the capacitor C has an equivalent series resistance, the wire also has resistance, and the metal near the transmitting coil 110 in the electronic device 10 and the stylus 20 will also generate eddy current loss, there is also impedance in the loop formed by the capacitor C, the transmitting coil 110, the second switch Q2 and the third switch Q3. In other words, the loop formed by the capacitor C, the transmitting coil 110, the second switch Q2 and the third switch Q3 is an inductor-capacitor-impedance (LCR) oscillation circuit. Based on this, the oscillating electrical signal will present a gradually attenuated waveform, such as Fig.34 As shown. Fig.34 The unit of the horizontal axis is "×10 -4 Seconds”, and the unit of the vertical axis is volt (V).
[0199] according to Fig.34 It can be seen that the gradually decaying oscillating electrical signal has multiple amplitudes. The first sub-processor 152 can detect the oscillating electrical signal and determine the quality factor of the transmitting coil 110 according to the n-1th amplitude and the nth amplitude among the multiple amplitudes of the oscillating electrical signal. Here, n is an integer greater than or equal to 2.
[0200] Specifically, after obtaining the n-1th amplitude and the nth amplitude among the multiple amplitudes of the oscillating electrical signal, the first sub-processor 152 can obtain the ratio of the n-1th amplitude to the nth amplitude by the following formula, that is:
[0201]
[0202] Where F((n-1)T) is the n-1th amplitude, F(nT) is the nth amplitude, S is the ratio of the n-1th amplitude to the nth amplitude, e is a natural constant, ξ is the conductivity, ω0 is the oscillation angular frequency, and T is the oscillation period.
[0203] In the LCR oscillation circuit, there is the following formula:
[0204]
[0205] Among them, R is the impedance value of the LCR oscillation circuit, C is the capacitance C value of the LCR oscillation circuit, L is the inductance value of the LCR oscillation circuit, π is pi, and w is the oscillation frequency.
[0206] Combining formula ① and formula ②, we can get:
[0207]
[0208] Where ln( ) is the logarithm with the natural constant as the base.
[0209] In the LCR oscillation circuit, the quality factor Q of the transmitting coil 110 (ie, the inductor) is:
[0210]
[0211] Combining formula ③ and formula ④, we can get:
[0212]
[0213] By transforming formula ⑤, we can get:
[0214]
[0215] In this way, after obtaining the n-1th amplitude and the nth amplitude among the multiple amplitudes of the oscillating electrical signal, the first sub-processor 152 can determine the quality factor of the transmitting coil 110 through formula ① and formula ⑥.
[0216] (2) Relationship between the quality factor of the transmitting coil 110 and the adsorption position of the stylus pen 20 on the electronic device 10 .
[0217] According to the above formula ④, in the electronic device 10, the quality factor of the transmitting coil 110 is only related to the inductance and impedance of the LCR oscillating circuit where the transmitting coil 110 is located. When the stylus pen 20 is attached to the electronic device 10, if the stylus pen 20 is attached to the preset attachment position on the electronic device 10, that is, when the situation (A) and the situation (B) occur, the inductance of the LCR oscillating circuit will increase, thereby increasing the quality factor of the transmitting coil 110. On the contrary, when the stylus pen 20 is attached to the electronic device 10, if the attachment position of the stylus pen 20 is offset, that is, when the situations (1), (2), (5), (6), (7), (8), (11), (12) occur, the impedance of the LCR oscillating circuit will increase, thereby reducing the quality factor of the transmitting coil 110.
[0218] Specifically, when the stylus pen 20 is adsorbed at the preset adsorption position on the electronic device 10, that is, when the situation (A) and the situation (B) occur, as shown in FIG. Figure 4 and Figure 6As shown, at this time, the receiving coil 210 and the transmitting coil 110 are in corresponding positions. Since the receiving coil 210 and the transmitting coil 110 are both metal wires wound on ferrite, when the transmitting coil 110 and the receiving coil 210 are in corresponding positions, the inductance of the transmitting coil 110 will increase, that is, the inductance of the LCR oscillation circuit will increase, thereby increasing the quality factor of the transmitting coil 110.
[0219] When the adsorption position of the stylus pen 20 on the electronic device 10 is offset, that is, when situations (1), (2), (5), (6), (7), (8), (11), and (12) occur, it can be seen from the accompanying drawings that at this time, the receiving coil 210 and the transmitting coil 110 are far apart, and the adsorption magnet in the stylus pen 20 is close to the transmitting coil 110. Fig.35 2 is a schematic diagram of the structure of a third adsorption magnet 230 provided in an embodiment of the present application. The structures of the first adsorption magnet 130, the second adsorption magnet 140, and the fourth adsorption magnet 240 are the same as the structure of the third adsorption magnet 230. Fig.35 As shown, the adsorption magnet using the Halbach array requires a metal frame 202 as a support structure for the magnet. In addition, the adsorption magnet itself also contains metal. Therefore, when the adsorption magnet in the stylus 20 is close to the transmitting coil 110, an eddy current effect will be generated. At this time, the metal frame 202 close to the transmitting coil 110 and the metal in the adsorption magnet will absorb energy, which is manifested as an increase in the impedance value of the LCR oscillation circuit, thereby reducing the quality factor of the transmitting coil 110.
[0220] Based on this, it can be determined whether the stylus pen 20 is offset according to the quality factor of the transmitting coil 110. Specifically, a first threshold and a second threshold can be preset in the first sub-processor 152. The first threshold is less than the second threshold. In addition, the setting of the first threshold and the second threshold can also meet the following conditions: when the stylus pen 20 is adsorbed at the preset adsorption position on the electronic device 10, that is, when the situation (A) and the situation (B) occur, the second threshold is less than the quality factor of the transmitting coil 110; when the adsorption position of the stylus pen 20 on the electronic device 10 is offset, that is, when the situation (1), (2), (5), (6), (7), (8), (11), (12) occurs, the first threshold is greater than the quality factor of the transmitting coil 110. In this case, if the stylus pen 20 is adsorbed on the electronic device 10, and the first sub-processor 152 detects that the quality factor of the transmitting coil 110 is greater than the second threshold, it can be determined that the stylus pen 20 is adsorbed at the preset adsorption position on the electronic device 10, that is, the stylus pen 20 is not offset. On the contrary, if the stylus pen 20 is adsorbed on the electronic device 10 and the first sub-processor 152 detects that the quality factor of the transmitting coil 110 is less than the first threshold, it can be determined that the adsorption position of the stylus pen 20 is shifted.
[0221] Combining the “first step” and “second step” in the principle of the stylus pen 20 offset detection method described above, not only can it be determined whether the adsorption position of the stylus pen 20 on the electronic device 10 is offset, but also the offset direction of the stylus pen 20 can be determined.
[0222] Based on the above principle, the present application embodiment provides a stylus 20 offset detection method, which is applied to Fig.31 or Fig.32 An electronic device 10 is shown. Fig.36 2 is a flow chart of a stylus 20 offset detection method provided in an embodiment of the present application. Fig.36 As shown, the stylus pen 20 deviation detection method includes the following steps S100 to S300.
[0223] S100 , the processor 150 receives a first signal value output by the first Hall sensor 122 and a second signal value output by the second Hall sensor 124 .
[0224] The first signal value is used to characterize the magnetic induction intensity and direction of the position where the first Hall sensor 122 is located, and the second signal value is used to characterize the magnetic induction intensity and direction of the position where the second Hall sensor 124 is located. Step S100 may have at least two different implementations as follows.
[0225] (i) In a first feasible implementation, the first Hall sensor 122 and the second Hall sensor 124 are both single-axis switch Hall sensors along a preset direction. The preset direction here refers to the Z direction. In this case, the first Hall sensor 122 and the second Hall sensor 124 both have threshold values. When the threshold value of the first Hall sensor 122 and the threshold value of the second Hall sensor 124 are both equal to the preset intensity (such as 10mT), then:
[0226] When the magnetic induction intensity of the first Hall sensor 122 along the Z direction at the location is greater than the preset intensity, the output first signal value is 1; when the magnetic induction intensity of the first Hall sensor 122 along the opposite direction of the Z direction at the location is greater than the preset intensity, the output first signal value is -1; when the magnetic induction intensity of the first Hall sensor 122 along the Z direction and the magnetic induction intensity along the opposite direction of the Z direction at the location are both less than or equal to the preset intensity, the output first signal value is 0.
[0227] Furthermore, when the magnetic induction intensity of the second Hall sensor 124 along the Z direction at the location is greater than the preset intensity, the output first signal value is 1; when the magnetic induction intensity of the second Hall sensor 124 along the opposite direction of the Z direction at the location is greater than the preset intensity, the output first signal value is -1; when the magnetic induction intensity of the second Hall sensor 124 along the Z direction and the magnetic induction intensity along the opposite direction of the Z direction at the location are both less than or equal to the preset intensity, the output first signal value is 0.
[0228] That is to say, in this feasible implementation manner, the first signal value output by the first Hall sensor 122 and the second signal value output by the second Hall sensor 124 may be as shown in Table 5 and Table 9.
[0229] (II) In the second feasible implementation, the first Hall sensor 122 and the second Hall sensor 124 are both uniaxial Hall sensors along a preset direction. The preset direction here refers to the Z direction. That is to say, different from the "first feasible implementation", in this implementation, the first Hall sensor 122 and the second Hall sensor 124 no longer have a threshold value. In this case, there are:
[0230] The first Hall sensor 122 is used to detect the magnetic induction intensity and direction along the Z direction and the opposite direction of the Z direction at the position where the first Hall sensor 122 is located, and output a first signal value. At this time, if the magnetic induction intensity detected by the first Hall sensor 122 along the Z direction is 37.358mT, the first signal value output by the first Hall sensor 122 may be 37.358mT. If the magnetic induction intensity detected by the first Hall sensor 122 along the opposite direction of the Z direction is 0.35699mT, the first signal value output by the first Hall sensor 122 may be -0.35699mT.
[0231] The second Hall sensor 124 is used to detect the magnetic induction intensity and direction along the Z direction and the opposite direction of the Z direction at the position where the second Hall sensor 124 is located, and output a second signal value. At this time, if the magnetic induction intensity detected by the second Hall sensor 124 along the Z direction is 91.95mT, the second signal value output by the second Hall sensor 124 may be 91.95mT. If the magnetic induction intensity detected by the second Hall sensor 124 along the opposite direction of the Z direction is 0.43928mT, the second signal value output by the second Hall sensor 124 may be -0.43928mT.
[0232] That is, in this feasible implementation, the first signal value output by the first Hall sensor 122 and the second signal value output by the second Hall sensor 124 may be data in the column where direction Z is located in Table 2, Table 3, Table 6, and Table 7.
[0233] In some other feasible implementations, based on the aforementioned principle description, the first Hall sensor 122 and the second Hall sensor 124 may also be three-axis Hall sensors or three-axis switch Hall sensors, which will not be described in detail.
[0234] S200 , the processor 150 detects the quality factor of the transmitting coil 110 .
[0235] When step S200 is implemented, it can be applied to Fig.32 The electronic device 10 shown. In this case, step S200 may specifically include the following steps S210 to S230.
[0236] S210: The processor 150 charges the capacitor C and the transmitting coil 110 until the capacitor C and the transmitting coil 110 are both in a steady state.
[0237] Specifically, the processor 150 may control the second switch Q2 and the fourth switch Q4 to be turned off, and control the first switch Q1 and the third switch Q3 to be turned on, so as to charge the capacitor C and the transmitting coil 110. In the embodiment of the present application, a first preset duration may be set in the processor 150. The first preset duration should be greater than or equal to the duration required for the capacitor C and the transmitting coil 110 to be fully charged. In this way, when the processor 150 executes step S210, specifically: the processor 150 controls the second switch Q2 and the fourth switch Q4 to be turned off within the first preset duration, and controls the first switch Q1 and the third switch Q3 to be turned on, so as to charge the capacitor C and the transmitting coil 110, so that the capacitor C and the transmitting coil 110 are both in a steady state.
[0238] S220 , the processor 150 controls the second plate of the capacitor C to be connected to the second end of the transmitting coil 110 , so that an oscillating electrical signal is generated between the first plate of the capacitor C and the first end of the transmitting coil 110 .
[0239] Specifically, the processor 150 may control the first switch Q1 and the fourth switch Q4 to be turned off, and the second switch Q2 and the third switch Q3 to be turned on, so that the second plate of the capacitor C is connected to the second end of the transmitting coil 110. At this time, an oscillating electrical signal is generated in the loop formed by the capacitor C, the transmitting coil 110, the second switch Q2, and the third switch Q3, that is, an oscillating electrical signal is generated between the first plate of the capacitor C and the first end of the transmitting coil 110.
[0240] S230: The processor 150 determines the quality factor of the transmitting coil 110 according to the n-1th amplitude and the nth amplitude among the multiple amplitudes of the oscillating electrical signal.
[0241] When an oscillating electrical signal is generated between the first electrode plate of the capacitor C and the first end of the transmitting coil 110, the processor 150 connected to the first end of the transmitting coil 110 can detect the oscillating electrical signal, and determine the quality factor of the transmitting coil 110 through formulas ① and ⑥ according to the n-1th amplitude and the nth amplitude among the multiple amplitudes of the oscillating electrical signal.
[0242] S300 , the processor 150 determines whether the stylus pen 20 is offset according to the first signal value, the second signal value and the quality factor of the transmitting coil 110 .
[0243] The stylus pen 20 deviates when the adsorption position of the stylus pen 20 adsorbed on the electronic device 10 deviates to the left or right relative to the preset adsorption position.
[0244] Step S300 may specifically include the following steps S310 and S320.
[0245] S310: The processor 150 obtains corresponding position indication information from a corresponding relationship between the signal value and the position indication information according to the first signal value and the second signal value.
[0246] The position indication information is used to indicate whether the position is offset to the left, offset to the right, or not offset relative to the preset adsorption position. In some specific embodiments, the correspondence between the signal value and the position indication information may be as shown in Table 10. That is, in the correspondence, the position indication information corresponding to the first signal value of -1 and the second signal value of 0 indicates an offset to the left; the position indication information corresponding to the first signal value of 0 and the second signal value of -1 indicates an offset to the right; the position indication information corresponding to the first signal value of 0 and the second signal value of 1 indicates an offset to the right or not offset; the position indication information corresponding to the first signal value of 1 and the second signal value of 0 indicates an offset to the left or not offset.
[0247] It is understandable that in the embodiment of the present application, the correspondence between the signal value and the position indication information is only presented in the form shown in Table 10. In some other embodiments, the correspondence between the signal value and the position indication information can also be presented in other forms besides a table. For example, the correspondence can be presented as a program.
[0248] When the corresponding relationship between the signal value and the position indication information is as shown in Table 10, based on the two different implementations of step S100, step S310 may also have two different implementations. Specifically, they are as follows:
[0249] (I) A first feasible implementation method based on step S100, that is, when both the first Hall sensor 122 and the second Hall sensor 124 are uniaxial switch Hall sensors along the Z direction, the first signal value output by the first Hall sensor 122 includes -1, 0, 1, and the second signal value output by the second Hall sensor 124 includes -1, 0, 1. In this case, when the processor 150 obtains the first signal value and the second signal value, it can directly obtain the corresponding position indication information from the corresponding relationship between the signal value and the position indication information according to the first signal value and the second signal value.
[0250] (II) A second feasible implementation method based on step S100, that is, when both the first Hall sensor 122 and the second Hall sensor 124 are uniaxial Hall sensors along the Z direction, the first signal value output by the first Hall sensor 122 is a magnetic induction intensity with a sign (positive or negative), and the second signal value output by the second Hall sensor 124 is a magnetic induction intensity with a sign. In this case, when the processor 150 obtains the first signal value and the second signal value, it can first process the first signal value and the second signal value, and then obtain the corresponding position indication information from the corresponding relationship between the signal value and the position indication information according to the processing result.
[0251] The logic of the processor 150 processing the first signal value may be: when the sign of the first signal value is positive, and the magnetic induction intensity in the first signal value is greater than the preset intensity (for example, the first signal value is 37.358mT), the first signal value is determined to be equivalent to 1; when the sign of the first signal value is negative, and the magnetic induction intensity in the first signal value is greater than the preset intensity (for example, the first signal value is -52.802mT), the first signal value is determined to be equivalent to -1; when the magnetic induction intensity in the first signal value is less than or equal to the preset intensity, regardless of whether the sign of the first signal value is positive or negative (for example, the first signal value is 0.29376mT or -3.0112mT), the first signal value is determined to be equivalent to 0. The logic of the processor 150 processing the second signal value is the same as the logic of the processor 150 processing the first signal value, and will not be repeated.
[0252] That is, when the first Hall sensor 122 and the second Hall sensor 124 are not switch-type Hall sensors with a threshold, the judgment logic that can be implemented by the switch-type Hall sensor is completed by the processor 150. When the first Hall sensor 122 and the second Hall sensor 124 are both single-axis switch-type Hall sensors along the Z direction, the energy consumption of the electronic device 10 can be saved.
[0253] In the following embodiment, the offset detection method of the stylus 20 provided in the embodiment of the present application is described by taking the first Hall sensor 122 and the second Hall sensor 124 as single-axis switch Hall sensors along the Z direction as an example.
[0254] S320 , the processor 150 determines whether the stylus pen 20 is offset according to the position indication information and the quality factor of the transmitting coil 110 .
[0255] After the processor 150 executes steps S100 and S310, the position indication information that can be obtained includes four types: "shifted to the right", "shifted to the left", "shifted to the right or not shifted", and "shifted to the left or not shifted". At this time, for the two cases where the position indication information is "shifted to the right or not shifted" and "shifted to the left or not shifted", it is still impossible to determine whether the stylus 20 is shifted. Therefore, it is also necessary to determine whether the stylus 20 is shifted in combination with the quality factor of the transmitting coil 110.
[0256] After executing step S200, the processor 150 may obtain the quality factor of the transmitting coil 110. At this time, the processor 150 may determine whether the stylus pen 20 is offset according to the quality factor of the transmitting coil 110. Specifically, if the quality factor of the transmitting coil 110 is less than the first threshold, it indicates that the stylus pen 20 is offset; if the quality factor of the transmitting coil 110 is greater than the second threshold, it indicates that the stylus pen 20 is not offset.
[0257] Thus, when the processor 150 executes step S320, it may specifically include the following parallel steps S321 to S326.
[0258] S321: If the position indication information indicates a leftward shift, and the quality factor of the transmitting coil 110 is less than a first threshold, the processor 150 determines that the adsorption position of the stylus pen 20 is shifted to the left relative to the preset adsorption position.
[0259] When the first signal value is -1 and the second signal value is 0, the processor 150 can obtain the position indication information indicating a leftward shift. In this case, if the quality factor of the transmitting coil 110 is less than the first threshold, it indicates that the stylus 20 is attached to the electronic device 10. Based on this, the processor 150 can determine that the attachment position of the stylus 20 is offset to the left relative to the preset attachment position.
[0260] S322: If the position indication information indicates a rightward shift, and the quality factor of the transmitting coil 110 is less than the first threshold, the processor 150 determines that the adsorption position of the stylus pen 20 is shifted to the right relative to the preset adsorption position.
[0261] When the first signal value is 0 and the second signal value is -1, the processor 150 can obtain the position indication information indicating a rightward shift. In this case, if the quality factor of the transmitting coil 110 is less than the first threshold, it indicates that the stylus 20 is attached to the electronic device 10. Based on this, the processor 150 can determine that the attachment position of the stylus 20 is offset to the right relative to the preset attachment position.
[0262] S323, if the position indication information indicates a leftward shift or no shift, and the quality factor of the transmitting coil 110 is less than the first threshold, the processor 150 determines that the adsorption position of the stylus pen 20 is shifted to the left relative to the preset adsorption position.
[0263] When the first signal value is 1 and the second signal value is 0, the processor 150 can obtain the position indication information indicating a leftward shift or no shift. In this case, if the quality factor of the transmitting coil 110 is less than the first threshold, it indicates that the stylus 20 is adsorbed on the electronic device 10 and the stylus 20 is deflected. Based on this, the processor 150 can determine that the adsorption position of the stylus 20 is deflected to the left relative to the preset adsorption position.
[0264] S324: If the position indication information indicates a leftward shift or no shift, and the quality factor of the transmitting coil 110 is greater than the second threshold, the processor 150 determines that the stylus pen 20 is not shifted.
[0265] When the first signal value is 1 and the second signal value is 0, the processor 150 can obtain the position indication information indicating the leftward deviation or no deviation. In this case, if the quality factor of the transmitting coil 110 is greater than the second threshold value, it indicates that the stylus 20 is attached to the electronic device 10 and the stylus 20 is not deviated. Based on this, the processor 150 can determine that the stylus 20 is not deviated.
[0266] S325, if the position indication information indicates a rightward shift or no shift, and the quality factor of the transmitting coil 110 is less than the first threshold, the processor 150 determines that the adsorption position of the stylus pen 20 is shifted to the right relative to the preset adsorption position.
[0267] When the first signal value is 0 and the second signal value is 1, the processor 150 can obtain the position indication information indicating rightward shift or no shift. In this case, if the quality factor of the transmitting coil 110 is less than the first threshold, it indicates that the stylus 20 is attached to the electronic device 10 and the stylus 20 is offset. Based on this, the processor 150 can determine that the adsorption position of the stylus 20 is offset to the right relative to the preset adsorption position.
[0268] S326: If the position indication information indicates a rightward shift or no shift, and the quality factor of the transmitting coil 110 is greater than the second threshold, the processor 150 determines that the stylus pen 20 is not shifted.
[0269] When the first signal value is 0 and the second signal value is 1, the processor 150 can obtain the position indication information indicating rightward deviation or no deviation. In this case, if the quality factor of the transmitting coil 110 is greater than the second threshold value, it indicates that the stylus 20 is attached to the electronic device 10 and the stylus 20 is not deviated. Based on this, the processor 150 can determine that the stylus 20 is not deviated.
[0270] In this way, the stylus pen 20 deviation detection method provided in the embodiment of the present application can not only detect whether the stylus pen 20 adsorbed on the electronic device 10 is deviated, but also detect the deviation direction of the stylus pen 20 when the stylus pen 20 is deviated.
[0271] The above-mentioned stylus 20 offset detection method is applied to Fig.32 In the electronic device 10 shown, steps S100, S200 and S300 can all be executed by the first sub-processor 152, and are not described in detail.
[0272] The following describes the execution order of steps S100 , S200 , and S300 in the method for detecting the deviation of the stylus pen 20 .
[0273] In the first embodiment, if Fig.37 As shown, the above-mentioned method for detecting the deviation of the stylus pen 20 may be performed in the following order: S100, S310, S200, S320.
[0274] In this case, the processor 150 first receives the first signal value output by the first Hall sensor 122 and the second signal value output by the second Hall sensor 124. Then, according to the first signal value and the second signal value, the corresponding position indication information is obtained from the correspondence between the signal value and the position indication information. In this implementation, the processor 150 executes step S200 (including steps S210, S220, and S230 in order), that is, detects the quality factor of the transmitting coil 110, only after obtaining the corresponding position indication information. Finally, the processor 150 determines whether the stylus 20 is offset to the left or to the right or not offset according to the position indication information and the quality factor of the transmitting coil 110.
[0275] In this implementation, the processor 150 detects the quality factor of the transmitting coil 110 only after obtaining the corresponding position indication information. In this case, when the processor 150 receives the first signal value and the second signal value, but fails to obtain the corresponding position indication information from the corresponding relationship between the signal value and the position indication information (such as the first signal value is -1, and the second signal value is -1; or the first signal value is -1, and the second signal value is 1, etc.), that is, when the debris with a magnetic field is close to the first Hall sensor 122 and the second Hall sensor 124, the quality factor of the transmitting coil 110 will not be detected. In this way, the effect of saving the power of the electronic device 10 can be achieved.
[0276] In the second embodiment, if Fig.36 As shown, the execution order of the steps of the above-mentioned stylus 20 deviation detection method may be: periodically executing step S200; and executing step S300 after receiving the first signal value and the second signal value (ie, step S100).
[0277] The period during which the processor 150 executes step S200 may be a second preset duration, which may be, for example, 0.5 seconds, 1 second, or 2 seconds, and which is greater than the duration of the oscillating electrical signal generated in step S220.
[0278] In this case, the processor 150 may detect the quality factor of the transmitting coil 110 once every second preset time length. After receiving the first signal value and the second signal value, the processor 150 may determine whether the stylus pen 20 is offset according to the first signal value, the second signal value and the quality factor detected most recently, that is, execute step S300. In this implementation, when the processor 150 executes step S300, steps S310 and S320 may be executed simultaneously. In this way, the working process of the stylus pen 20 offset detection method can be accelerated.
[0279] In addition, based on the above principles, it can be known that the stylus pen 20 offset detection method provided in the embodiment of the present application can also be implemented in the following manner. That is:
[0280] After step S100, there are two different situations. In the first situation, the first signal value is -1 or 0, and the second signal value is 0 or -1. At this time, the processor 150 determines whether the stylus 20 is offset according to the first signal value and the second signal value. In the second situation, the first signal value is 1 and the second signal value is 0; or the first signal value is 0 and the second signal value is 1. At this time, the processor executes steps S200 and S300.
[0281] The two different situations are described below.
[0282] In the first case, when the processor 150 determines whether the stylus pen 20 is offset according to the first signal value and the second signal value, specifically, the processor 150 determines whether the stylus pen 20 is offset according to the first signal value, the second signal value, and the correspondence between the signal value and the position indication information.
[0283] Specifically, when the first signal value is -1 and the second signal value is 0, the processor 150 can obtain the position indication information indicating a leftward shift. Based on this, when the first signal value is -1 and the second signal value is 0, the processor 150 can directly determine that the adsorption position of the stylus 20 is offset to the left relative to the preset adsorption position according to the corresponding relationship between the signal value and the position indication information. When the first signal value is 0 and the second signal value is -1, the processor 150 can obtain the position indication information indicating a rightward shift. Based on this, when the first signal value is 0 and the second signal value is -1, the processor 150 can directly determine that the adsorption position of the stylus 20 is offset to the right relative to the preset adsorption position according to the corresponding relationship between the signal value and the position indication information.
[0284] In the second case, since the processor 150 cannot directly determine whether the adsorption position of the stylus pen 20 on the electronic device 10 is offset according to the first signal value, the second signal value, and the corresponding relationship between the signal value and the position indication information, the processor 150 also needs to detect the quality factor of the transmitting coil 110 (i.e., execute step S200) and execute step S310. After that, the processor 150 can execute steps S323 to S326, thereby determining whether the stylus pen 20 is offset according to the first signal value, the second signal value, and the corresponding relationship between the signal value and the position indication information. It can be understood that in this case, the execution order of step S200 and step S310 is not limited.
[0285] In some embodiments, in the stylus 20 deviation detection method, the processor 150 is further configured to execute the following step S400 after executing steps S100 and S310.
[0286] S400: The processor 150 configures screen resources according to the position indication information.
[0287] As mentioned above, in the embodiment of the present application, there are four different types of position indication information, namely, "offset to the left", "offset to the right", "offset to the right or not offset", and "offset to the left or not offset". Here, each position indication information may correspond to a prompt screen, and the prompt screen is used to prompt the stylus 20 to move in the opposite direction of the offset direction.
[0288] Specifically, the two position indication information of "shift to the right" and "shift to the right or not shift" can correspond to the same first prompt screen. Fig.38 or Fig.39 As shown, the first prompt screen is used to prompt the stylus 20 to move to the left. The two position indication information of "shift to the left" and "shift to the left or not shift" can correspond to the same second prompt screen. The second prompt screen can be as follows Fig.40 or Fig.41 As shown, the second prompting picture is used to prompt the stylus 20 to move to the right. The first prompting picture and the second prompting picture can be dynamic pictures or static pictures, which are not limited here.
[0289] Screen resources are resources required when displaying prompt screens (including the first prompt screen and the second prompt screen). Screen resources required to display the first prompt screen are called first screen resources, and screen resources required to display the second prompt screen are called second screen resources. That is to say, after the processor 150 obtains the two position indication information of "offset to the right" and "offset to the right or not offset", it can configure the first screen resource; after the processor 150 obtains the two position indication information of "offset to the left" and "offset to the left or not offset", it can configure the second screen resource.
[0290] Based on step S400 , the processor 150 is further configured to execute the following step S500 after step S320 .
[0291] S500: If the stylus pen 20 is offset, the processor 150 uses screen resources to display a prompt screen.
[0292] After executing step S320, the processor 150 can determine whether the stylus pen 20 is offset. At this time, if the stylus pen 20 is offset, the processor 150 uses the screen resources to display the prompt screen. If the stylus pen 20 is not offset, the processor 150 can cancel the screen resources to avoid increasing the load of the electronic device 10 due to long-term meaningless screen resources.
[0293] Specifically, if the first signal value is -1 and the second signal value is 0, the position indication information indicates a leftward shift. In this case, the processor 150 configures a second screen resource in step S400. At this time, if it is determined in step S321 in step S320 that the adsorption position of the stylus pen 20 is offset to the left relative to the preset adsorption position, the processor 150 uses the second screen resource to display the second prompt screen.
[0294] If the first signal value is 0 and the second signal value is -1, the position indication information indicates a rightward shift. In this case, the processor 150 configures a first screen resource in step S400. At this time, if it is determined in step S322 of step S320 that the adsorption position of the stylus pen 20 is offset to the right relative to the preset adsorption position, the processor 150 uses the first screen resource to display the first prompt screen.
[0295] If the first signal value is 1 and the second signal value is 0, the position indication information indicates a leftward shift or no shift. In this case, the processor 150 configures a second screen resource in step S400. At this time, if it is determined by step S323 in step S320 that the adsorption position of the stylus pen 20 is offset to the left relative to the preset adsorption position, the processor 150 uses the second screen resource to display the second prompt screen. If it is determined by step S324 in step S320 that the stylus pen 20 is not offset, the processor 150 cancels the configured second screen resource.
[0296] If the first signal value is 0 and the second signal value is 1, the position indication information indicates rightward offset or no offset. In this case, the processor 150 configures the first screen resource in step S400. At this time, if it is determined by step S325 in step S320 that the adsorption position of the stylus pen 20 is offset to the right relative to the preset adsorption position, the processor 150 uses the first screen resource to display the first prompt screen. If it is determined by step S326 in step S320 that the stylus pen 20 is not offset, the processor 150 cancels the configured first screen resource.
[0297] In some specific embodiments, step S400 and step S500 may be executed by the second sub-processor 154 in the processor 150 .
[0298] In some specific embodiments, the prompt screen not only prompts the moving direction of the stylus pen 20, but also prompts the moving distance of the stylus pen 20. Specifically, in step S300, the processor 150 can not only determine whether the stylus pen 20 is offset and the offset direction when the stylus pen 20 is offset based on the first signal value, the second signal value and the quality factor of the transmitting coil 110, but also determine which of the situations (1), (2), (5), (6), (7), (8), (11) and (12) the stylus pen 20 is offset based on the above principle description. In this case, the moving direction and distance of the stylus pen 20 can be prompted based on each stylus pen 20 offset situation. For example, when the processor 150 determines that the stylus pen 20 is offset in situation (1), it prompts the stylus pen 20 to move a first distance to the left. The first distance can be 5 mm or 1 cm. When the processor 150 determines that the stylus pen 20 is offset as the case (5), it prompts the stylus pen 20 to move to the left by a second distance, which is smaller than the first distance. The second distance may be 3 mm.
[0299] In some embodiments, before executing step S300, the processor 150 is further configured to execute the following step S600.
[0300] S600: The processor 150 sends a communication signal.
[0301] The processor 150 may send the communication signal by broadcasting the communication signal. That is, when the processor 150 sends the communication signal, there is no specific target to receive the communication signal. The processor 150 may send the communication signal in a specified direction. The communication signal is used to identify the stylus 20. In general, the propagation distance of the communication signal may meet the following conditions: when the stylus 20 is in contact with the contact surface 104 of the electronic device 10, the stylus 20 may receive the communication signal; when the stylus 20 is not in contact with the contact surface 104 of the electronic device 10, the stylus 20 may not receive the communication signal.
[0302] After receiving the communication signal, the stylus pen 20 may send a feedback signal in response to the communication signal. The feedback signal sent by the stylus pen 20 may carry information of the stylus pen 20, such as the identity number (ID) of the stylus pen 20. In this way, the processor 150 of the electronic device 10 can identify the stylus pen 20 after receiving the feedback signal.
[0303] Based on step S600, when the processor 150 executes step S300, it can be specifically: if the processor 150 receives a feedback signal for the communication signal within a third preset time period after sending the communication signal, it is determined whether the stylus 20 is offset according to the first signal value, the second signal value and the quality factor of the transmitting coil 110.
[0304] The third preset duration should be greater than the duration for the stylus 20 to send a feedback signal for the communication signal after receiving the communication signal. For example, the third preset duration may be 0.2 seconds, 0.5 seconds or 1 second. If the processor 150 receives a feedback signal for the communication signal within the third preset duration after sending the communication signal, it can be determined that the stylus 20 is in contact with the contact surface 104 of the electronic device 10. In this case, the processor 150 determines whether the stylus 20 is offset based on the first signal value, the second signal value and the quality factor of the transmitting coil 110. In this way, it is possible to avoid the miscellaneous objects with a magnetic field or metal miscellaneous objects approaching the electronic device 10 and falsely triggering the stylus 20 offset detection method provided in the embodiment of the present application.
[0305] In some specific embodiments, when the stylus 20 offset detection method is applied to Fig.32 In the electronic device 10 shown, step S600 may be performed by the first sub-processor 152. When the first sub-processor 152 is working, the first communication signal may be sent by modulating the waveform of the electrical signal on the transmitting coil 110.
[0306] The following describes the execution order of steps S100 , S200 , S300 , and S600 in the method for detecting the deviation of the stylus pen 20 after the step S600 is added.
[0307] In the first embodiment, the execution order of steps S100, S200, S300, and S600 is: S100, S310, S600, S200, and S320.
[0308] Thus, step S600 has no effect on step S310, but affects the execution of step S320. This situation can be achieved by the following embodiment a or embodiment b.
[0309] Embodiment a: The processor 150 first receives the first signal value output by the first Hall sensor 122 and the second signal value output by the second Hall sensor 124. Then, according to the first signal value and the second signal value, the corresponding position indication information is obtained from the correspondence between the signal value and the position indication information. After obtaining the corresponding position indication information, the processor 150 sends a communication signal. If the processor 150 receives a feedback signal within a third preset time length, the quality factor of the transmitting coil 110 is detected. Finally, the processor 150 determines whether the stylus 20 is offset to the left or to the right or not offset according to the position indication information and the quality factor of the transmitting coil 110.
[0310] Embodiment b: The processor 150 first receives the first signal value output by the first Hall sensor 122 and the second signal value output by the second Hall sensor 124. Then, according to the first signal value and the second signal value, the corresponding position indication information is obtained from the correspondence between the signal value and the position indication information. After obtaining the corresponding position indication information, the processor 150 sends a communication signal. After sending the communication signal, the processor 150 detects the quality factor of the transmitting coil 110. Finally, if the processor 150 receives a feedback signal within the third preset time length, it determines whether the stylus 20 is offset to the left or to the right or not offset according to the position indication information and the quality factor of the transmitting coil 110; if the processor 150 does not receive a feedback signal within the third preset time length, the step of "determining whether the stylus 20 is offset to the left or to the right or not offset according to the position indication information and the quality factor of the transmitting coil 110" is not performed.
[0311] In the second embodiment, the execution order of steps S100, S200, S300, and S600 is: S100, S310, S200, S600, and S320.
[0312] Thus, step S600 has no effect on step S310, but affects the execution of step S320. This situation can be achieved by the following embodiment c.
[0313] Embodiment c: The processor 150 first receives the first signal value output by the first Hall sensor 122 and the second signal value output by the second Hall sensor 124. Then, according to the first signal value and the second signal value, the corresponding position indication information is obtained from the correspondence between the signal value and the position indication information. After obtaining the corresponding position indication information, the processor 150 detects the quality factor of the transmitting coil 110. Then, the processor 150 sends a communication signal. If the processor 150 receives a feedback signal within a third preset time length, it determines whether the stylus 20 is offset to the left or to the right or not offset according to the position indication information and the quality factor of the transmitting coil 110; if the processor 150 does not receive a feedback signal within the third preset time length, the step of "determining whether the stylus 20 is offset to the left or to the right or not offset according to the position indication information and the quality factor of the transmitting coil 110" is not performed.
[0314] In the third embodiment, the execution order of steps S100, S200, S300, and S600 is: periodically sending a communication signal (i.e., executing step S600), executing step S200 after receiving a feedback signal within a third preset time period after sending the communication signal, and executing step S300 after receiving the first signal value and the second signal value (i.e., step S100).
[0315] Thus, step S600 has no effect on step S310, but affects the execution of steps S200 and S320. This situation can be achieved by the following embodiment d.
[0316] Embodiment d: The period of the processor 150 executing step S600 may be a fourth preset time length. The fourth preset time length should be greater than the third preset time length. For example, the fourth preset time length may be 1 second or 2 seconds. In this case, the processor 150 sends a communication signal once at intervals of the fourth preset time length. If no feedback signal is received within the third preset time length after sending a communication signal once, the communication signal is sent again at the fourth preset time length after sending the communication signal. If a feedback signal is received within the third preset time length after sending a communication signal once, the quality factor of the transmitting coil 110 is detected. Since the receipt of the feedback signal indicates that the stylus 20 is in contact with the contact surface 104 of the electronic device 10, the processor 150 receives the first signal value and the second signal value. At this time, the processor 150 may first obtain the corresponding position indication information from the corresponding relationship between the signal value and the position indication information according to the first signal value and the second signal value (i.e., execute step S310), and then determine whether the stylus 20 is offset according to the position indication information and the quality factor of the transmitting coil 110 (i.e., execute step S320).
[0317] It can be understood that in this embodiment, if the processor 150 does not receive a feedback signal within the third preset time length after sending a communication signal, but receives the first signal value and the second signal value, the processor 150 can execute step S310 but will not execute step S320.
[0318] In the fourth embodiment, the execution order of steps S100, S200, S300, and S600 is: periodically detecting the quality factor of the transmitting coil 110 (i.e., executing step S200); sending a communication signal when the quality factor of the transmitting coil 110 is less than the first threshold or greater than the second threshold (i.e., executing step S600), and executing step S300 after receiving a feedback signal within a third preset time length after sending the communication signal.
[0319] Thus, step S600 has no effect on step S310, step S200 affects the execution of step S600, and step S600 affects the execution of step S320. This situation can be achieved by the following embodiment e.
[0320] Embodiment e: The period for the processor 150 to execute step S200 is the second preset time length. In this case, the processor 150 can detect the quality factor of the transmitting coil 110 once every second preset time length. The processor 150 sends a communication signal when it detects that the quality factor of the transmitting coil 110 is less than the first threshold or greater than the second threshold. If the processor 150 receives a feedback signal within a third preset time length after sending the communication signal, it determines whether the stylus 20 is offset according to the first signal value, the second signal value and the detected quality factor, that is, executes step S300. It can be understood that when the processor 150 receives a feedback signal within the third preset time length after sending the communication signal, it indicates that the stylus 20 is in contact with the contact surface 104 of the electronic device 10, so the processor 150 will inevitably receive the first signal value and the second signal value.
[0321] It can be understood that in this embodiment, if the processor 150 detects that the quality factor of the transmitting coil 110 is greater than or equal to the first threshold and less than or equal to the second threshold, but receives the first signal value and the second signal value, the processor 150 may execute step S310 but will not execute step S320.
[0322] In some embodiments, after sending a communication signal and receiving a feedback signal for the communication signal within a third preset time period, the processor 150 may further perform the following steps S700 and S800.
[0323] S700: The processor 150 controls the transmitting coil 110 to output electrical energy.
[0324] When steps S700 and S800 are implemented, they can be applied to Fig.32 The electronic device 10 shown. In this case, step S700 may specifically include the following steps S710 and S720.
[0325] S710, in the first stage, the processor 150 controls the first switch Q1 and the third switch Q3 to be turned on, and controls the second switch Q2 and the fourth switch Q4 to be turned off.
[0326] S720, in a second stage after the first stage, the processor 150 controls the second switch Q2 and the fourth switch Q4 to be turned on, and controls the first switch Q1 and the third switch Q3 to be turned off.
[0327] In this embodiment, the first switch Q1, the second switch Q2, the third switch Q3 and the fourth switch Q4 form an inverter bridge, which can convert the direct current output from the positive electrode and the negative electrode of the power supply into two-phase alternating current. Steps S710 and S720 are repeatedly executed in a loop to output alternating current to the capacitor C and the transmitting coil 110, so that the transmitting coil 110 outputs electrical energy.
[0328] S800 : The processor 150 detects electrical parameters of the transmitting coil 110 .
[0329] When the transmitting coil 110 outputs electrical energy, the processor 150 may detect an electrical parameter of the transmitting coil 110 . The electrical parameter here may be a voltage value or a current value at the first end of the transmitting coil 110 .
[0330] Based on steps S700 and S800, when the processor 150 executes step S300, specifically: if the electrical parameter of the transmitting coil 110 is within the preset parameter range, it is determined whether the stylus 20 is offset according to the first signal value, the second signal value and the quality factor of the transmitting coil 110. Here, when the electrical parameter of the transmitting coil 110 is a voltage value, the preset parameter range may be a voltage range; when the electrical parameter of the transmitting coil 110 is a current value, the preset parameter range may be a current range.
[0331] The preset parameter range may satisfy the following conditions: when the stylus pen 20 is adsorbed at a preset adsorption position and the transmitting coil 110 outputs electrical energy, the electrical parameters of the transmitting coil 110 are within the preset parameter range; when the adsorption position of the stylus pen 20 is offset and the transmitting coil 110 outputs electrical energy, the electrical parameters of the transmitting coil 110 are not within the preset parameter range.
[0332] The following is a detailed explanation of the stylus pen 20 deviation detection method provided in the embodiment of the present application from two specific implementations in conjunction with the accompanying drawings.
[0333] The first specific implementation method.
[0334] Fig.42 is a flowchart of another stylus pen 20 offset detection method provided in an embodiment of the present application. The stylus pen 20 offset detection method can be applied to Fig.32 The electronic device 10 shown. Fig.42 As shown, the stylus pen 20 deviation detection method may include the following steps S1 to S9.
[0335] S1, Hall detection.
[0336] The first Hall sensor 122 performs Hall detection and outputs a first signal value, and the second Hall sensor 124 performs Hall detection and outputs a second signal value. Here, the first Hall sensor 122 and the second Hall sensor 124 are both single-axis switch Hall sensors along the Z direction, so that the first Hall sensor 122 and the second Hall sensor 124 can respectively detect the magnetic induction intensity along the Z direction and the magnetic induction intensity in the opposite direction of the Z direction at the position.
[0337] When the magnetic induction intensity of the first Hall sensor 122 along the Z direction at the position is greater than the preset intensity, the output first signal value is 1; when the magnetic induction intensity of the first Hall sensor 122 along the opposite direction of the Z direction at the position is greater than the preset intensity, the output first signal value is -1; when the magnetic induction intensity of the first Hall sensor 122 along the Z direction at the position and the magnetic induction intensity along the opposite direction of the Z direction are both less than or equal to the preset intensity, the output first signal value is 0. When the magnetic induction intensity of the second Hall sensor 124 along the Z direction at the position is greater than the preset intensity, the output first signal value is 1; when the magnetic induction intensity of the second Hall sensor 124 along the opposite direction of the Z direction at the position is greater than the preset intensity, the output first signal value is -1; when the magnetic induction intensity of the second Hall sensor 124 along the Z direction at the position and the magnetic induction intensity along the opposite direction of the Z direction are both less than or equal to the preset intensity, the output first signal value is 0.
[0338] S2, query the corresponding relationship between the signal value and the position indication information.
[0339] The first signal value and the second signal value are output to the first sub-processor 152. The first sub-processor 152 can access the correspondence between the signal value and the position indication information while receiving the first signal value and the second signal value. The correspondence between the signal value and the position indication information is shown in Table 10. For ease of description, the correspondence between the signal value and the position indication information is referred to as a preset correspondence.
[0340] S3, determining whether the first signal value and the second signal value have corresponding position indication information in a preset corresponding relationship.
[0341] After receiving the first signal value and the second signal value and querying the preset corresponding relationship, the first sub-processor 152 can determine whether the first signal value and the second signal value have corresponding position indication information in the preset corresponding relationship. In this case, if the judgment result of step S3 is no, then return to step S1. If the judgment result of step S3 is yes, then execute steps S4 and S5.
[0342] Here, the judgment result of step S3 is yes in four cases, namely: 1) the first signal value is -1, and the second signal value is 0. At this time, the corresponding position indication information indicates a left shift; 2) the first signal value is 0, and the second signal value is -1. At this time, the corresponding position indication information indicates a right shift; 3) the first signal value is 0, and the second signal value is 1. At this time, the corresponding position indication information indicates a right shift or no shift; 4) the first signal value is 1, and the second signal value is 0. At this time, the corresponding position indication information indicates a left shift or no shift.
[0343] S4, configuring picture resources according to the position indication information.
[0344] If the judgment result of step S3 is yes, the first sub-processor 152 may send the position indication information corresponding to the first signal value and the second signal value in the preset corresponding relationship to the second sub-processor 154. The second sub-processor 154 may be the SOC in the electronic device 10. After acquiring the position indication information, the second sub-processor 154 configures the screen resources according to the position indication information.
[0345] Here, the screen resource includes a first screen resource and a second screen resource. When the second sub-processor 154 uses the first screen resource, the electronic device 10 displays a first prompt screen. The first prompt screen is used to prompt the stylus 20 to move to the left. When the second sub-processor 154 uses the second screen resource, the electronic device 10 displays a second prompt screen. The second prompt screen is used to prompt the stylus 20 to move to the right.
[0346] “Configuring screen resources according to position indication information” means: when the position indication information is “offset to the left” or “offset to the left or not offset”, the first sub-processor 152 configures the second screen resources according to the position indication information. When the position indication information is “offset to the right” or “offset to the right or not offset”, the first sub-processor 152 configures the first screen resources according to the position indication information. In other words, the prompt screen corresponding to the screen resource should be used to prompt the stylus 20 to move in the opposite direction of the offset direction.
[0347] S5 , detecting the quality factor of the transmitting coil 110 .
[0348] The first sub-processor 152 may first control the first switch Q1 and the third switch Q3 to be turned on within the first preset time length, so as to charge the capacitor C and the transmitting coil 110 within the first preset time length, so that the capacitor C and the transmitting coil 110 are in a steady state. Afterwards, the first sub-processor 152 controls the second switch Q2 and the third switch Q3 to be turned on, so that the second electrode plate of the capacitor C is connected to the second end of the transmitting coil 110, and an oscillating electrical signal is generated between the first electrode plate of the capacitor C and the first end of the transmitting coil 110. The first sub-processor 152 may detect the oscillating electrical signal, and determine the quality factor of the transmitting coil 110 through formula ① and formula ⑥ according to the n-1th amplitude and the nth amplitude among the multiple amplitudes of the oscillating electrical signal.
[0349] It can be understood that step S5 can be executed simultaneously with step S4, or can be located before or after step S4, without limitation.
[0350] S6, determining the magnitude relationship between the quality factor and the second threshold.
[0351] The first sub-processor 152 has a first threshold and a second threshold preset therein, and the first threshold is smaller than the second threshold. After the first sub-processor 152 detects the quality factor of the transmitting coil 110, it can determine the magnitude relationship between the quality factor and the second threshold.
[0352] When the position indication information obtained in step S3 is "shifted to the left or not shifted" or "shifted to the right or not shifted", if the quality factor determined in step S6 is greater than the second threshold, it can be determined that the stylus 20 is not shifted (i.e., the stylus 20 is adsorbed at the preset adsorption position), and at this time, step S7 is executed.
[0353] When the position indication information obtained in step S3 is "shifted to the left or not shifted" or "shifted to the right or not shifted", if the quality factor determined in step S6 is less than or equal to the second threshold, step S8 is executed.
[0354] When the position indication information obtained in step S3 is "shifted to the left" or "shifted to the right", if the quality factor determined in step S6 is less than or equal to the second threshold, step S8 is executed.
[0355] It can be understood that in this embodiment, when the position indication information obtained in step S3 is "shifted to the left" or "shifted to the right", the situation where the quality factor is greater than the second threshold is not considered. In some other embodiments, if the position indication information obtained in step S3 is "shifted to the left" or "shifted to the right", and the quality factor is greater than the second threshold, it can be determined that the first Hall sensor 122 and the second Hall sensor 124 are falsely triggered, and at this time, the process returns to step S1.
[0356] S7, controlling the transmitting coil 110 to output electric energy, and canceling the picture resources.
[0357] The first sub-processor 152 can control the first switch Q1 and the third switch Q3 to be turned on in the first stage, and control the second switch Q2 and the fourth switch Q4 to be turned off; and control the second switch Q2 and the fourth switch Q4 to be turned on in the second stage, and control the first switch Q1 and the third switch Q3 to be turned off. This cycle is repeated to output AC power to the capacitor C and the transmitting coil 110, so that the transmitting coil 110 outputs electrical energy.
[0358] When determining that the stylus pen 20 is not offset, the first sub-processor 152 further sends a first instruction to the second sub-processor 154. When receiving the first instruction, the second sub-processor 154 cancels the configuration of the screen resources according to the position indication information in step S4.
[0359] S8, determining the magnitude relationship between the quality factor and the first threshold.
[0360] The first sub-processor 152 determines the magnitude relationship between the quality factor and the first threshold.
[0361] When the position indication information obtained in step S3 is "shifted to the left or not shifted" or "shifted to the right or not shifted", if the quality factor obtained in step S8 is less than the first threshold, it can be determined that the stylus 20 is shifted. That is, if the position indication information obtained in step S3 is "shifted to the left or not shifted", and the quality factor is less than the first threshold, it can be determined that the stylus 20 is shifted to the left. If the position indication information obtained in step S3 is "shifted to the right or not shifted", and the quality factor is less than the first threshold, it can be determined that the stylus 20 is shifted to the right. At this time, step S9 is executed.
[0362] When the position indication information obtained in step S3 is "shifted to the left" or "shifted to the right", if the quality factor obtained in step S8 is less than the first threshold, it can be determined that the stylus 20 is shifted. That is, if the position indication information obtained in step S3 is "shifted to the left" and the quality factor is less than the first threshold, it can be determined that the stylus 20 is shifted to the left. If the position indication information obtained in step S3 is "shifted to the right" and the quality factor is less than the first threshold, it can be determined that the stylus 20 is shifted to the right. At this time, step S9 is executed.
[0363] If the quality factor obtained in step S8 is greater than or equal to the first threshold, it can be determined that the first Hall sensor 122 and the second Hall sensor 124 are falsely triggered, and at this time, the process returns to step S1. In other words, no matter what the position indication information obtained in step S3 is, when the quality factor of the transmitting coil 110 is greater than or equal to the first threshold and less than or equal to the second threshold, the process returns to step S1.
[0364] It is understandable that when the first sub-processor 152 is working, it can also execute steps S8 and S6 simultaneously, that is, simultaneously determine the magnitude relationship between the quality factor and the first threshold and the second threshold.
[0365] S9, using screen resources to display a prompt screen.
[0366] After determining that the stylus pen 20 is offset, the first sub-processor 152 may send a second instruction to the second sub-processor 154. Upon receiving the second instruction, the second sub-processor 154 uses the screen resources configured in step S4 to display a prompt screen, thereby prompting the user to move the stylus pen 20 in the opposite direction of the offset direction.
[0367] A second specific implementation method.
[0368] Fig.43 is a flowchart of another stylus 20 offset detection method provided in an embodiment of the present application, which is based on Fig.42 The illustrated embodiment has the following two differences.
[0369] 1) Replace step S7 with steps S7a to S7d.
[0370] S7a, determining whether communication with the stylus pen 20 is possible.
[0371] The first sub-processor 152 determines whether it can communicate with the stylus 20. Here, the first sub-processor 152 can send a communication signal. If the first sub-processor 152 receives a feedback signal for the communication signal within the third preset time after sending the communication signal, the first sub-processor 152 determines that it can communicate with the stylus 20, and the judgment result of step S7a is yes. In other words, the first sub-processor 152 determines that the stylus 20 is attached to the electronic device 10. When the judgment result of step S7a is yes, step S7b is executed.
[0372] It can be understood that when the judgment result of step S7a is no, it can be determined that the quality factor of the first Hall sensor 122, the second Hall sensor 124, and the transmitting coil 110 is falsely triggered. At this time, the process returns to step S1.
[0373] S7b, controlling the transmitting coil 110 to output electric energy, and canceling the picture resources.
[0374] Step S7b is the same as the aforementioned step S7 and will not be described in detail.
[0375] S7c, detecting electrical parameters of the transmitting coil 110.
[0376] After controlling the transmitting coil 110 to output electrical energy, the first sub-processor 152 may further detect electrical parameters of the transmitting coil 110 , such as detecting a voltage value and a current value at a first end of the transmitting coil 110 .
[0377] S7d, if the electrical parameters of the transmitting coil 110 are within the preset range, the transmitting coil 110 is controlled to continue to output electrical energy.
[0378] If the electrical parameters of the transmitting coil 110 are within the preset range, it further indicates that the stylus pen 20 is adsorbed at the preset adsorption position. In this case, the first sub-processor 152 can control the transmitting coil 110 to continue to output electrical energy to charge the stylus pen 20.
[0379] In this embodiment, the case where the electrical parameters of the transmitting coil 110 are not within the preset range is not shown. It can be understood that when the electrical parameters of the transmitting coil 110 are not within the preset range, it can be determined that the first Hall sensor 122, the second Hall sensor 124, and the quality factor of the transmitting coil 110 are falsely triggered, and at this time, the process returns to step S1.
[0380] 2) After determining that “the quality factor is less than the first threshold value” and before step S9 , the following steps S10 a to S10 d are inserted.
[0381] S10a, determining whether communication with the stylus pen 20 is possible.
[0382] Step S10a is the same as step S7a and will not be described in detail. If the judgment result of step S10a is yes, step S10b is executed. If the judgment result of step S10a is no, the process returns to step S1.
[0383] S10b, controlling the transmitting coil 110 to output electrical energy.
[0384] S10c, detecting electrical parameters of the transmitting coil 110 .
[0385] Step S10c is the same as step S7c and will not be described in detail.
[0386] S10d, if the electrical parameters of the transmitting coil 110 are not within the preset range, execute step S9.
[0387] If the electrical parameters of the transmitting coil 110 are not within the preset range, it further indicates that the adsorption position of the stylus pen 20 is offset, and at this time, step S9 can be executed. In this step, if the electrical parameters of the transmitting coil 110 are within the preset range, it can be determined that the first Hall sensor 122, the second Hall sensor 124, and the quality factor of the transmitting coil 110 are falsely triggered, and at this time, the process returns to step S1.
[0388] The stylus pen 20 offset detection method provided in the embodiment of the present application has at least the following beneficial effects: 1. The first Hall sensor 122 is located on the left side of the transmitting coil 110, and can detect the magnetic induction intensity and direction of its position, and output a first signal value. The second Hall sensor 124 is located on the right side of the transmitting coil 110, and can detect the magnetic induction intensity and direction of its position, and output a second signal value. In this way, after receiving the first signal value and the second signal value, the processor 150 can obtain the magnetic induction intensity and direction of the position where the first Hall sensor 122 is located, and the magnetic induction intensity and direction of the position where the second Hall sensor 124 is located. That is, the magnetic induction intensity and direction of the left side of the transmitting coil 110 and the magnetic induction intensity and direction of the right side of the transmitting coil 110 are obtained. In addition, the quality factor of the transmitting coil 110 is different when the stylus pen 20 is offset and when it is not offset. Based on this, it is possible to determine whether the stylus pen 20 is offset according to the quality factor of the transmitting coil 110, and determine the offset direction of the stylus pen 20 when it is offset according to the magnetic induction intensity and direction on the left side of the transmitting coil 110 and the magnetic induction intensity and direction on the right side of the transmitting coil 110. 2. By displaying a prompt screen, a prompt can be provided to move the stylus pen 20 in the opposite direction of the offset direction. 3. After the first Hall sensor 122 outputs the first signal value and the second Hall sensor 124 outputs the second signal value, if there is a possible offset of the stylus pen 20 (that is, the corresponding position indication information can be found in the corresponding relationship between the signal value and the position indication information), the screen resources required for displaying the prompt screen are configured, so that the delay time of displaying the prompt screen can be reduced and the user experience can be improved. 4. It is also possible to detect whether the stylus pen 20 is attached to the electronic device 10 by communicating with the stylus pen 20, and further determine whether the stylus pen 20 is offset by detecting the electrical parameters of the transmitting coil 110. In this way, the accuracy of offset detection can be improved.
[0389] The embodiment of the present application further provides a method for detecting the deviation of the stylus pen 20 , comprising the following steps S21 to S23 .
[0390] S21 , the processor 150 receives a first signal value output by the first Hall sensor 122 and a second signal value output by the second Hall sensor 124 .
[0391] S22 , the processor 150 detects the quality factor of the transmitting coil 110 .
[0392] S23: If the processor 150 determines that the stylus pen 20 is offset according to the first signal value, the second signal value and the quality factor of the transmitting coil 110 , a reminder message is output.
[0393] In some embodiments, the reminder information is used to remind that the adsorption position of the stylus pen 20 on the electronic device 10 is offset relative to the preset adsorption position. In some specific embodiments, the reminder information is also used to remind to move the stylus pen 20 in the opposite direction of the offset direction.
[0394] It can be understood that in some embodiments, when the first signal value is -1 or 0 and the second signal value is 0 or -1, the stylus pen 20 offset detection method may also only include step S21 and, if the processor 150 determines that the stylus pen 20 is offset based on the first signal value and the second signal value, outputs a reminder message.
[0395] The present application also provides an electronic device 10, such as Fig.44 As shown, the present invention comprises a transmitting coil 110, a first Hall sensor 122, a second Hall sensor 124, a memory 160, a processor 150, and a computer program stored in the memory 160 and executable on the processor 150. When the computer program is executed by the processor 150, the stylus pen 20 deviation detection method in any of the above embodiments is implemented.
[0396] The present application also provides an electronic device 10, such as Fig.44 As shown, the electronic device 10 includes a transmitting coil 110, a first Hall sensor 122, a second Hall sensor 124, a memory 160, a processor 150, and a computer program stored in the memory 160 and executable on the processor 150. The electronic device 10 is capable of detecting magnetic induction intensity.
[0397] Specifically, the first Hall sensor 122 can detect the magnetic induction intensity and direction of the position and output a first signal value, and the first signal value is used to characterize the magnetic induction intensity and direction of the position of the first Hall sensor 122. The second Hall sensor 124 can detect the magnetic induction intensity and direction of the position and output a second signal value, and the second signal value is used to characterize the magnetic induction intensity and direction of the position of the second Hall sensor 124. The processor 150 is used to receive the first signal value and the second signal value.
[0398] In some embodiments, when the computer program is executed by the processor 150 , the processor 150 detects the quality factor of the transmitting coil 110 .
[0399] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A stylus deviation detection method is applied to an electronic device, wherein the electronic device comprises a first Hall sensor, a second Hall sensor and a transmitting coil, wherein the first Hall sensor is located on the left side of the transmitting coil, and the second Hall sensor is located on the right side of the transmitting coil, wherein: The method comprises: receiving a first signal value output by the first Hall sensor and a second signal value output by the second Hall sensor, wherein the first signal value is used to characterize the magnetic induction intensity and direction at the location where the first Hall sensor is located, and the second signal value is used to characterize the magnetic induction intensity and direction at the location where the second Hall sensor is located; detecting a quality factor of the transmitting coil; Determining whether a stylus pen offset occurs according to the first signal value, the second signal value, and the quality factor of the transmitting coil, wherein the stylus pen offset is that a position of the stylus pen adsorbed on the electronic device is offset to the left or right relative to a preset adsorption position; The electronic device further comprises a capacitor, wherein a first plate of the capacitor is connected to a first end of the transmitting coil; The detecting the quality factor of the transmitting coil comprises: charging the capacitor and the transmitting coil until the capacitor and the transmitting coil are both in a steady state; Controlling the second electrode plate of the capacitor to be connected to the second end of the transmitting coil so that an oscillating electrical signal is generated between the first electrode plate of the capacitor and the first end of the transmitting coil; The quality factor of the transmitting coil is determined according to the n-1th amplitude and the nth amplitude among the multiple amplitudes of the oscillating electrical signal, where n is an integer greater than or equal to 2.
2. The method according to claim 1, characterized in that The determining whether the stylus pen offset occurs according to the first signal value, the second signal value and the quality factor of the transmitting coil includes: According to the first signal value and the second signal value, obtaining corresponding position indication information from the correspondence between the signal value and the position indication information, wherein the position indication information is used to indicate whether the position is offset to the left, offset to the right, or not offset relative to the preset adsorption position; Determine whether the stylus pen deflection occurs according to the position indication information and the quality factor of the transmitting coil.
3. The method according to claim 2, characterized in that The electronic device has a contact surface, and the stylus comes into contact with the contact surface when being adsorbed on the electronic device; When the magnetic induction intensity of the first Hall sensor at the location along a preset direction is greater than a preset intensity, the first signal value outputted is 1, and the preset direction is perpendicular to the contact surface and points to the inside of the electronic device; When the magnetic induction intensity of the first Hall sensor at the position in the opposite direction of the preset direction is greater than the preset intensity, the first signal value outputted is -1; When the magnetic induction intensity of the first Hall sensor at the location along the preset direction and the magnetic induction intensity along the opposite direction of the preset direction are both less than or equal to the preset intensity, the first signal value outputted is 0; When the magnetic induction intensity of the second Hall sensor at the position along the preset direction is greater than the preset intensity, the first signal value outputted is 1; When the magnetic induction intensity of the second Hall sensor at the position in the opposite direction of the preset direction is greater than the preset intensity, the first signal value outputted is -1; When the magnetic induction intensity of the second Hall sensor at the location along the preset direction and the magnetic induction intensity along the opposite direction of the preset direction are both less than or equal to the preset intensity, the output first signal value is 0.
4. The method according to claim 3, characterized in that The position indication information corresponding to the first signal value of -1 and the second signal value of 0 in the correspondence between the signal value and the position indication information indicates a leftward shift; The position indication information corresponding to the first signal value of 0 and the second signal value of -1 in the correspondence between the signal value and the position indication information indicates a rightward shift; The position indication information corresponding to the first signal value of 0 and the second signal value of 1 in the correspondence between the signal value and the position indication information indicates rightward shift or no shift; In the correspondence between the signal value and the position indication information, the position indication information corresponding to the first signal value of 1 and the second signal value of 0 indicates leftward shift or no shift.
5. The method according to claim 2, characterized in that The determining whether the stylus pen offset occurs according to the position indication information and the quality factor of the transmitting coil includes: If the position indication information indicates a leftward shift, and the quality factor of the transmitting coil is less than a first threshold, determining that the adsorption position of the stylus pen is offset to the left relative to the preset adsorption position; If the position indication information indicates a rightward shift, and the quality factor of the transmitting coil is less than a first threshold, determining that the adsorption position of the stylus pen is offset to the right relative to the preset adsorption position; If the position indication information indicates a leftward shift or no shift, and the quality factor of the transmitting coil is less than a first threshold, determining that the adsorption position of the stylus pen is shifted to the left relative to the preset adsorption position; If the position indication information indicates a leftward shift or no shift, and the quality factor of the transmitting coil is greater than a second threshold, it is determined that the stylus pen does not shift; If the position indication information indicates a rightward shift or no shift, and the quality factor of the transmitting coil is less than a first threshold, determining that the adsorption position of the stylus pen is shifted to the right relative to the preset adsorption position; If the position indication information indicates a rightward shift or no shift, and the quality factor of the transmitting coil is greater than a second threshold, it is determined that the stylus pen does not shift.
6. The method according to any one of claims 1 to 5, characterized in that: After receiving the first signal value output by the first Hall sensor and the second signal value output by the second Hall sensor, the method further includes: According to the first signal value and the second signal value, obtaining corresponding position indication information from the correspondence between the signal value and the position indication information, wherein the position indication information is used to indicate whether the position is offset to the left, offset to the right, or not offset relative to the preset adsorption position; Screen resources are configured according to the position indication information, where the screen resources are resources required when displaying a prompt screen corresponding to the position indication information, and the prompt screen is used to prompt the stylus to move in a direction opposite to the offset direction.
7. The method according to claim 6, characterized in that After determining whether the stylus pen offset occurs according to the first signal value, the second signal value and the quality factor of the transmitting coil, the method further includes: If the stylus is offset, the screen resource is used to display the prompt screen.
8. The method according to any one of claims 1 to 5, characterized in that Before determining whether the stylus pen offset occurs according to the first signal value, the second signal value and the quality factor of the transmitting coil, the method further includes: sending a communication signal; The determining whether the stylus pen offset occurs according to the first signal value, the second signal value and the quality factor of the transmitting coil includes: If a feedback signal for the communication signal is received within a preset time period after the communication signal is sent, it is determined whether the stylus deviation occurs according to the first signal value, the second signal value and the quality factor of the transmitting coil.
9. The method according to claim 1, characterized in that The electronic device further comprises a first switch, a second switch and a third switch, wherein the first end of the first switch is used to be connected to the positive electrode of the power supply, the second end of the first switch is connected to the second plate of the capacitor and the first end of the second switch, the first end of the third switch is connected to the second end of the transmitting coil, and the second end of the second switch and the second end of the third switch are both used to be connected to the negative electrode of the power supply; The charging the capacitor and the transmitting coil comprises: Controlling the second switch to be turned off, and controlling the first switch and the third switch to be turned on, so as to charge the capacitor and the transmitting coil; The second electrode plate controlling the capacitor is connected to the second end of the transmitting coil, comprising: The first switch is controlled to be turned off, and the second switch and the third switch are controlled to be turned on, so that the second plate of the capacitor is connected to the second end of the transmitting coil.
10. The method according to claim 1 or 9, characterized in that: Determining the quality factor of the transmitting coil according to the n-1th amplitude and the nth amplitude among the multiple amplitudes of the oscillating electrical signal includes: According to the n-1th amplitude and the nth amplitude, the quality factor of the transmitting coil is determined by the following formula: Among them, is the quality factor of the transmitting coil, is the n-1th amplitude, is the nth amplitude, is pi, and is the logarithm with a natural constant as the base.
11. A stylus deviation detection method, applied to an electronic device, the electronic device comprising a first Hall sensor, a second Hall sensor and a transmitting coil, the first Hall sensor being located on the left side of the transmitting coil, the second Hall sensor being located on the right side of the transmitting coil, characterized in that: The method comprises: receiving a first signal value output by the first Hall sensor and a second signal value output by the second Hall sensor, wherein the first signal value is used to characterize the magnetic induction intensity and direction at the location where the first Hall sensor is located, and the second signal value is used to characterize the magnetic induction intensity and direction at the location where the second Hall sensor is located; detecting a quality factor of the transmitting coil; If it is determined that a stylus pen offset occurs according to the first signal value, the second signal value, and the quality factor of the transmitting coil, a reminder message is output, where the reminder message is used to remind that the stylus pen offset occurs, and the stylus pen offset is that the adsorption position of the stylus pen adsorbed on the electronic device is offset to the left or right relative to a preset adsorption position; The electronic device further comprises a capacitor, wherein a first plate of the capacitor is connected to a first end of the transmitting coil; The detecting the quality factor of the transmitting coil comprises: charging the capacitor and the transmitting coil until the capacitor and the transmitting coil are both in a steady state; Controlling the second electrode plate of the capacitor to be connected to the second end of the transmitting coil, so that an oscillating electrical signal is generated between the first electrode plate of the capacitor and the first end of the transmitting coil; The quality factor of the transmitting coil is determined according to the n-1th amplitude and the nth amplitude among the multiple amplitudes of the oscillating electrical signal, where n is an integer greater than or equal to 2.
12. The method according to claim 11, characterized in that The reminder information is also used to remind the user to move the stylus pen in the opposite direction of the offset direction.
13. An electronic device, characterized in that: The electronic device comprises a transmitting coil, a first Hall sensor, a second Hall sensor, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the method according to any one of claims 1 to 12 when executed by the processor.
