Method, device, faucet and storage medium for detecting faucet opening and closing angle
By correcting the mapping relationship between the faucet valve core and the output voltage of the magnetic field sensor, the problem of low accuracy in calculating the opening and closing angle in the existing technology is solved, and higher calculation accuracy is achieved.
Patent Information
- Application Number
- CN201911126306.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-11-18
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2039-11-18
AI Technical Summary
In the existing technology, the accuracy of the calculation results of the opening and closing angle of the faucet valve core is low, mainly due to the linear relationship calculation failure caused by the position error between the magnet and the magnetic field sensor after multiple rotations and the magnetization error of the magnet.
By determining the value range based on the detection voltage output by the magnetic field sensor, the mapping relationship between the opening and closing angle of the faucet valve core and the detection voltage is corrected, and the opening and closing angle is calculated using the corrected mapping relationship to improve the accuracy of the calculation results.
Through the revised mapping relationship, the accuracy of the calculation results of the opening and closing angle of the faucet valve core is significantly improved, and calculation errors caused by magnet rotation and magnetization errors are reduced.
Smart Images

Figure CN112815826B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of faucets, and in particular to a method and device for detecting the opening and closing angle of a faucet, a faucet, and a storage medium. Background Art
[0002] At present, the opening and closing angle of the faucet valve core can be detected by the relative movement of the magnetic field sensor and the magnet. When the magnet rotates, there is a linear relationship between the opening and closing angle of the faucet valve core and the output voltage of the magnetic field sensor.
[0003] However, if the above linear relationship is used to calculate the opening and closing angle, the following conditions must be met: the position of the magnet and the magnetic field sensor cannot have a large error after multiple rotations; the magnetization intensity must not only meet the linearity requirement, but also the magnetic induction intensity at the two end points of rotation (N extreme point and S extreme point) must be within a certain error range.
[0004] However, in practical applications, errors after multiple movements of the magnet and errors in magnetization are inevitable, so using the above linear relationship to calculate the opening and closing angles will result in poor accuracy of the calculation results. Summary of the invention
[0005] The present application aims to solve one of the technical problems in the related art at least to some extent.
[0006] The present application proposes a method, device, faucet and storage medium for detecting the opening and closing angle of a faucet, so as to improve the accuracy of the calculation results of the opening and closing angle, and to solve the technical problem of low accuracy of the calculation results of the opening and closing angle in the prior art.
[0007] The first embodiment of the present application provides a method for detecting the opening and closing angle of a faucet, comprising:
[0008] Determining a value range of the detection voltage according to the detection voltage output by the magnetic field sensor;
[0009] According to the value range, the mapping relationship between the opening and closing angle of the faucet valve core and the detection voltage is corrected;
[0010] According to the corrected mapping relationship, the opening and closing angle corresponding to the detection voltage output by the magnetic field sensor is determined.
[0011] The method for detecting the opening and closing angle of the faucet in the embodiment of the present application determines the value range of the detection voltage according to the detection voltage output by the magnetic field sensor, and corrects the mapping relationship between the opening and closing angle of the faucet valve core and the detection voltage according to the value range, and finally determines the opening and closing angle corresponding to the detection voltage output by the magnetic field sensor according to the corrected mapping relationship. Therefore, by calculating the opening and closing angle of the faucet valve core through the corrected mapping relationship, the accuracy of the calculation result of the opening and closing angle can be improved.
[0012] The second embodiment of the present application provides a device for detecting the opening and closing angle of a faucet, comprising:
[0013] A determination module, used to determine a value range of the detection voltage according to the detection voltage output by the magnetic field sensor;
[0014] A correction module, used to correct the mapping relationship between the opening and closing angle of the faucet valve core and the detection voltage according to the value range;
[0015] The detection module is used to determine the opening and closing angle corresponding to the detection voltage output by the magnetic field sensor according to the corrected mapping relationship.
[0016] The faucet opening and closing angle detection device of the embodiment of the present application determines the value range of the detection voltage according to the detection voltage output by the magnetic field sensor, and corrects the mapping relationship between the opening and closing angle of the faucet valve core and the detection voltage according to the value range, and finally determines the opening and closing angle corresponding to the detection voltage output by the magnetic field sensor according to the corrected mapping relationship. Therefore, by calculating the opening and closing angle of the faucet valve core through the corrected mapping relationship, the accuracy of the calculation result of the opening and closing angle can be improved.
[0017] The third aspect of the present application provides a faucet, including: a faucet body, a valve core and a control unit;
[0018] The valve core is provided with a magnet, and the magnet rotates circumferentially with the rotation of the valve core; wherein the magnet is arc-shaped, the magnetic field strength at different locations of the arc is different, and the central angle of the arc is greater than the maximum opening and closing angle of the valve core;
[0019] The faucet body is provided with a magnetic field sensor, and the magnetic field sensor is used to output a corresponding detection voltage according to the magnetic field strength;
[0020] The control unit is connected to the magnetic field sensor; the control unit includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the method for detecting the opening and closing angle of the faucet as proposed in the first aspect of the embodiment of the present application is implemented.
[0021] The fourth aspect embodiment of the present application proposes a non-temporary computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the method for detecting the opening and closing angle of the faucet as proposed in the first aspect embodiment of the present application is implemented.
[0022] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0024] Figure 1 A schematic diagram of the relative position relationship between an existing magnetic field sensor and a magnet;
[0025] Figure 2 Schematic diagram of magnet Figure 1 ;
[0026] Figure 3 Schematic diagram of magnet Figure 2 ;
[0027] Figure 4 Schematic diagram of the magnet rotation process Figure 1 ;
[0028] Figure 5 A schematic diagram showing the relationship between the detection voltage and the magnetic induction intensity;
[0029] Figure 6 A schematic diagram of the flow of a method for detecting the opening and closing angle of a faucet provided in the first embodiment of the present application;
[0030] Figure 7 Schematic diagram of the magnet rotation process Figure 2 ;
[0031] Figure 8 A schematic diagram of the flow of a method for detecting the opening and closing angle of a faucet provided in the second embodiment of the present application;
[0032] Fig. 9 A schematic diagram of the structure of a device for detecting the opening and closing angle of a faucet provided in the third embodiment of the present application;
[0033] Fig.10 This is a schematic diagram of the structure of the faucet opening and closing angle detection device provided in Example 4 of the present application. DETAILED DESCRIPTION
[0034] Embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
[0035] At present, the opening and closing angle of the faucet valve core can be detected by the relative movement between the magnetic field sensor and the arc-shaped magnet. The relative position relationship between the magnetic field sensor and the magnet can be as follows: Figure 1 As shown, the magnetic field sensor 11 can be close to the inner arc surface or the outer arc surface of the magnet 12, and one of the magnet 12 and the magnetic field sensor 11 is kept fixed, while the other one moves relatively along the circumferential direction.
[0036] Arc-shaped magnets can be Figure 2 and Figure 3 As shown, on the inner arc surface of the magnet, the change of magnetic field intensity from the S pole to the N pole is: gradually and evenly decreases to 0Gs (middle position), and then gradually and evenly increases from 0Gs. On the outer arc surface of the magnet, the change of magnetic field intensity from the N pole to the S pole is: gradually and evenly decreases to 0Gs (middle position), and then gradually and evenly increases from 0Gs. The magnetic induction intensity of the magnet changes linearly, with 0Gs in the middle, -B at the N pole, and B at the S pole. Among them, the magnetic induction intensity -B~B is within the sensing range of the magnetic field sensor. If the sensing range of the magnetic field sensor is -C~C, then: -C<-B, C>B is satisfied.
[0037] Take the magnetic field sensor close to the outer arc surface of the magnet as an example. When the magnetic field sensor is fixed and the magnet rotates circumferentially, assuming that the maximum rotation angle of the magnet is 90° (the central angle of the arc is 90°), the initial relative position of the magnet and the magnetic field sensor is ① (0°), that is, the N end of the magnet is aligned with the magnetic field sensor. When the magnet rotates counterclockwise, it passes through position ② and finally reaches position ③ (90°), that is, the S end of the magnet is aligned with the magnetic field sensor.
[0038] As an example, when the magnetic field sensor is close to the outer arc surface of the magnet, the magnet can be set on the valve core, see Figure 4 , when the valve core of the faucet rotates to the minimum opening and closing angle (for example, 0°), the N end of the magnet is aligned with the magnetic field sensor. When the magnet rotates circumferentially with the rotation of the valve core, for example, when the valve core of the faucet rotates to the maximum opening and closing angle (for example, 90°), the S end of the magnet is aligned with the magnetic field sensor. Therefore, in theory, the magnetic induction intensity of the magnet at position ① is -B, and the induced output voltage of the magnetic field sensor is V0; the magnetic induction intensity of the magnet at position ③ is B, and the induced output voltage of the magnetic field sensor is V2. The rotation angle is 90°. Since the change of the magnetic induction intensity of the outer arc surface is linear, the change of the output voltage of the magnetic field sensor is also linear (see Figure 5), the corresponding linear relationship between the opening and closing angle θ of the faucet valve core and the output voltage V of the magnetic field sensor can be obtained as follows:
[0039]
[0040] However, if the above linear relationship is used to calculate the opening and closing angle, the following conditions must be met: on the one hand, structurally, the position of the magnet and the magnetic field sensor cannot have a large error after multiple rotations; on the other hand, the magnetization intensity of the magnet must not only meet the linearity requirement, but also the magnetic induction intensity at the two end points of the rotation (positions ① and ③) must be within a certain error range, otherwise it will affect the calculation of the opening and closing angle.
[0041] However, in practical applications, errors after multiple movements of the magnet and errors in magnetization are inevitable, so using the above linear relationship to calculate the opening and closing angles will result in poor accuracy of the calculation results.
[0042] This application mainly aims at the technical problem that the calculation results of the opening and closing angles in the prior art are not accurate enough, and proposes a method for detecting the opening and closing angles of a faucet.
[0043] The method for detecting the opening and closing angle of the faucet in the embodiment of the present application determines the value range of the detection voltage according to the detection voltage output by the magnetic field sensor, and corrects the mapping relationship between the opening and closing angle of the faucet valve core and the detection voltage according to the value range, and finally determines the opening and closing angle corresponding to the detection voltage output by the magnetic field sensor according to the corrected mapping relationship. Therefore, by calculating the opening and closing angle of the faucet valve core through the corrected mapping relationship, the accuracy of the calculation result of the opening and closing angle can be improved.
[0044] The following describes the method, device, faucet and storage medium for detecting the opening and closing angle of a faucet according to an embodiment of the present application with reference to the accompanying drawings.
[0045] Figure 6 This is a flow chart of the method for detecting the opening and closing angle of a faucet provided in the first embodiment of the present application.
[0046] like Figure 6 As shown, the method for detecting the opening and closing angle of the faucet may include the following steps:
[0047] Step 101, determining a value range of a detection voltage according to a detection voltage output by a magnetic field sensor.
[0048] The magnetic field sensor is a sensor that can detect the magnetic field strength, such as a linear Hall element, or other sensors, which are not limited to this. Specifically, the magnetic field sensor can output a corresponding detection voltage according to the magnetic field strength.
[0049] In the embodiment of the present application, one of the magnetic field sensor and the magnet can be kept fixed, and the other can move relative to the other in the circumferential direction. For example, the magnetic field sensor can be kept stationary and the magnet can be rotated in the circumferential direction, or the magnet can be kept stationary and the magnetic field sensor can be rotated around the magnet in the circumferential direction. The present application does not limit this. The magnetic field sensor can be close to the inner arc surface of the magnet, or the magnetic field sensor can be close to the outer arc surface of the magnet.
[0050] For ease of explanation, the present application takes the example of keeping the magnetic field sensor stationary and the magnet moving circumferentially. For example, when the magnetic field sensor is kept stationary, the magnet can be set on the valve core, and the magnet can rotate circumferentially with the rotation of the valve core. When the magnet rotates, the magnetic field sensor can sense the change of the magnetic field, and output a corresponding detection voltage according to the magnetic field strength. Therefore, based on the detection voltage output by the magnetic field sensor, the value range of the detection voltage can be determined.
[0051] Step 102: Correct the mapping relationship between the opening and closing angle of the faucet valve core and the detection voltage according to the value range.
[0052] It should be noted that when the magnet rotates for a long time, the position between the magnet and the magnetic field sensor may deviate. For example, when the magnetic field sensor is close to the outer arc surface of the magnet, the relative position between the magnet and the magnetic field sensor may deviate. Figure 4 Changes to Figure 7 , at this time, there will be an angle error between the magnet and the magnetic field sensor. Figure 4 In the example, when the valve core of the faucet rotates to the minimum opening and closing angle (for example, 0°), the N end of the magnet is aligned with the magnetic field sensor, the magnetic induction intensity is -B, and the detection voltage output by the magnetic field sensor is V0. When the valve core of the faucet rotates to the maximum opening and closing angle (for example, 90°), the magnet rotates counterclockwise with the rotation of the valve core, and the S end of the magnet is aligned with the magnetic field sensor, the magnetic induction intensity is B, and the detection voltage output by the magnetic field sensor is V2. At this time, the corresponding opening and closing angle can be calculated according to formula (1) and the detection voltage output by the magnetic field sensor. However, when an angle error occurs between the magnet and the magnetic field sensor, the marked angle error is △A. When the valve core of the faucet rotates to the minimum opening and closing angle, the N end of the magnet is not aligned with the magnetic field sensor. At this time, the detection voltage output by the magnetic field sensor is not V0. Moreover, when the valve core of the faucet rotates to the maximum opening and closing angle, the S end of the magnet is not aligned with the magnetic field sensor. At this time, the detection voltage output by the magnetic field sensor is not V2. If the mapping relationship corresponding to formula (1) is used to calculate the corresponding opening and closing angle, the accuracy of the calculation result will be low.
[0053] Therefore, in this application, in order to improve the accuracy of the opening and closing angle calculation results, it is necessary to correct the mapping relationship between the opening and closing angle of the faucet valve core and the detection voltage, for example, to correct formula (1), for example, the slope parameter and intercept parameter in formula (1) can be corrected.
[0054] As a possible implementation method, an initial mapping relationship can be obtained, where the mapping relationship is a linear relationship, including a slope parameter and an intercept parameter; then, the slope parameter and the intercept parameter can be corrected according to the difference between the maximum voltage and the minimum voltage in the value range to obtain a corrected mapping relationship.
[0055] Step 103: determining the opening and closing angle corresponding to the detection voltage output by the magnetic field sensor according to the corrected mapping relationship.
[0056] In the embodiment of the present application, after obtaining the corrected mapping relationship, the detection voltage value output by the magnetic field sensor can be substituted into the above mapping relationship to calculate the opening and closing angle of the faucet valve core.
[0057] The method for detecting the opening and closing angle of the faucet in the embodiment of the present application determines the value range of the detection voltage according to the detection voltage output by the magnetic field sensor, and corrects the mapping relationship between the opening and closing angle of the faucet valve core and the detection voltage according to the value range, and finally determines the opening and closing angle corresponding to the detection voltage output by the magnetic field sensor according to the corrected mapping relationship. Therefore, by calculating the opening and closing angle of the faucet valve core through the corrected mapping relationship, the accuracy of the calculation result of the opening and closing angle can be improved.
[0058] It should be noted that during the long-term rotation of the magnet, the position between the magnet and the magnetic field sensor may deviate. For example, the relative position between the magnet and the magnetic field sensor is Figure 4 Changes to Figure 7 , an angle error will occur between the magnet and the magnetic field sensor. If the center angle of the arc-shaped magnet is the same as the maximum opening and closing angle of the valve core, when an angle error occurs, the magnetic field sensor may be outside the coupling range of the magnet. Therefore, in this application, in order to ensure that the magnetic field sensor is still within the coupling range of the magnet when the position between the magnet and the magnetic field sensor deviates during long-term rotation, the center angle of the arc of the magnet can be greater than the maximum opening and closing angle of the valve core. For example, when the maximum opening and closing angle of the valve core is 90 degrees, the center angle of the arc can be 95 degrees. When the valve core rotates to the minimum opening and closing angle, such as 0°, the magnetic induction intensity is in the range of -B+△B~-B, and when the valve core rotates to the maximum opening and closing angle, such as 90°, the magnetic induction intensity is in the range of B-△B~B. Among them, the △B value meets the angle measurement accuracy and rotation angle error.
[0059] For example, when the maximum opening and closing angle of the valve core is 90°, the angle measurement accuracy changes from 90 / 2B to 90 / 2(B-△B), and the accuracy decreases. When the valve core rotates to 0°-△A, the magnetic induction intensity is ≥-B; when the valve core rotates to 90°+△A, the magnetic induction intensity is ≤B.
[0060] In order to clearly explain the previous embodiment, this embodiment provides another method for detecting the opening and closing angle of a faucet. Figure 8 This is a schematic flow chart of the method for detecting the opening and closing angle of a faucet provided in the second embodiment of the present application.
[0061] like Figure 8 As shown, the method for detecting the opening and closing angle of the faucet may include the following steps:
[0062] Step 201, determining a value range of the detection voltage according to the detection voltage output by the magnetic field sensor.
[0063] The execution process of step 201 may refer to the execution process of step 101 in the above embodiment, and will not be described in detail here.
[0064] Step 202: obtaining an initial mapping relationship, wherein the mapping relationship is a linear relationship including a slope parameter and an intercept parameter.
[0065] In the embodiment of the present application, the initial mapping relationship is a linear relationship, including a slope parameter and an intercept parameter. For example, the slope parameter is marked as K and the intercept parameter is marked as B. The initial mapping relationship can be expressed by formula (2):
[0066] θ=K*V+b; (2)
[0067] Among them, θ represents the opening and closing angle of the valve core, and V represents the detection voltage output by the magnetic field sensor.
[0068] It can be understood that according to formula (1), the numerator in the slope parameter is the maximum opening and closing angle of the valve core, such as 90°, and the numerator in the intercept parameter is the maximum opening and closing angle of the valve core, multiplied by the detection voltage induced by the magnetic field sensor when the valve core rotates to the minimum opening and closing angle. For example, when the minimum opening and closing angle is 0°, the numerator in the intercept parameter is the product of the maximum opening and closing angle and the detection voltage V0 induced by the magnetic field sensor at the N end of the magnet. Among them, the denominators of the slope parameter and the intercept parameter are equal.
[0069] It should be understood that as the magnet rotates for a long time, when the valve core of the faucet rotates to the maximum opening and closing angle, the S end of the magnet may not be aligned with the magnetic field sensor. At this time, the detection voltage output by the magnetic field sensor is not V2. Similarly, when the valve core of the faucet rotates to the minimum opening and closing angle, the N end of the magnet may not be aligned with the magnetic field sensor. At this time, the detection voltage output by the magnetic field sensor is not V0. Therefore, the denominator of the slope parameter and the intercept parameter is not V2-V0. Therefore, it is necessary to redefine the denominator of the slope parameter and the intercept parameter in the initial mapping relationship.
[0070] As a possible implementation method, in the initial mapping relationship, the denominators of the slope parameter and the intercept parameter are both initial differences, and the initial differences are the difference between the first initial value and the second initial value, wherein the first initial value is the detection voltage output by the magnetic field sensor when the valve core of the faucet is rotated to the maximum opening and closing angle (for example, 90°) so that the first position of the magnet is aligned with the magnetic field sensor; the second initial value is the detection voltage output by the magnetic field sensor when the valve core of the faucet is rotated to the minimum opening and closing angle (for example, 0°) so that the second position of the magnet is aligned with the magnetic field sensor; there is a set distance between the first position and the second position and the end of the magnet.
[0071] That is to say, as the magnet rotates for a long time, when the valve core of the faucet rotates to the maximum opening and closing angle, the S extreme end of the magnet may not be aligned with the magnetic field sensor. At this time, the magnetic field sensor may be aligned with the first position of the magnet, wherein the first position has a set distance from the S extreme end of the magnet. Similarly, when the valve core of the faucet rotates to the minimum opening and closing angle, the N extreme end of the magnet may not be aligned with the magnetic field sensor. At this time, the magnetic field sensor may be aligned with the second position of the magnet, wherein the second position has a set distance from the N extreme end of the magnet.
[0072] For example, the first initial value is marked as D1, the second initial value is marked as D2, the initial difference is D, then D=D1-D2, the maximum opening angle is θ1, and the initial mapping relationship can be expressed by formula (3):
[0073]
[0074] For example, when the maximum opening and closing angle of the valve core is 90° and the minimum opening and closing angle is 0°, when the system is initially powered on and the latest detection voltage is not detected, the default corresponding relationship between the opening and closing angle and the detection voltage can be shown in Table 1:
[0075] Opening angle Detection voltage 0° <![CDATA[D2=V0+△V 01 ]]> 90° <![CDATA[D1=V2-△V 21 ]]>
[0076] Table 1
[0077] Among them, △V 01Indicates that when the maximum deviation may occur, the valve core of the faucet rotates to the minimum opening and closing angle, and the difference between the detection voltage output by the magnetic field sensor and V0; △V 21 It indicates that when the maximum deviation may occur, the valve core of the faucet rotates to the maximum opening and closing angle, and the difference between the detection voltage output by the magnetic field sensor and V2.
[0078] Then formula (3) can be transformed into formula (4):
[0079]
[0080] The slope parameter is The intercept parameter is
[0081] Step 203: Correct the slope parameter and the intercept parameter according to the difference between the maximum voltage and the minimum voltage in the value range to obtain a corrected mapping relationship.
[0082] In an embodiment of the present application, when the faucet operates normally, the magnetic field sensor can be used in real time to detect the detection voltage corresponding to the valve core rotating to different opening and closing angles, and the denominator of the slope parameter and the denominator of the intercept parameter can be corrected according to the difference between the maximum voltage and the minimum voltage in the value range of the detection voltage.
[0083] For example, when it is detected that the detection voltage output by the magnetic field sensor is greater than the first initial value D1, for example, the detection voltage is greater than V2-ΔV in Table 1 21 When the detection voltage is less than the second initial value D2, for example, the detection voltage is less than V0+△V in Table 1. 01 When , the range between the detection voltage and the first initial value can be used as the value range, that is, D2 in formula (3) is replaced by the detection voltage output by the magnetic field sensor, so as to obtain a corrected mapping relationship.
[0084] For example, if the tag value range is [Vmin, Vmax], then formula (3) can be transformed into formula (5):
[0085]
[0086] The slope parameter is The intercept parameter is
[0087] Step 204: determining the opening and closing angle corresponding to the detection voltage output by the magnetic field sensor according to the corrected mapping relationship.
[0088] In the embodiment of the present application, the detection voltage output by the magnetic field sensor can be brought into the corrected mapping relationship to calculate the corresponding opening and closing angle of the valve core, so that relevant load control can be performed based on the calculated opening and closing angle.
[0089] As an example, take the magnetic field sensor as a linear Hall element, and assume that the maximum opening and closing angle of the valve core is 90° and the minimum opening and closing angle is 0°. In order to improve the accuracy of the calculation results of the opening and closing angle of the faucet valve core, in this application, we can start from the design of the magnet and the angle calculation process to eliminate errors:
[0090] 1. Magnet design
[0091] The errors that need to be avoided in magnet design are mainly at the two ends (N extreme and S extreme, i.e. 0° and 90°). In order to ensure that the magnet rotates for a long time, when the position of the magnet and the linear Hall element deviates, the magnetic field sensor is still within the coupling range of the magnet, the magnet size must be larger than the rotation angle of 90°, that is, the center angle of the arc of the magnet is larger than the maximum opening and closing angle of 90° of the valve core, and when the valve core rotates to the minimum opening and closing angle of 0°, the magnetic induction intensity is within the range of -B+△B~-B, and when the valve core rotates to the maximum opening and closing angle of 90°, the magnetic induction intensity is within the range of B-△B~B. Among them, the △B value meets the angle measurement accuracy and rotation angle error.
[0092] 2. Angle calculation process
[0093] Based on the above magnet size and magnetic induction strength design, during the faucet rotation operation, the error can be gradually eliminated through the algorithm to achieve accurate measurement of the opening and closing angle. The details are as follows:
[0094] first step:
[0095] When the system is initially powered on and the latest detection voltage output by the linear Hall element is not detected, the default corresponding relationship between the opening and closing angle and the detection voltage is as follows:
[0096] Opening angle Detection voltage 0° <![CDATA[V0+△V 01 ]]> 90° <![CDATA[V2-△V 21 ]]>
[0097] According to the above parameters, the mapping relationship between the opening and closing angle and the detection voltage can be obtained as follows:
[0098]
[0099] Satisfies a linear equation, where the slope parameter is The intercept parameter is △V 01 Indicates that when the maximum deviation may occur, the valve core of the faucet rotates to the minimum opening and closing angle of 0°, and the difference between the detection voltage output by the magnetic field sensor and V0; △V 21It indicates that when the maximum deviation may occur, the valve core of the faucet rotates to the maximum opening and closing angle of 90 degrees, and the difference between the detection voltage output by the magnetic field sensor and V2.
[0100] Step 2:
[0101] The faucet is operating normally, and the detection voltage values corresponding to different opening and closing angles are detected in real time. When the detection voltage output by the magnetic field sensor is detected to be less than V0+△V 01 When the voltage value of the magnetic field sensor is greater than V2-△V, the detection voltage is used as the latest minimum voltage value Vmin; when the detection voltage output by the magnetic field sensor is detected to be greater than V2-△V 21 When the voltage value reaches a certain value, the detected voltage is taken as the latest maximum voltage value Vmax.
[0102] At this time, the mapping relationship between the opening and closing angle and the detection voltage is:
[0103] Opening angle Detection voltage 0° Vmin 90° Vmax
[0104] According to the above parameters, the mapping relationship between the opening and closing angle and the detection voltage can be obtained as follows:
[0105]
[0106] Satisfies a linear equation, where the slope parameter is The intercept parameter is
[0107] At this time, the latest opening and closing angle value after eliminating the error can be obtained based on the latest mapping relationship.
[0108] Step 3:
[0109] According to the latest opening and closing angle value, relevant load control is performed.
[0110] The method for detecting the opening and closing angle of the faucet in the embodiment of the present application determines the value range of the detection voltage according to the detection voltage output by the magnetic field sensor, and corrects the mapping relationship between the opening and closing angle of the faucet valve core and the detection voltage according to the value range, and finally determines the opening and closing angle corresponding to the detection voltage output by the magnetic field sensor according to the corrected mapping relationship. Therefore, by calculating the opening and closing angle of the faucet valve core through the corrected mapping relationship, the accuracy of the calculation result of the opening and closing angle can be improved.
[0111] In order to implement the above-mentioned embodiment, the present application also proposes a device for detecting the opening and closing angle of a faucet.
[0112] Fig. 9 This is a schematic diagram of the structure of the faucet opening and closing angle detection device provided in Example 3 of the present application.
[0113] like Fig. 9As shown, the faucet opening and closing angle detection device includes: a determination module 110 , a correction module 120 and a detection module 130 .
[0114] The determination module 110 is used to determine a value range of the detection voltage according to the detection voltage output by the magnetic field sensor.
[0115] The correction module 120 is used to correct the mapping relationship between the opening and closing angle of the faucet valve core and the detection voltage according to the value range.
[0116] The detection module 130 is used to determine the opening and closing angle corresponding to the detection voltage output by the magnetic field sensor according to the corrected mapping relationship.
[0117] Further, in a possible implementation of the embodiment of the present application, see Fig.10 ,exist Fig. 9 Based on the embodiment shown, the faucet opening and closing angle detection device may further include:
[0118] As a possible implementation, the correction module 120 includes:
[0119] The acquisition submodule 121 is used to acquire an initial mapping relationship, wherein the mapping relationship is a linear relationship including a slope parameter and an intercept parameter.
[0120] The correction submodule 122 is used to correct the slope parameter and the intercept parameter according to the difference between the maximum voltage and the minimum voltage in the value range to obtain a corrected mapping relationship.
[0121] As a possible implementation manner, the correction submodule 122 is specifically configured to correct the denominator of the slope parameter and the denominator of the intercept parameter according to the difference.
[0122] As a possible implementation method, in the initial mapping relationship, the denominators of the slope parameter and the intercept parameter are both initial differences, and the initial difference is the difference between the first initial value and the second initial value; wherein, the first initial value is the detection voltage output by the magnetic field sensor when the valve core of the faucet is rotated to the maximum opening and closing angle so that the first position of the magnet is aligned with the magnetic field sensor; the second initial value is the detection voltage output by the magnetic field sensor when the valve core of the faucet is rotated to the minimum opening and closing angle so that the second position of the magnet is aligned with the magnetic field sensor; there is a set distance between the first position and the second position and the end of the magnet.
[0123] As a possible implementation method, the determination module 110 is specifically used to: determine that the detection voltage output by the magnetic field sensor is greater than the first initial value, then use the range between the second initial value and the detection voltage as the value range; determine that the detection voltage output by the magnetic field sensor is less than the second initial value, then use the range between the detection voltage and the first initial value as the value range.
[0124] It should be noted that the aforementioned explanation of the embodiment of the faucet opening and closing angle detection method is also applicable to the faucet opening and closing angle detection device of this embodiment, and the implementation principle is similar, which will not be repeated here.
[0125] The faucet opening and closing angle detection device of the embodiment of the present application determines the value range of the detection voltage according to the detection voltage output by the magnetic field sensor, and corrects the mapping relationship between the opening and closing angle of the faucet valve core and the detection voltage according to the value range, and finally determines the opening and closing angle corresponding to the detection voltage output by the magnetic field sensor according to the corrected mapping relationship. Therefore, by calculating the opening and closing angle of the faucet valve core through the corrected mapping relationship, the accuracy of the calculation result of the opening and closing angle can be improved.
[0126] In order to implement the above embodiment, the present application also proposes a faucet, including: a faucet body, a valve core and a control unit.
[0127] The valve core is provided with a magnet, which rotates circumferentially with the rotation of the valve core; the magnet is arc-shaped, the magnetic field strength at different locations of the arc is different, and the central angle of the arc is greater than the maximum opening and closing angle of the valve core.
[0128] The faucet body is provided with a magnetic field sensor, and the magnetic field sensor is used to output a corresponding detection voltage according to the magnetic field strength.
[0129] A control unit is connected to the magnetic field sensor; the control unit includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the method for detecting the opening and closing angle of the faucet as proposed in the aforementioned embodiment of the present application is implemented.
[0130] In the embodiment of the present application, an example is given in which the magnetic field sensor is kept stationary and the magnet moves circumferentially. For example, when the magnetic field sensor is kept stationary, the magnet can be set on the valve core, and the magnet can rotate circumferentially with the rotation of the valve core. When the magnet rotates, the magnetic field sensor can sense the change of the magnetic field and output a corresponding detection voltage according to the magnetic field strength.
[0131] As a possible implementation, the magnetic field sensor is a linear Hall element.
[0132] As another possible implementation manner, the magnetic field sensor is close to the inner arc surface or the outer arc surface of the magnet.
[0133] It should be noted that the aforementioned explanation of the embodiment of the method for detecting the opening and closing angle of the faucet is also applicable to the faucet of this embodiment, and the implementation principle is similar, which will not be repeated here.
[0134] In order to implement the above embodiments, the present application also proposes a non-temporary computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method for detecting the opening and closing angle of the faucet proposed in the above embodiments of the present application is implemented.
[0135] It should be noted that the aforementioned explanation of the embodiment of the method for detecting the opening and closing angle of the faucet is also applicable to the computer-readable storage medium of this embodiment, and its implementation principle is similar, which will not be repeated here.
[0136] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0137] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0138] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0139] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute the instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.
[0140] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0141] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0142] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0143] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present application. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A method for detecting the opening and closing angle of a faucet, characterized in that: include: Determining a value range of the detection voltage according to the detection voltage output by the magnetic field sensor; According to the value range, the mapping relationship between the opening and closing angle of the faucet valve core and the detection voltage is corrected; Determining the opening and closing angle corresponding to the detection voltage output by the magnetic field sensor according to the corrected mapping relationship; The step of correcting the mapping relationship between the opening and closing angle of the faucet valve core and the detection voltage according to the value range includes: Acquire an initial mapping relationship, wherein the mapping relationship is a linear relationship including a slope parameter and an intercept parameter; According to the difference between the maximum voltage and the minimum voltage in the value range, the slope parameter and the intercept parameter are corrected to obtain a corrected mapping relationship; The step of correcting the slope parameter and the intercept parameter according to the difference between the maximum voltage and the minimum voltage in the value range to obtain a corrected mapping relationship includes: According to the difference, correct the denominator of the slope parameter and the denominator of the intercept parameter; In the initial mapping relationship, the denominators of the slope parameter and the intercept parameter are both initial differences, and the initial difference is the difference between the first initial value and the second initial value; The first initial value is the detection voltage output by the magnetic field sensor when the valve core of the faucet rotates to the maximum opening and closing angle so that the first position of the magnet is aligned with the magnetic field sensor; the second initial value is the detection voltage output by the magnetic field sensor when the valve core of the faucet rotates to the minimum opening and closing angle so that the second position of the magnet is aligned with the magnetic field sensor; The first position and the second position have a set distance from the end of the magnet.
2. The detection method according to claim 1, characterized in that: The step of determining a value range of the detection voltage according to the detection voltage output by the magnetic field sensor includes: Determining that the detection voltage output by the magnetic field sensor is greater than the first initial value, taking the range from the second initial value to the detection voltage as the value range; If it is determined that the detection voltage output by the magnetic field sensor is less than the second initial value, a range between the detection voltage and the first initial value is used as the value range.
3. A device for detecting the opening and closing angle of a faucet, characterized in that: include: A determination module, used to determine a value range of the detection voltage according to the detection voltage output by the magnetic field sensor; A correction module, used to correct the mapping relationship between the opening and closing angle of the faucet valve core and the detection voltage according to the value range; A detection module, used to determine the opening and closing angle corresponding to the detection voltage output by the magnetic field sensor according to the corrected mapping relationship; According to the value range, the correction module is further used to: obtain an initial mapping relationship, wherein the mapping relationship is a linear relationship, including a slope parameter and an intercept parameter; According to the difference between the maximum voltage and the minimum voltage in the value range, the slope parameter and the intercept parameter are corrected to obtain a corrected mapping relationship; The correction module is further used to: correct the denominator of the slope parameter and the denominator of the intercept parameter according to the difference; In the initial mapping relationship, the denominators of the slope parameter and the intercept parameter are both initial differences, and the initial difference is the difference between the first initial value and the second initial value; The first initial value is the detection voltage output by the magnetic field sensor when the valve core of the faucet rotates to the maximum opening and closing angle so that the first position of the magnet is aligned with the magnetic field sensor; the second initial value is the detection voltage output by the magnetic field sensor when the valve core of the faucet rotates to the minimum opening and closing angle so that the second position of the magnet is aligned with the magnetic field sensor; The first position and the second position have a set distance from the end of the magnet.
4. A faucet, characterized in that: It includes a faucet body, a valve core and a control unit; The valve core is provided with a magnet, and the magnet rotates circumferentially with the rotation of the valve core; wherein the magnet is arc-shaped, the magnetic field strength at different locations of the arc is different, and the central angle of the arc is greater than the maximum opening and closing angle of the valve core; The faucet body is provided with a magnetic field sensor, and the magnetic field sensor is used to output a corresponding detection voltage according to the magnetic field strength; The control unit is connected to the magnetic field sensor; the control unit includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the program, the detection method as described in any one of claims 1 to 2 is implemented.
5. The faucet according to claim 4, characterized in that: The magnetic field sensor is a linear Hall element.
6. The faucet according to claim 4, characterized in that: The magnetic field sensor is close to the inner arc surface or the outer arc surface of the magnet.
7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the detection method as described in any one of claims 1-2 is implemented.
