CN112815826A - Method and device for detecting opening and closing angle of faucet, faucet and storage medium - Google Patents
Method and device for detecting opening and closing angle of faucet, faucet and storage medium Download PDFInfo
- Publication number
- CN112815826A CN112815826A CN201911126306.0A CN201911126306A CN112815826A CN 112815826 A CN112815826 A CN 112815826A CN 201911126306 A CN201911126306 A CN 201911126306A CN 112815826 A CN112815826 A CN 112815826A
- Authority
- CN
- China
- Prior art keywords
- magnetic field
- field sensor
- faucet
- opening
- detection voltage
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 45
- 238000001514 detection method Methods 0.000 claims abstract description 127
- 238000013507 mapping Methods 0.000 claims abstract description 64
- 238000004590 computer program Methods 0.000 claims description 7
- 238000012937 correction Methods 0.000 claims description 5
- 238000004364 calculation method Methods 0.000 abstract description 20
- 230000006698 induction Effects 0.000 description 21
- 230000008569 process Effects 0.000 description 10
- 238000010586 diagram Methods 0.000 description 7
- 230000008859 change Effects 0.000 description 6
- 230000006870 function Effects 0.000 description 5
- 238000013461 design Methods 0.000 description 4
- 238000005259 measurement Methods 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000003247 decreasing effect Effects 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000004075 alteration Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 230000005389 magnetism Effects 0.000 description 1
- 230000005415 magnetization Effects 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 230000002441 reversible effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01B—MEASURING LENGTH, THICKNESS OR SIMILAR LINEAR DIMENSIONS; MEASURING ANGLES; MEASURING AREAS; MEASURING IRREGULARITIES OF SURFACES OR CONTOURS
- G01B7/00—Measuring arrangements characterised by the use of electric or magnetic techniques
- G01B7/30—Measuring arrangements characterised by the use of electric or magnetic techniques for measuring angles or tapers; for testing the alignment of axes
-
- F—MECHANICAL ENGINEERING; LIGHTING; HEATING; WEAPONS; BLASTING
- F16—ENGINEERING ELEMENTS AND UNITS; GENERAL MEASURES FOR PRODUCING AND MAINTAINING EFFECTIVE FUNCTIONING OF MACHINES OR INSTALLATIONS; THERMAL INSULATION IN GENERAL
- F16K—VALVES; TAPS; COCKS; ACTUATING-FLOATS; DEVICES FOR VENTING OR AERATING
- F16K37/00—Special means in or on valves or other cut-off apparatus for indicating or recording operation thereof, or for enabling an alarm to be given
- F16K37/0025—Electrical or magnetic means
- F16K37/0041—Electrical or magnetic means for measuring valve parameters
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Mechanical Engineering (AREA)
- Transmission And Conversion Of Sensor Element Output (AREA)
- Measurement Of Length, Angles, Or The Like Using Electric Or Magnetic Means (AREA)
Abstract
The application provides a method and a device for detecting the opening and closing angle of a faucet, the faucet and a storage medium, wherein the method comprises the following steps: determining the value range of the detection voltage according to the detection voltage output by the magnetic field sensor; according to the value range, correcting the mapping relation between the opening and closing angle of the valve core of the faucet and the detection voltage; and determining the opening and closing angle corresponding to the detection voltage output by the magnetic field sensor according to the corrected mapping relation. The method can improve the accuracy of the calculation result of the opening and closing angle.
Description
Technical Field
The application relates to the technical field of faucets, in particular to a faucet opening and closing angle detection method and device, a faucet and a storage medium.
Background
At present, the opening and closing angle of the valve core of the faucet can be detected through the relative movement of the magnetic field sensor and the magnet. When the magnet rotates, the opening and closing angle of the faucet valve core and the output voltage of the magnetic field sensor have a linear relation.
However, if the opening and closing angle is calculated by applying the above linear relationship, the following condition should be satisfied: the position of the magnet and the position of the magnetic field sensor cannot have larger error after the magnet rotates for many times; not only does the magnetization of the magnet satisfy linearity, but also the magnetic induction at both ends of rotation (N-and S-extremes) needs to be within a certain error range.
However, in practical application, errors after the magnet moves for many times and magnet magnetizing errors are inevitable, and therefore, the accuracy of the calculation result is poor when the opening and closing angle is calculated by adopting the linear relation.
Disclosure of Invention
The present application is directed to solving, at least to some extent, one of the technical problems in the related art.
The application provides a method and a device for detecting the opening and closing angle of a faucet, the faucet and a storage medium, so as to improve the accuracy of the calculation result of the opening and closing angle and solve the technical problem that the accuracy of the calculation result of the opening and closing angle is low in the prior art.
An embodiment of a first aspect of the present application provides a method for detecting an opening and closing angle of a faucet, including:
determining the value range of the detection voltage according to the detection voltage output by the magnetic field sensor;
according to the value range, correcting the mapping relation between the opening and closing angle of the valve core of the faucet and the detection voltage;
and determining the opening and closing angle corresponding to the detection voltage output by the magnetic field sensor according to the corrected mapping relation.
According to the method for detecting the opening and closing angle of the faucet, the value range of the detection voltage is determined according to the detection voltage output by the magnetic field sensor, the mapping relation between the opening and closing angle of the faucet valve core and the detection voltage is corrected according to the value range, and finally the opening and closing angle corresponding to the detection voltage output by the magnetic field sensor is determined according to the corrected mapping relation. Therefore, the opening and closing angle of the valve core of the faucet is calculated through the corrected mapping relation, and the accuracy of the calculation result of the opening and closing angle can be improved.
The embodiment of the second aspect of the present application provides a device for detecting an opening and closing angle of a faucet, including:
the determining module is used for determining the value range of the detection voltage according to the detection voltage output by the magnetic field sensor;
the correction module is used for correcting the mapping relation between the opening and closing angle of the valve core of the faucet and the detection voltage according to the value range;
and the detection module is used for determining the opening and closing angle corresponding to the detection voltage output by the magnetic field sensor according to the corrected mapping relation.
According to the detection device for the opening and closing angle of the faucet, the value range of the detection voltage is determined according to the detection voltage output by the magnetic field sensor, the mapping relation between the opening and closing angle of the faucet valve core and the detection voltage is corrected according to the value range, and finally the opening and closing angle corresponding to the detection voltage output by the magnetic field sensor is determined according to the corrected mapping relation. Therefore, the opening and closing angle of the valve core of the faucet is calculated through the corrected mapping relation, and the accuracy of the calculation result of the opening and closing angle can be improved.
An embodiment of a third aspect of the present application provides a faucet, including: the faucet comprises a faucet body, a valve core and a control unit;
the valve core is provided with a magnet, and the magnet circumferentially rotates along with the rotation of the valve core; the magnetic body is arc-shaped, the magnetic field intensity at each position of the arc is different, and the central angle of the arc is larger 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 for outputting corresponding detection voltage according to the intensity of magnetic field;
the control unit is connected with the magnetic field sensor; the control unit comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, and when the processor executes the program, the method for detecting the opening and closing angle of the faucet, which is provided by the embodiment of the first aspect of the application, is realized.
An embodiment of a fourth aspect of the present application provides a non-transitory computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method for detecting the opening and closing angle of a faucet as set forth in the embodiment of the first aspect of the present application.
Additional aspects and advantages of the present application will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the present application.
Drawings
The foregoing and/or additional aspects and advantages of the present application will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 is a schematic diagram of a relative position relationship between a conventional magnetic field sensor and a magnet;
FIG. 2 is a first schematic view of a magnet;
FIG. 3 is a second schematic view of a magnet;
FIG. 4 is a first schematic diagram illustrating a magnet rotation process;
FIG. 5 is a schematic diagram showing the magnitude relationship between the detection voltage and the magnetic induction intensity;
fig. 6 is a schematic flowchart of a method for detecting an opening/closing angle of a faucet according to an embodiment of the present application;
FIG. 7 is a second schematic diagram of the rotation process of the magnet;
fig. 8 is a schematic flow chart illustrating a method for detecting an opening/closing angle of a faucet according to a second embodiment of the present application;
fig. 9 is a schematic structural diagram of a device for detecting an opening and closing angle of a faucet according to a third embodiment of the present application;
fig. 10 is a schematic structural diagram of a device for detecting an opening and closing angle of a faucet according to a fourth embodiment of the present application.
Detailed Description
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary and intended to be used for explaining the present application and should not be construed as limiting the present application.
At present, the opening and closing angle of the faucet valve core can be detected through 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 shown in fig. 1, that is, 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, and the other is moved relatively along the circumferential direction.
The arc-shaped magnet can be as shown in fig. 2 and 3, and the change of the magnetic field intensity from the S pole to the N pole in the inner arc surface of the magnet is as follows: gradually, uniformly and progressively decreased to 0Gs (middle position), and then gradually and uniformly increased from 0Gs, wherein in the extrados surface of the magnet, the change of the magnetic field intensity from the N pole to the S pole is as follows: gradually and uniformly decreasing to 0Gs (middle position), and then gradually and uniformly increasing from 0 Gs. The magnetic induction intensity of the magnet changes linearly, the middle is 0Gs, the N extreme is-B, and the S extreme is B, wherein the magnetic induction intensity-B is in the induction range of the magnetic field sensor, and if the induction range of the magnetic field sensor is-C, the following requirements are met: -C < -B, C > B.
Taking an example that the magnetic field sensor is close to the outer arc surface of the magnet, when the magnetic field sensor is fixed and the magnet rotates circumferentially, assuming that the maximum rotation angle of the magnet is 90 ° (the arc central angle is 90 °), the initial relative position of the magnet and the magnetic field sensor is (0 °), i.e., the N pole end of the magnet is aligned with the magnetic field sensor, and when the magnet rotates counterclockwise, the magnet passes through the position (90 °), and finally reaches the position (90 °), i.e., the S pole end of the magnet is aligned with the magnetic field sensor.
As an example, when the magnetic field sensor is close to the outer arc surface of the magnet, the magnet may be disposed on the valve core, see fig. 4, when the valve core of the faucet is rotated to a minimum opening and closing angle (e.g., 0 °), the N pole end of the magnet is aligned with the magnetic field sensor, and when the magnet is circumferentially rotated along with the rotation of the valve core, e.g., when the valve core of the faucet is rotated to a maximum opening and closing angle (e.g., 90 °), the S pole end of the magnet is aligned with the magnetic field sensor. Therefore, theoretically, the magnetic induction intensity of the magnet at the position (r) is-B, and the induction output voltage of the magnetic field sensor is V0; the magnetic induction intensity of the magnet at position (c) is B, the induction output voltage of the magnetic field sensor is V2, the rotation angle is 90 degrees, and the change of the magnetic induction intensity of the outer arc surface is linear, so the change of the output voltage of the magnetic field sensor is also linear (see fig. 5), and the linear relation between the opening and closing angle theta of the faucet valve core and the output voltage V of the magnetic field sensor is correspondingly:
however, if the opening and closing angle is calculated by applying the above linear relationship, the following condition should be satisfied: on one hand, structurally, the magnet cannot have a large error with the position of the magnetic field sensor after being rotated for multiple times; on the other hand, the magnetizing intensity of the magnet needs to satisfy linearity, and the magnetic induction intensity at two end points (positions (i) and (iii)) of rotation also needs to be within a certain error range, otherwise, the calculation of the opening and closing angle is influenced.
However, in practical application, errors after the magnet moves for many times and magnet magnetizing errors are inevitable, and therefore, the accuracy of the calculation result is poor when the opening and closing angle is calculated by adopting the linear relation.
The application mainly aims at the technical problem that the accuracy of a calculation result of the opening and closing angle is not high in the prior art, and provides a method for detecting the opening and closing angle of the faucet.
According to the method for detecting the opening and closing angle of the faucet, the value range of the detection voltage is determined according to the detection voltage output by the magnetic field sensor, the mapping relation between the opening and closing angle of the faucet valve core and the detection voltage is corrected according to the value range, and finally the opening and closing angle corresponding to the detection voltage output by the magnetic field sensor is determined according to the corrected mapping relation. Therefore, the opening and closing angle of the valve core of the faucet is calculated through the corrected mapping relation, and the accuracy of the calculation result of the opening and closing angle can be improved.
The method and the device for detecting the opening and closing angle of the faucet, the faucet and the storage medium according to the embodiments of the present application are described below with reference to the accompanying drawings.
Fig. 6 is a schematic flow chart illustrating a method for detecting an opening/closing angle of a faucet according to an embodiment of the present application.
As shown in fig. 6, the method for detecting the opening and closing angle of the faucet may include the following steps:
The magnetic field sensor is a sensor capable of detecting a magnetic field intensity, such as a linear hall element, or may be another sensor, which is not limited in this respect. Specifically, the magnetic field sensor may output a corresponding detection voltage according to the magnetic field strength.
In the embodiment of the present application, one of the magnetic field sensor and the magnet may be kept fixed, and the other may move relatively in the circumferential direction, for example, the magnetic field sensor may be kept stationary, and the magnet may rotate in the circumferential direction, or the magnet may be kept stationary, and the magnetic field sensor may rotate in the circumferential direction around the magnet, which is not limited in the present application. 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.
For convenience of description, the magnetic field sensor is kept still, and the magnet performs circumferential motion for example, when the magnetic field sensor is kept still, the magnet may be disposed on the valve core, the magnet may rotate circumferentially along with the rotation of the valve core, when the magnet rotates, the magnetic field sensor may sense the change of the magnetic field, and output a corresponding detection voltage according to the magnetic field strength, so that the value range of the detection voltage may be determined according to the detection voltage output by the magnetic field sensor.
And 102, correcting the mapping relation between the opening and closing angle of the valve core of the faucet and the detection voltage according to the value range.
It should be noted that, during the long-time rotation of the magnet, the position between the magnet and the magnetic field sensor may be deviated, 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 be changed from fig. 4 to fig. 7, and at this time, an angle error may occur between the magnet and the magnetic field sensor. In fig. 4, when the valve core of the faucet rotates to a minimum opening and closing angle (for example, 0 °), the N pole end of the magnet is aligned with the magnetic field sensor, the magnetic induction intensity is-B, the detection voltage output by the magnetic field sensor is V0, when the valve core of the faucet rotates to a maximum opening and closing angle (for example, 90 °), the magnet rotates counterclockwise along with the rotation of the valve core, the S pole end of the magnet is aligned with the magnetic field sensor, the magnetic induction intensity is B, the detection voltage output by the magnetic field sensor is V2, and at this time, the corresponding opening and closing angle can be calculated according to the formula (1) and the detection voltage output by the magnetic field sensor. However, after an angle error occurs between the magnet and the magnetic field sensor, the angle error is marked as Δ a, when the valve core of the faucet rotates to the minimum opening and closing angle, the N pole 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, and when the valve core of the faucet rotates to the maximum opening and closing angle, the S pole of the magnet is not aligned with the magnetic field sensor, at this time, the detection voltage output by the magnetic field sensor is also not V2, if the corresponding opening and closing angle is calculated by using the mapping relation corresponding to the formula (1), the accuracy of the calculation result is low.
Therefore, in the present application, in order to improve the accuracy of the calculation result of the opening and closing angle, the mapping relationship between the opening and closing angle of the faucet valve core and the detection voltage needs to be corrected, for example, the formula (1) is corrected, for example, the slope parameter and the intercept parameter in the formula (1) can be corrected.
As a possible implementation manner, an initial mapping relationship may be obtained, where the mapping relationship is a linear relationship and includes 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, so as to obtain the corrected mapping relation.
And 103, determining an opening and closing angle corresponding to the detection voltage output by the magnetic field sensor according to the corrected mapping relation.
In the embodiment of the application, after the corrected mapping relationship is obtained, the detection voltage value output by the magnetic field sensor can be brought into the mapping relationship, and the opening and closing angle of the faucet valve core is obtained through calculation.
According to the method for detecting the opening and closing angle of the faucet, the value range of the detection voltage is determined according to the detection voltage output by the magnetic field sensor, the mapping relation between the opening and closing angle of the faucet valve core and the detection voltage is corrected according to the value range, and finally the opening and closing angle corresponding to the detection voltage output by the magnetic field sensor is determined according to the corrected mapping relation. Therefore, the opening and closing angle of the valve core of the faucet is calculated through the corrected mapping relation, and the accuracy of the calculation result of the opening and closing angle can be improved.
It should be noted that, during the long-time rotation of the magnet, the position between the magnet and the magnetic field sensor may be deviated, for example, the relative position between the magnet and the magnetic field sensor is changed from fig. 4 to fig. 7, and an angle error occurs between the magnet and the magnetic field sensor. If the central angle of the arc-shaped magnet is the same as the maximum opening and closing angle of the valve core, the magnetic field sensor may be out of the coupling range of the magnet after an angle error occurs. Therefore, in the application, in order to ensure that when the position between the magnet and the magnetic field sensor is deviated in the long-time rotating process, the magnetic field sensor is still in the coupling range of the magnet, and the arc central angle of the magnet can be larger 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 central angle of the arc may be 95 degrees. When the valve core rotates to the minimum opening and closing angle, such as 0 degrees, the magnetic induction intensity is in the range of-B + delta B to-B, and when the valve core rotates to the maximum opening and closing angle, such as 90 degrees, the magnetic induction intensity is in the range of B-delta B to B. Wherein, the value of delta B satisfies the measurement precision of the angle and the error of the rotation angle.
For example, when the maximum opening/closing angle of the valve body is 90 °, the accuracy of angle measurement is changed from 90/2B to 90/2(B — Δ B), and the accuracy is reduced. When the valve core rotates to 0 degree-delta A, the magnetic induction intensity is more than or equal to-B; when the valve core rotates to 90 degrees plus delta A, the magnetic induction intensity is less than or equal to B.
To clearly illustrate the first embodiment, the present embodiment provides another method for detecting an opening and closing angle of a faucet, and fig. 8 is a schematic flow chart of the method for detecting the opening and closing angle of the faucet provided in the second embodiment of the present application.
As shown in fig. 8, the method for detecting the opening and closing angle of the faucet may include the following steps:
The execution process of step 201 may refer to the execution process of step 101 in the above embodiments, which is not described herein again.
In this embodiment, the initial mapping relationship is a linear relationship, and includes a slope parameter and an intercept parameter, for example, if the slope parameter is labeled as K and the intercept parameter is labeled as B, the initial mapping relationship can be represented by formula (2):
θ=K*V+b; (2)
where θ represents the opening/closing angle of the valve element, and V represents the detection voltage output by the magnetic field sensor.
It can be understood that, according to the formula (1), the numerator in the slope parameter is the maximum opening and closing angle of the valve element, such as 90 °, and the numerator in the intercept parameter is the product of the maximum opening and closing angle of the valve element and the detection voltage sensed by the magnetic field sensor when the valve element 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 sensed by the magnetic field sensor at the N pole of the magnet. Wherein the denominators of the slope parameter and the intercept parameter are equal.
It should be understood that, with the long-term rotation of the magnet, when the valve core of the faucet rotates to the maximum opening and closing angle, the S pole end of the magnet may not be aligned with the magnetic field sensor, and at this time, the detection voltage output by the magnetic field sensor is not V2, and similarly, when the valve core of the faucet rotates to the minimum opening and closing angle, the N pole end of the magnet may not be aligned with the magnetic field sensor, and at this time, the detection voltage output by the magnetic field sensor is not V0, and therefore, the denominators of the slope parameter and the intercept parameter are not V2-V0. Therefore, the denominators of the slope parameter and the intercept parameter in the initial mapping relationship need to be re-determined.
As a possible implementation manner, in the initial mapping relationship, the denominators of the slope parameter and the intercept parameter are initial difference values, and the initial difference value is a difference value between a first initial value and a second initial value, where the first initial value is a detection voltage output by the magnetic field sensor when the valve element of the faucet rotates to a maximum opening and closing angle (for example, 90 °) so that the first position of the magnet is aligned with the magnetic field sensor; a second initial value, which is a detection voltage output by the magnetic field sensor when the valve core of the faucet rotates to a minimum opening and closing angle (for example, 0 °) 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.
That is, 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 pole end of the magnet may not be aligned with the magnetic field sensor, and at this time, it may happen that the magnetic field sensor is aligned with the first position of the magnet, which has a set distance from the S pole end of the magnet, and similarly, when the valve core of the faucet rotates to the minimum opening and closing angle, the N pole end of the magnet may not be aligned with the magnetic field sensor, and at this time, it may happen that the magnetic field sensor is aligned with the second position of the magnet, which has a set distance from the N pole end of the magnet.
For example, if the first initial value of the flag is D1, the second initial value is D2, and the initial difference is D, then D is D1-D2, and the maximum opening and closing angle is θ 1, then the initial mapping relationship can be expressed by equation (3):
for example, when the maximum opening and closing angle of the valve element is 90 ° and the minimum opening and closing angle is 0 °, and the system is initially powered on and does not detect the latest detection voltage, the corresponding relationship between the default opening and closing angle and the detection voltage may be as shown in table 1:
opening and closing | Detecting voltage | |
0° | D2=V0+△V01 | |
90° | D1=V2-△V21 |
TABLE 1
Wherein, Δ V01When the maximum deviation possibly occurs, the valve core of the faucet rotates to the minimum opening and closing angle, and the difference value between the detection voltage output by the magnetic field sensor and V0 is shown; delta V21When the maximum deviation possibly occurs, the valve core of the faucet rotates to the maximum opening and closing angle, and the difference value between the detection voltage output by the magnetic field sensor and V2 is shown.
Equation (3) can be converted to equation (4):
And step 203, 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 relation.
In the embodiment of the application, when the faucet normally operates, the magnetic field sensor can be used for detecting the detection voltage corresponding to the valve core rotating to different opening and closing angles in real time, and the denominator of the slope parameter and the denominator of the intercept parameter are corrected according to the difference between the maximum voltage and the minimum voltage in the value range of the detection voltage.
For example, when magnetism is detectedWhen the detected voltage output by the field sensor is greater than the first initial value D1, for example, the detected voltage is greater than V2- Δ V in Table 121When the range between the second initial value D2 and the detection voltage is used as the value range, i.e., D1 in formula (3) is replaced by the detection voltage output by the magnetic field sensor, and when the detection voltage output by the magnetic field sensor is detected to be smaller than the second initial value D2, for example, the detection voltage is smaller than V0+ Δ V in table 101In the process, the range from the detected voltage to the first initial value may be used as a value range, that is, D2 in the formula (3) is replaced by the detected voltage output by the magnetic field sensor, so as to obtain the corrected mapping relationship.
For example, if the tag has a value range of [ Vmin, Vmax ], then equation (3) can be converted to equation (5):
And 204, determining an opening and closing angle corresponding to the detection voltage output by the magnetic field sensor according to the corrected mapping relation.
In the embodiment of the application, the detection voltage output by the magnetic field sensor can be brought into the corrected mapping relation, and the opening and closing angle corresponding to the valve core is obtained through calculation, so that the related load control can be performed according to the calculated opening and closing angle.
As an example, a magnetic field sensor is taken as a linear hall element, and it is assumed that the maximum opening and closing angle of the valve element is 90 ° and the minimum opening and closing angle is 0 °. In order to promote the accuracy of the opening and closing angle calculation result of the faucet valve core, in the application, the design aspect and the angle calculation process of the magnet can be started, and the error is eliminated:
1. magnet design aspects
The errors to be avoided in the aspect of magnet design mainly lie in two ends (N extreme and S extreme, namely 0 degree and 90 degrees), in order to ensure that the magnet rotates for a long time, when the positions of the magnet and the linear Hall element deviate, the magnetic field sensor is still in the coupling range of the magnet, the size of the magnet is larger than the rotation angle of 90 degrees, namely the arc-shaped central angle of the magnet is larger than the maximum opening and closing angle of 90 degrees of the valve core, the magnetic induction intensity is in the range of-B plus delta B to-B when the valve core rotates to the minimum opening and closing angle of 0 degree, and the magnetic induction intensity is in the range of B-delta B to B when the valve core rotates to the maximum opening and closing angle of 90 degrees. Wherein, the value of delta B satisfies the measurement precision of the angle and the error of the rotation angle.
2. Angle calculation procedure
Based on the design of the size of the magnet and the magnetic induction intensity, the error of the faucet can be gradually eliminated through an algorithm in the rotating operation process, and the accurate measurement of the opening and closing angle is realized. The method comprises the following specific steps:
the first step is as follows:
when the system is initially powered on and the detection voltage output by the latest linear Hall element is not detected, the corresponding relation between the default opening and closing angle and the detection voltage is as follows:
opening and closing | Detecting voltage | |
0° | V0+△V01 | |
90° | V2-△V21 |
According to the parameters, the mapping relation between the opening and closing angle and the detection voltage can be obtained as follows:
satisfy a linear equation of one degree, wherein the slope parameter isIntercept parameter of△V01When the maximum deviation possibly occurs, the valve core of the faucet rotates to a minimum opening and closing angle of 0 degrees, and the difference value between the detection voltage output by the magnetic field sensor and V0 is obtained; delta V21When the maximum deviation possibly occurs, the valve core of the faucet rotates to the maximum opening and closing angle of 90 degrees, and the difference value between the detection voltage output by the magnetic field sensor and V2 is obtained.
The second step is that:
the tap normally runs, the detection voltage values corresponding to different opening and closing angles are detected in real time, and when the detection voltage output by the magnetic field sensor is detected to be less than V0 plus delta V01The detected voltage is set as the latest minimum voltage value Vmin; when the detected voltage output by the magnetic field sensor is larger than V2-delta V21The detected voltage is set as the latest maximum voltage value Vmax.
At this time, the mapping relation between the opening and closing angle and the detection voltage is as follows:
opening and closing | Detecting voltage | |
0° | Vmin | |
90° | Vmax |
According to the parameters, the mapping relation between the opening and closing angle and the detection voltage can be obtained as follows:
At this time, the latest opening and closing angle value after the error is eliminated can be obtained according to the latest mapping relation.
The third step:
and carrying out related load control according to the newly obtained opening and closing angle value.
According to the method for detecting the opening and closing angle of the faucet, the value range of the detection voltage is determined according to the detection voltage output by the magnetic field sensor, the mapping relation between the opening and closing angle of the faucet valve core and the detection voltage is corrected according to the value range, and finally the opening and closing angle corresponding to the detection voltage output by the magnetic field sensor is determined according to the corrected mapping relation. Therefore, the opening and closing angle of the valve core of the faucet is calculated through the corrected mapping relation, and the accuracy of the calculation result of the opening and closing angle can be improved.
In order to realize the embodiment, the application also provides a device for detecting the opening and closing angle of the faucet.
Fig. 9 is a schematic structural diagram of a device for detecting an opening and closing angle of a faucet according to a third embodiment of the present application.
As shown in fig. 9, the device for detecting the opening and closing angle of the faucet includes: a determination module 110, a correction module 120, and a detection module 130.
The determining module 110 is configured to determine a value range of the detection voltage according to the detection voltage output by the magnetic field sensor.
And the correction module 120 is configured to correct a mapping relationship between an opening and closing angle of the faucet valve element and the detection voltage according to the value range.
And the detection module 130 is configured to determine an opening and closing angle corresponding to the detection voltage output by the magnetic field sensor according to the corrected mapping relationship.
Further, in a possible implementation manner of the embodiment of the present application, referring to fig. 10, on the basis of the embodiment shown in fig. 9, the device for detecting the opening and closing angle of the faucet may further include:
as a possible implementation, the modification module 120 includes:
the obtaining submodule 121 is configured to obtain an initial mapping relationship, where the mapping relationship is a linear relationship and includes a slope parameter and an intercept parameter.
And the correction submodule 122 is configured to correct the slope parameter and the intercept parameter according to a difference between the maximum voltage and the minimum voltage in the value range, so as to obtain a corrected mapping relationship.
As a possible implementation, the modification submodule 122 is specifically configured to: and correcting the denominator of the slope parameter and the denominator of the intercept parameter according to the difference.
As a possible implementation manner, in the initial mapping relationship, the denominators of the slope parameter and the intercept parameter are both initial differences, and the initial differences are differences between a first initial value and a second initial value; the first initial value is a 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.
As a possible implementation manner, the determining module 110 is specifically configured to: determining that the detection voltage output by the magnetic field sensor is greater than a first initial value, and taking the range from a second initial value to the detection voltage as a value range; and if the detection voltage output by the magnetic field sensor is determined to be smaller than the second initial value, taking the range from the detection voltage to the first initial value as a value range.
It should be noted that the explanation of the embodiment of the method for detecting the opening and closing angle of the faucet described above is also applicable to the device for detecting the opening and closing angle of the faucet of this embodiment, and the implementation principle is similar, and is not described herein again.
According to the detection device for the opening and closing angle of the faucet, the value range of the detection voltage is determined according to the detection voltage output by the magnetic field sensor, the mapping relation between the opening and closing angle of the faucet valve core and the detection voltage is corrected according to the value range, and finally the opening and closing angle corresponding to the detection voltage output by the magnetic field sensor is determined according to the corrected mapping relation. Therefore, the opening and closing angle of the valve core of the faucet is calculated through the corrected mapping relation, and the accuracy of the calculation result of the opening and closing angle can be improved.
In order to implement the above embodiment, the present application also proposes a faucet including: tap main part, case and control unit.
The valve core is provided with a magnet, and the magnet circumferentially rotates along with the rotation of the valve core; the magnet is arc-shaped, the magnetic field intensity at each part of the arc is different, and the central angle of the arc is larger than the maximum opening and closing angle of the valve core.
The tap main part is provided with magnetic field sensor, and magnetic field sensor is used for outputting corresponding detection voltage according to magnetic field intensity.
The control unit is connected with the magnetic field sensor; the control unit comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, and when the processor executes the program, the method for detecting the opening and closing angle of the faucet, which is provided by the foregoing embodiment of the present application, is realized.
In the embodiment of the present application, the magnetic field sensor is kept still, and the magnet performs circumferential motion to exemplify the operation, for example, when the magnetic field sensor is kept still, the magnet may be disposed on the valve core, the magnet may circumferentially rotate along with the rotation of the valve core, and when the magnet rotates, the magnetic field sensor may sense the change of the magnetic field and output a corresponding detection voltage according to the magnetic field strength.
As a possible implementation, the magnetic field sensor is a linear hall element.
As another possible implementation, the magnetic field sensor is close to the intrados or extrados of the magnet.
It should be noted that the foregoing explanation of the embodiment of the method for detecting the opening and closing angle of the faucet is also applicable to the faucet of the embodiment, and the implementation principle is similar, and is not repeated here.
In order to implement the above embodiments, the present application also proposes a non-transitory computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method of detecting the opening and closing angle of a faucet as proposed in the previous embodiments of the present application.
It should be noted that the foregoing 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 the embodiment, and the implementation principle is similar, and therefore, the detailed description is omitted here.
In the description herein, reference to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the application. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present application, "plurality" means at least two, e.g., two, three, etc., unless specifically limited otherwise.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing steps of a custom logic function or process, and alternate implementations are included within the scope of the preferred embodiment of the present application in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present application.
The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It should be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. If implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present application may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc. Although embodiments of the present application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present application, and that variations, modifications, substitutions and alterations may be made to the above embodiments by those of ordinary skill in the art within the scope of the present application.
Claims (10)
1. A method for detecting the opening and closing angle of a faucet is characterized by comprising the following steps:
determining the value range of the detection voltage according to the detection voltage output by the magnetic field sensor;
according to the value range, correcting the mapping relation between the opening and closing angle of the valve core of the faucet and the detection voltage;
and determining the opening and closing angle corresponding to the detection voltage output by the magnetic field sensor according to the corrected mapping relation.
2. The detection method according to claim 1, wherein the correcting the mapping relationship between the opening and closing angle of the faucet valve core and the detection voltage according to the value range comprises:
acquiring an initial mapping relation, wherein the mapping relation is a linear relation and comprises a slope parameter and an intercept parameter;
and 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 relation.
3. The detection method according to claim 2, wherein the 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 comprises:
and correcting the denominator of the slope parameter and the denominator of the intercept parameter according to the difference.
4. The detection method according to claim 2, wherein in the initial mapping relationship, the denominators of the slope parameter and the intercept parameter are both initial differences, and the initial differences are differences between a first initial value and a second initial value;
the first initial value is a 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 a detection voltage output by the magnetic field sensor when the valve core of the faucet rotates to a minimum opening and closing angle so that the second position of the magnet is aligned with the magnetic field sensor;
the first and second positions have a set distance to an end of the magnet.
5. The detection method according to claim 4, wherein the determining a value range of the detection voltage according to the detection voltage output by the magnetic field sensor comprises:
if the detection voltage output by the magnetic field sensor is determined to be larger than the first initial value, taking the range from the second initial value to the detection voltage as the value range;
and if the detection voltage output by the magnetic field sensor is determined to be smaller than the second initial value, taking the range from the detection voltage to the first initial value as the value range.
6. A detection device for a faucet opening and closing angle is characterized by comprising:
the determining module is used for determining the value range of the detection voltage according to the detection voltage output by the magnetic field sensor;
the correction module is used for correcting the mapping relation between the opening and closing angle of the valve core of the faucet and the detection voltage according to the value range;
and the detection module is used for determining the opening and closing angle corresponding to the detection voltage output by the magnetic field sensor according to the corrected mapping relation.
7. A faucet is characterized by comprising a faucet main body, a valve core and a control unit;
the valve core is provided with a magnet, and the magnet circumferentially rotates along with the rotation of the valve core; the magnetic body is arc-shaped, the magnetic field intensity at each position of the arc is different, and the central angle of the arc is larger 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 for outputting corresponding detection voltage according to the intensity of magnetic field;
the control unit is connected with the magnetic field sensor; the control unit comprises a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the detection method according to any one of claims 1 to 5 when executing the program.
8. The faucet of claim 7, wherein the magnetic field sensor is a linear hall element.
9. The faucet of claim 7, wherein the magnetic field sensor is proximate to an intrados or extrados of the magnet.
10. A non-transitory computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the detection method according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911126306.0A CN112815826A (en) | 2019-11-18 | 2019-11-18 | Method and device for detecting opening and closing angle of faucet, faucet and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911126306.0A CN112815826A (en) | 2019-11-18 | 2019-11-18 | Method and device for detecting opening and closing angle of faucet, faucet and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112815826A true CN112815826A (en) | 2021-05-18 |
Family
ID=75852198
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911126306.0A Pending CN112815826A (en) | 2019-11-18 | 2019-11-18 | Method and device for detecting opening and closing angle of faucet, faucet and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112815826A (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH0666505A (en) * | 1992-06-27 | 1994-03-08 | Robert Bosch Gmbh | Method for obtaining reference voltage and feed voltage in computer |
US5644225A (en) * | 1996-04-16 | 1997-07-01 | Honeywell Inc. | Method for calibrating an angular position sensor |
US20110175601A1 (en) * | 2010-01-18 | 2011-07-21 | Bourns, Inc. | High resolution non-contacting multi-turn position sensor |
CN103575210A (en) * | 2012-08-06 | 2014-02-12 | 株式会社电装 | Position detector |
CN105978235A (en) * | 2015-03-11 | 2016-09-28 | 株式会社电装 | Rotational angle detecting device |
US20170254666A1 (en) * | 2016-03-03 | 2017-09-07 | Hitachi Metals, Ltd. | Rotation angle sensor and correction method for the same |
-
2019
- 2019-11-18 CN CN201911126306.0A patent/CN112815826A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH0666505A (en) * | 1992-06-27 | 1994-03-08 | Robert Bosch Gmbh | Method for obtaining reference voltage and feed voltage in computer |
US5644225A (en) * | 1996-04-16 | 1997-07-01 | Honeywell Inc. | Method for calibrating an angular position sensor |
US20110175601A1 (en) * | 2010-01-18 | 2011-07-21 | Bourns, Inc. | High resolution non-contacting multi-turn position sensor |
CN103575210A (en) * | 2012-08-06 | 2014-02-12 | 株式会社电装 | Position detector |
CN105978235A (en) * | 2015-03-11 | 2016-09-28 | 株式会社电装 | Rotational angle detecting device |
US20170254666A1 (en) * | 2016-03-03 | 2017-09-07 | Hitachi Metals, Ltd. | Rotation angle sensor and correction method for the same |
CN107152909A (en) * | 2016-03-03 | 2017-09-12 | 日立金属株式会社 | Rotation angle sensor and its modification method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11307054B2 (en) | Magnetic field sensor providing a movement detector | |
JP6671498B2 (en) | Rotation angle sensor | |
US7420363B2 (en) | Rotation angle detection apparatus enabling measurement of degree of rotation of a shaft that exceeds 360° | |
JP5333863B2 (en) | Rotation angle detector | |
JP5725377B2 (en) | Rotation angle detector | |
US20140354270A1 (en) | Magnetic position detection device | |
US20120182009A1 (en) | Rotation angle detecting device | |
US20080272723A1 (en) | Absolute Encoder and Method for Generating an Absolute Value for a Angle of Rotation | |
US20170292857A1 (en) | Sensor Arrangement for the Contactless Sensing of Angles of Rotation on a Rotating Part | |
CN109959396B (en) | Multi-turn counter sensor | |
US11796305B2 (en) | Magnetic position sensor system, device, magnet and method | |
US8710831B2 (en) | Rotation angle detecting device | |
US11099034B2 (en) | Position sensor | |
JP2009229437A (en) | Position detection sensor | |
US11536590B2 (en) | Offset correction device and position measuring device | |
US7573260B2 (en) | Magnetic rotor and rotational angle sensing apparatus having the same | |
WO2008107300A2 (en) | Sensor arrangement and measuring method | |
CN112815826A (en) | Method and device for detecting opening and closing angle of faucet, faucet and storage medium | |
JPH11336713A (en) | Position detector for cylinder | |
JP6798530B2 (en) | Linear position sensor | |
WO2019171763A1 (en) | Linear position sensor | |
JP2018040586A (en) | Angle detection mechanism and angle detection system | |
JP5708986B2 (en) | Rotation angle detector | |
US11493362B2 (en) | Systems and methods for detecting magnetic turn counter errors | |
US11378419B2 (en) | Angle sensor and method for operating an angle sensor |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |