1. Field of the Invention
The present invention relates to an offset correction program for correcting an offset to be applied to a magnetic sensor and an electronic compass including the offset correction program.
2. Description of the Related Art
When direction measurement is to be performed electronically, this is performed using a magnetic sensor for detecting an external magnetic field, such as the geomagnetism. A technology is known in which, when a direction is to be determined using a magnetic detection circuit including a magnetic sensor, an alternating-current magnetic field is applied to the magnetic sensor, and a voltage output from the magnetic sensor when the alternating-current magnetic field is applied is used.
In this technology, magnetic sensors including a magnetoresistive element whose internal resistance is changed when a magnetic field is applied are used. This magnetoresistive element shows changes in resistance that are symmetrical with respect to a magnetic field. When an alternating-current magnetic field is superposed to a magnetoresistive element to which an external magnetic field such as the geomagnetism is applied, it is possible to detect changes in the resistance value by using characteristics of the magnetoresistive element. Then, by applying an electrical current in a direction in which the external magnetic field is cancelled, it is possible to measure an electrical current corresponding to the external magnetic field. The strength of the external magnetic field can be determined on the basis of the electrical current value.
For example, when an electronic compass using the above-described magnetic detection circuit is installed in a mobile phone or the like, there is a problem of not capable of accurately performing magnetic detection by being influenced of magnetic noise (hereinafter abbreviated as a “leakage magnetic field”) other than the geomagnetism generated from an electronic part installed in a mobile phone, such as a speaker.
An object of the present invention is to provide an electronic compass capable of correcting an offset to be applied to a magnetic sensor and accurately performing magnetic detection even in an environment in which a leakage magnetic field exists.
The offset correction program of the present invention is a computer-executable offset correction program for correcting an offset to be applied to a magnetic sensor, the offset correction program including: the step of determining a first linear expression on the basis of at least two first output voltages obtained by applying to the magnetic sensor a bias magnetic field in a state in which a first polarity thereof is applied and inverted; the step of determining a second linear expression on the basis of at least two second output voltages obtained by applying to the magnetic sensor a bias magnetic field in a state in which a second polarity thereof is applied and inverted; and the step of determining a correction value on the basis of an intersection point of the first linear expression and the second linear expression.
With this configuration, it is possible to eliminate an offset voltage that is inevitably generated in a voltage output from an amplifier in the magnetic detection circuit. As a result, it is possible to accurately perform magnetic detection even in an environment in which a leakage magnetic field exists.
The offset correction program of the present invention preferably includes the step of correcting sensitivity of the magnetic sensor by using the first linear expression and the second linear expression.
The electronic compass of the present invention includes a compass module having a magnetic sensor and control means having the offset correction program for detecting the geomagnetism by using the output of the magnetic sensor and a direction computation program for determining a direction.
In the electronic compass of the present invention, the magnetic sensor preferably includes a magnetoresistive element that shows changes in resistance that occur monotonically with a magnetic field. In this case, the magnetoresistive element is preferably a GMR element. Furthermore, In the electronic compass of the present invention, the magnetic sensor is preferably formed of a bridge circuit.
a) is a circuit diagram showing stage S1 of a magnetic detection apparatus shown in
a) is a circuit diagram showing stage S2 of the magnetic detection apparatus shown in
a) is a circuit diagram showing stage S3 of the magnetic detection apparatus shown in
a) is a circuit diagram showing stage S4 of the magnetic detection apparatus shown in
When a magnetoresistive element that shows changes in resistance that occur monotonically with a magnetic field is to be used, first, a bias magnetic field of one of the polarities is applied to invert the polarity of a voltage to be applied to the magnetoresistive element, thereby determining a voltage value corresponding to another magnetic field. Next, a bias magnetic field of the other polarity is applied to invert the polarity of a voltage to be applied to the magnetoresistive element, thereby determining a voltage value corresponding to another magnetic field. The two voltage values each contain an offset voltage. Therefore, by determining a difference between the voltage values corresponding to the other respective magnetic fields, which are determined in this manner, a voltage value corresponding to another magnetic field can be determined in a state in which the offset voltage is cancelled. As a result, magnetic detection in a state in which there is no offset voltage can be performed.
An embodiment of the present invention will be described in detail below with reference to the attached drawings. In this embodiment, a case in which only the offset voltage of an amplifier 132 is eliminated will be described.
The voltage generator 11 switches a voltage to be applied to the sensor unit 12. In this embodiment, as shown in
The sensor unit 12 is formed of three axes of the X axis, the Y axis, and the Z axis, and has a magnetic sensor including a magnetic effect element that detects the geomagnetism, and outputs a voltage value corresponding to changes in the geomagnetism. In this embodiment, as shown in
The bias magnetic-field generator 14 switches a bias magnetic field to be applied to the sensor unit 12 by supplying to the sensor unit an electrical current used to generate a bias magnetic field whose polarity is inverted. In this embodiment, as shown in
The detector 13 detects (amplifies) the voltage value output by the sensor unit 12. In this embodiment, as shown in
The controller 2 includes at least a direction computation program 21 and an offset correction program 22 as driver software for driving the compass module 1. The method of the direction computation program 21 is not particularly limited as long as an azimuth with respect to a reference direction can be determined on the basis of information on the geomagnetism obtained using the compass module 1. For example, the sensor unit 12 is formed of three axes of the X axis, the Y axis, and the Z axis. Accordingly, the sensor unit 12 computes a direction by using the geomagnetism for the X axis, the geomagnetism for the Y axis, and the geomagnetism for the Z axis, which are determined by an geomagnetism detection process. More specifically, the direction is computed by calculating an arctangent with respect to the ratio of an output voltage corresponding to the geomagnetism for the X axis to an output voltage corresponding to the geomagnetism for the Y axis. Furthermore, the voltage corresponding to the geomagnetism for the Z axis is used in a computation of correcting a state in which the electronic compass is inclined. For example, when the electronic compass according to the present invention is installed in a mobile phone or the like, it is expected that the mobile phone is used in a state in which the electronic compass is inclined. In such a case, a correction computation is performed using the geomagnetism for the Z axis in order to compute the direction.
The offset correction program 22 is a program capable of, when an external magnetic field other than the geomagnetism is applied to the magnetic sensor, correcting an offset thereof. When a magnetized component exists in the vicinity of a device installed with the compass module 1, an offset is added to the output from the sensor unit 12, and the geomagnetism is not accurately detected. According to this offset correction program, it is possible to determine the amount of correction for an offset due to an external magnetic field (leakage magnetic field) by using element characteristics of the magnetic sensor.
The offset correction program 22 is a computer-executable offset correction program for correcting an offset to be applied to a magnetic sensor, the offset correction program including: the step of determining a first linear expression on the basis of at least two first output voltages obtained by applying to the magnetic sensor a bias magnetic field in a state in which a first polarity thereof is applied and inverted; the step of determining a second linear expression on the basis of at least two second output voltages obtained by applying to the magnetic sensor a bias magnetic field in a state in which a second polarity thereof is applied and inverted; and the step of determining a correction value on the basis of an intersection point of the first linear expression and the second linear expression.
Next, the operation of the magnetic detection apparatus of the present invention will be described with reference to a circuit diagram shown in
In this embodiment, as shown in
In this embodiment, the sensor unit 12 is formed of a bridge circuit. In the bridge circuit of
In this embodiment, the voltage generator 11 is formed of switches SW1 and SW2, and the polarity (direction) of the voltage to be applied to the sensor unit 12 is switched in accordance with a control signal φ1. When the control signal φ1 is high (H signal), the switches SW1 and SW2 cause Vdd to be connected to the terminal Sa side, so that a voltage is applied in the direction from the terminal Sa to the terminal Sd. When the control signal φ1 is low (L signal), the switches SW1 and SW2 cause Vdd to be connected to the terminal Sd side, so that a voltage is applied in the direction from the terminal Sd to the terminal Sa.
As shown in
In the computation unit 13, the amplifier 131 is connected to the terminals Sb and Sd of the bridge circuit and receives the output of the sensor unit 12. The received voltage is charged in the capacitor 133 via the switch SW5. Furthermore, the received voltage is connected to the input terminal of the amplifier 132. The switch SW5 is controlled in accordance with a control signal φ3. When the control signal φ3 is high (H signal), the switch SW5 causes the output of the amplifier 131 to be connected to the capacitor 133. When the control signal φ3 is low (L signal), the switch SW5 releases the connection with the capacitor 133. The amplifier 132 operates so as to amplify the difference between the voltage value of the capacitor 133 and the voltage value that is the output of the amplifier 131. As a result, the difference between the voltage values when the direction of the bias magnetic field to be applied to the sensor unit 12 is switched is amplified and output.
Next, the operation of the magnetic detection apparatus having the above-described configuration will be described. It is assumed that the bias magnetic field in the same direction as that of the magnetic field of the magnetic (the geomagnetism) to be detected is in a positive direction.
The driving mode in the sensor unit 12 of the electronic compass according to this embodiment is formed of the following four stages:
As shown in
In stage S2, as shown in
In stage S3, as shown in
In stage S4, as shown in
More specifically, a first linear expression is determined on the basis of at least two output voltages that are obtained by applying a bias magnetic field to the sensor unit 12 in a state in which a first polarity (for example, positive) thereof is applied and inverted (here, the first linear expression is determined on the basis of stages S1 and S3). Next, a second linear expression is determined on the basis of at least two output voltages obtained by applying a bias magnetic field to the sensor unit 12 in a state in which a second polarity (for example, negative) thereof is applied and inverted (here, the second linear expression is determined on the basis of stages S2 and S4). Thereafter, the intersection point of the first linear expression and the second linear expression (the intersection point in
Furthermore, in this electronic compass, it is possible to correct the sensitivity of the sensor unit 12 by using the first linear expression and the second linear expression. The linear expression shown in
In the above-described embodiment, a description has been given of a case in which an offset correction process is performed in the compass module 1. Alternatively, the offset correction process may be performed inside the compass module. For example, the controller inside the compass module 1 may include a determination unit for determining whether or not the difference between the output voltages is approximately zero on the basis of the detection result of the detector 13, and a specification unit for specifying the size of the bias magnetic field on the basis of the determination result of the determination unit, so that the bias magnetic field of the bias magnetic-field generator 14 is controlled.
When an offset correction process is to be performed in the compass module 1, the compass module 1 is configured to include a magnetic sensor for detecting a magnetic field, a bias magnetic-field generator for applying a bias magnetic field whose polarity is inverted to the magnetic sensor, a computation unit for determining the difference between the output voltages obtained with respect to the bias magnetic field of each polarity, and a correction unit for outputting to the bias magnetic-field generator a correction value with which the difference between the output voltages becomes approximately zero. In this case, the correction unit is configured to include a determination unit for determining whether or not the difference between the output voltages is approximately zero on the basis of the computation result of the computation unit, and a specification unit for specifying the size of the bias magnetic field on the basis of the determination result.
In such a configuration, when an offset correction process is to be performed by the controller inside the compass module 1, first, the specification unit of the controller specifies an electrical current value corresponding to the bias magnetic field to be applied and outputs the electrical current information to the bias magnetic-field generator 14. The bias magnetic-field generator 14 generates a bias magnetic field on the basis of the electrical current information. Then, as in stage S1, the voltage generator 11 sets the voltage to be positive (the control signal φ1: H), the bias magnetic-field generator 14 sets the bias magnetic field (the bias magnetic field corresponding to the electrical current value specified by the specification unit) to be positive (the control signal φ2: H), and the detector 13 determines the output voltage. Next, as in stage S3, the voltage generator 11 sets the voltage to be positive (the control signal φ1: H), the bias magnetic-field generator 14 sets the bias magnetic field (the bias magnetic field corresponding to the electrical current value specified by the specification unit) to be negative (the control signal φ2: L), and the detector 13 determines the output voltage.
The detector 13 determines the difference between these output voltages and outputs the difference information to the controller. In the controller, the determination unit determines whether or not the difference between the output voltages is approximately zero. When the difference between the output voltages is approximately zero, it follows that correction corresponding to the external magnetic field has been performed. Therefore, the specified bias magnetic field is output as a correction value to the bias magnetic-field generator 14. In the bias magnetic-field generator 14, magnetic detection is performed using this correction value. On the other hand, when it is determined in the determination unit that the difference between the output voltages is not approximately zero, correction corresponding to the external magnetic field has not been performed. Therefore, the determination unit outputs information to that effect to the specification unit. The specification unit sets an electrical current value differing from the previous electrical current value, and outputs the electrical current information to the bias magnetic-field generator 14. The amount of change of the electrical current value in the electrical current value differing from the previous electrical current value is set in such a manner that the difference between the output voltages approaches approximately zero. By performing such processing, a correction bias corresponding to an external magnetic field is determined, and the external magnetic field is cancelled, thereby making it possible to accurately perform magnetic field detection.
According to the present invention, a first linear expression is determined on the basis of at least two first output voltages obtained by applying to the magnetic sensor a bias magnetic field in a state in which a first polarity thereof is applied and inverted. A second linear expression is determined on the basis of at least two second output voltages obtained by applying to the magnetic sensor a bias magnetic field in a state in which a second polarity thereof is applied and inverted. A correction value is determined on the basis of an intersection point of the first linear expression and the second linear expression. As a consequence, it is possible to eliminate an offset voltage that is inevitably generated in a voltage output from the amplifier in the magnetic detection circuit. As a result, it is possible to accurately perform magnetic detection even in an environment in which a leakage magnetic field exists.
The present invention is not limited to the above-described embodiment, and can be changed variously and practiced. A case has been described in which, for example, only the offset voltage of the amplifier 132 is eliminated. According to the present invention, it is possible to eliminate an offset voltage that is generated due to a resistance balance of another amplifier and sensor. In addition, the present invention can be changed as appropriate and can be practiced without departing from the spirit and scope of the invention.
Number | Date | Country | Kind |
---|---|---|---|
2006-059815 | Mar 2006 | JP | national |
2006-220876 | Aug 2006 | JP | national |
This is a continuation of International Application No. PCT/JP2007-053576, filed Feb. 27, 2007, which is incorporated herein by reference in its entirety.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/JP2007/053576 | Feb 2007 | US |
Child | 12205555 | US |