Abstract:
A magnetic sensor device for generating a logic output in accordance with a magnetic field intensity applied to a magnetoelectric conversion element includes: a comparator for inputting amplified output signals of the magnetoelectric conversion element, and outputting a comparison result; and a logic circuit for performing arithmetic processing on an output signal of the comparator. Only when the logic output is changed by a change in the magnetic field intensity, the logic circuit performs successive matching determination of logic outputs a plurality of times. Thus, the variation in determination for detection or canceling of a magnetic field intensity, which is caused by noise generated from respective constituent elements included in the magnetic sensor device and external noise, may be reduced while suppressing electric power consumption.

Description:
RELATED APPLICATIONS 
     This application claims priority under 35 U.S.C. §119 to Japanese Patent Application No. 2011-211221 filed on Sep. 27, 2011, the entire content of which is hereby incorporated by reference. 
     BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates to a magnetic sensor device for converting a magnetic field intensity into an electric signal, and more particularly, to a magnetic sensor device to be employed as a sensor for detecting an open/close state used in a flip phone, a notebook computer, or the like, or a sensor for detecting a rotational position of a motor. 
     2. Description of the Related Art 
     A magnetic sensor device has been employed as a sensor for detecting the open/close state used in a flip phone, a notebook computer, or the like, or a sensor for detecting a rotational position of a motor (for example, see Japanese Patent Application Laid-open No. 2001-337147). 
     In the magnetic sensor device, a magnetoelectric conversion element (for example, Hall element) outputs a voltage proportional to a magnetic field intensity or a magnetic flux density, an amplifier amplifies the output voltage, and a comparator determines the voltage to output a binary signal of an H signal or an L signal. The output voltage of the magnetoelectric conversion element is minute, and hence, easily affected by an offset voltage (element offset voltage) of the magnetoelectric conversion element, an offset voltage (input offset voltage) of the amplifier or the comparator, or noise within the conversion device, which leads to a problem. The element offset voltage is mainly generated by a stress or the like exerted on the magnetoelectric conversion element by a package. The input offset voltage is mainly generated by a characteristic variation of an element that forms an input circuit of the amplifier. The noise is mainly generated by flicker noise of a monolithic transistor that forms a circuit, or thermal noise of the monolithic transistor or a resistive element. 
     In order to reduce an influence of the above-mentioned offset voltage of the magnetoelectric conversion element or the amplifier, the magnetic sensor device illustrated in  FIG. 4  has been devised. 
     The conventional magnetic sensor device is configured to include a Hall element  1 , a switching circuit  2  that switches between a first detection state and a second detection state of the Hall element  1 , a differential amplifier  3  that amplifies a voltage difference (V 1 −V 2 ) of two output terminals of the switching circuit  2 , a capacitor C 1  having one end connected to one output terminal of the differential amplifier  3 , a switch S 1  connected between another output terminal of the differential amplifier  3  and another end of the capacitor C 1 , a comparator  4 , and a D-type flip-flop D 1 . In the first detection state, a supply voltage is input from terminals A and C, and a detection voltage is output from terminals B and D. In the second detection state, the supply voltage is input from the terminals B and D, and the detection voltage is output from the terminals A and C. 
     It is assumed that a differential output voltage of the magnetoelectric conversion element is Vh, a gain of the differential amplifier is G, and the input offset voltage of the differential amplifier is Voa. In the first detection state, the switch S 1  is turned on, and the capacitor C 1  is charged with Vc 1 =V 3 −V 4 =G(Vh 1 +Voa). Then, in the second detection state, the switch S 1  is turned off, and Vc 2 =V 3 −V 4 =G(−Vh 2 +Voa) is output. Here, V 5 −V 6 =V 3 −Vc 1 −V 4 =Vc 2 −Vc 1 =−G(Vh 1 +Vh 2 ) is satisfied, to thereby cancel out the influence of the input offset voltage. Further, the detection voltages Vh 1  and Vh 2  of the magnetoelectric conversion element generally have an in-phase valid signal component and a reverse-phase element offset component, and hence the influence of the element offset component is also removed from the above-mentioned output voltage. An applied magnetic field intensity and a reference voltage are compared with each other by the comparator and an output result obtained by the comparison is latched. In the case illustrated in  FIG. 4 , the reference voltage is an in-phase voltage in the magnetoelectric conversion element, which may be arbitrarily set by an additional circuit. 
     However, the conventional magnetic sensor device has a problem that, the influence of noise (flicker noise and thermal noise) generated in the respective constituent elements included in the sensor device and the influence of external noise cannot be completely suppressed, and hence a magnetic field intensity varies when detected or canceled. In particular, noise generated in an input terminal portion of the differential amplifier  3  is amplified and thus becomes a main factor. 
     SUMMARY OF THE INVENTION 
     The present invention has been devised in order to solve the above-mentioned problem, and it is an object thereof to provide a magnetic sensor device for repeating operations of magnetic field detection a plurality of times and performing matching of results of the determination, to thereby suppress an influence of noise and detect or cancel a magnetic field intensity with high precision. It is another object of the present invention to suppress unnecessary electric power consumption by performing the matching a plurality of times only when a change has occurred from a previous detection state. 
     In order to solve the above-mentioned problem inherent in the related art, the magnetic sensor device according to an exemplary embodiment of the present invention is configured as follows. 
     A magnetic sensor device for generating a logic output in accordance with a magnetic field intensity applied to a magnetoelectric conversion element includes: a comparator for inputting amplified output signals of the magnetoelectric conversion element; and a logic circuit for performing arithmetic processing on an output signal of the comparator. Only when the logic output is changed by a change in the magnetic field intensity, the logic circuit performs successive matching determination of logic outputs a plurality of times. 
     According to the magnetic sensor device of the present invention, a variation in determination for detection or canceling of a magnetic field intensity, which is caused by noise generated from respective constituent elements included in the magnetic sensor device and external noise, can be reduced while suppressing electric power consumption. Therefore, the present invention can provide a magnetic sensor device capable of detecting and canceling the magnetic field intensity with high precision and with a low consumption current. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       In the accompanying drawings: 
         FIG. 1  is a circuit diagram illustrating a magnetic sensor device according to an embodiment of the present invention; 
         FIG. 2  is a timing chart of the magnetic sensor device according to the embodiment of the present invention; 
         FIG. 3  is a timing chart of an application example of the magnetic sensor device according to the embodiment of the present invention; 
         FIG. 4  is a circuit diagram of a conventional magnetic sensor device; 
         FIG. 5  is a circuit diagram illustrating an example of a selector circuit; and 
         FIG. 6  is a circuit diagram illustrating an example of a differential amplifier. 
     
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT 
     A magnetic sensor device according to the present invention is widely used as a sensor for detecting a state of a magnetic field intensity, such as a sensor for detecting an open/close state in a flip phone, a notebook computer, or the like, or a sensor for detecting a rotational position of a motor. In the following embodiments, a magnetic sensor device using a magnetoelectric conversion element is described. Alternatively, however, a conversion device according to the present invention may employ a conversion element that similarly outputs a voltage according to acceleration or a pressure, in place of the magnetoelectric conversion element that outputs a voltage according to the magnetic field intensity. 
       FIG. 1  is a circuit diagram of the magnetic sensor device of this embodiment. The magnetic sensor device of this embodiment includes a Hall element  1  serving as a magnetoelectric conversion element, a switching circuit  2 , a differential amplifier  3 , a comparator  4 , an ON/OFF circuit  5 , D-type flip-flops D 1 , D 2 , and D 3 , XOR circuits X 1  and X 2 , selector circuits SL 1  and SL 2 , an AND circuit AN 1 , an OR circuit OR 1 , a capacitor C 1 , a switch S 1 , an output terminal VOUT, and ON/OFF signal sources φE 1  and φE 2 . The Hall element  1  has a first terminal pair A-C and a second terminal pair B-D. The switching circuit  2  has four input terminals connected to the respective terminals A, B, C, and D of the Hall element  1 , a first output terminal, and a second output terminal. The differential amplifier  3  has a first input terminal, a second input terminal, a first output terminal, and a second output terminal. The selector circuits SL 1  and SL 2  each have an input terminal A, an input terminal B, a select terminal φS, and an output terminal. 
     The differential amplifier  3  has the first output terminal connected to one end of the capacitor C 1  and the second output terminal connected to one end of the switch S 1 . The comparator  4  has a first input connected to another end of the capacitor C 1  and another end of the switch S 1 , a second input connected to the second output terminal of the differential amplifier  3 , and an output connected to the D-type flip-flop D 1  and the D-type flip-flop D 2 . The XOR circuit X 1  has a first input connected to an output of the D-type flip-flop D 1 , a second input connected to an output of the D-type flip-flop D 2 , and an output connected to the select terminal φS of the selector circuit SL 1 . The XOR circuit X 2  has a first input connected to the output of the D-type flip-flop D 1  and the input terminal A of the selector circuit SL 1 , and a second input connected to the input terminal B of the selector circuit SL 1 , the input terminal A of the selector circuit SL 2 , an output of the D-type flip-flop D 3 , and the output terminal VOUT. The XOR circuit X 2  has an output connected to the select terminal φS of the selector circuit SL 2  and a first input of the AND circuit AN 1 . The selector circuit SL 2  has the input terminal B connected to the output terminal of the selector circuit SL 1 , and the output terminal connected to an input of the D-type flip-flop D 3 . The AND circuit AN 1  has a second input connected to the ON/OFF signal source φE 2  and an output connected to a first input of the OR circuit OR 1 . The OR circuit OR 1  has a second input connected to the ON/OFF signal source φE 1  and an output connected to the ON/OFF circuit  5 . The ON/OFF circuit  5  outputs a φEN signal to the switching circuit  2 , the differential amplifier  3 , and the comparator  4 . 
       FIG. 5  illustrates an example of a circuit diagram of the selector circuits SL 1  and SL 2 . The selector circuit includes a PMOS transistor  501  and an NMOS transistor  502  serving as a transmission gate TM 1 , a PMOS transistor  503  and an NMOS transistor  504  serving as a transmission gate TM 2 , and inverters I 1  and I 2 . Connections are made as follows. The select terminal φS is connected to an input of the inverter I 1 . The inverter I 1  has an output connected to an input of the inverter I 2 , a gate of the NMOS transistor  502 , and a gate of the PMOS transistor  503 . The inverter  12  has an output connected to a gate of the PMOS transistor  501  and a gate of the NMOS transistor  504 . The PMOS transistor  501  has a drain connected to the input terminal A and a drain of the NMOS transistor  502 , and has a source connected to the output terminal and a source of the NMOS transistor  502 . The PMOS transistor  503  has a drain connected to the input terminal B and a drain of the NMOS transistor  504 , and has a source connected to the output terminal and a source of the NMOS transistor  502 . ON/OFF of the two transmission gates TM 1  and TM 2  is controlled by an H/L input signal from the select terminal φS, and hence the transmission gates TM 1  and TM 2  serve to transmit any one of the signals from the input terminal A and the input terminal B to the output terminal. 
       FIG. 6  illustrates an example of a circuit diagram of the differential amplifier  3 . The differential amplifier  3  is typically configured as an instrumentation amplifier. The differential amplifier  3  has differential amplifiers  11  and  12 , and resistors R 11 , R 12 , and R 13 . Connections are made as follows. The differential amplifier  11  has a non-inverting input terminal connected to the first input terminal, an inverting input terminal connected to a connection point between one end of the resistor R 11  and one end of the resistor R 12 , and an output connected to the first output terminal and another end of the resistor R 11 . The differential amplifier  12  has a non-inverting input terminal connected to the second input terminal, an inverting input terminal connected to a connection point between one end of the resistor R 13  and another end of the resistor R 12 , and an output connected to the second output terminal and another end of the resistor R 13 . The differential amplifier  3  is configured as such an instrumentation amplifier, to thereby suppress the influence of in-phase noise in the differential input. 
     The switching circuit  2  has a function of switching between a first detection state in which the supply voltage is input to the first terminal pair A-C of the Hall element  1  while the detection voltage is output from the second terminal pair B-D of the Hall element  1 , and a second detection state in which the supply voltage is input to the second terminal pair B-D while the detection voltage is output from the first terminal pair A-C. 
     Next, an operation of the magnetic sensor device according to this embodiment is described.  FIG. 2  is a timing chart illustrating control signals in the magnetic sensor device according to this embodiment. In  FIG. 2 , φDm indicates a latch clock signal input to an m-th D-type flip-flop Dm. Unless otherwise specified, each D-type flip-flop latches input data at the rising of the latch clock signal from a low (L) level to a high (H) level. 
     One period T in detection operation is divided into a first detection state T 1  and a second detection state T 2  according to the operation of the above-mentioned switching circuit  2 . The period T of the detection operation is also divided into a sample phase F 1  and a comparison phase F 2  through the opening and closing the switch S 1 . In the sample phase F 1 , the offset components of the Hall element  1  and the differential amplifier  3  are stored in the capacitor C 1 . In the comparison phase F 2 , a voltage determined according to the magnetic field intensity is compared with the detection voltage level. Here, assuming that a differential output voltage of the magnetoelectric conversion element is expressed by Vh, a gain of the differential amplifier is expressed by G, and an input offset voltage of the differential amplifier is expressed by Voa. 
     In the sample phase F 1 , the Hall element  1  goes into the first detection state T 1  and the switch S 1  is turned on. When the switch S 1  is turned on, the capacitor C 1  is charged with a voltage as follows.
 
 Vc 1=( V 3 −V 4)= G ( Vh 1 +Voa )  (1)
 
     Subsequently, in the comparison phase F 2  (second detection state T 2 ), the switch S 1  is turned off, and hence the following voltage is output.
 
 Vc 2=( V 3 −V 4)= G (− Vh 2 +Voa )  (2)
 
     In this case, the following expression applies.
 
 V 5 −V 6 =V 3 −Vc 1 −V 4= Vc 2 −Vc 1 =−G ( Vh 1 +Vh 2)  (3)
 
     Therefore, the influence of the input offset voltage is canceled out. Detection voltages Vh 1  and Vh 2  of the magnetoelectric conversion element generally have in-phase effective signal components and inverted-phase element offset components, and hence the influence of the element offset components is also removed from the output voltage described above. 
     In the comparison phase F 2 , the detection voltage component of the applied magnetic field intensity, which is expressed by Expression (3), is compared with a reference voltage by the comparator  4 , and a signal V 7  (an H signal (VDD) or an L signal (GND)) is output. 
     The reference voltage in this embodiment is an in-phase voltage in the magnetoelectric conversion element. The reference voltage may be arbitrarily set by an additional circuit. 
     The signal V 7  output from the comparator  4  is input to a logic circuit described later. The signal V 7  output from the comparator  4  is latched two times at different timings by the two D-type flip-flops D 1  and D 2 . The second latching is performed during the successive re-detection operation, that is, after a detection period T for the first latching. Then, only when the XOR circuit X 1  connected to the outputs of the two D-type flip-flops D 1  and D 2  have the same value of the two outputs, an output signal of the comparator is input to the selector circuit SL 2  via the selector circuit SL 1 . On the other hand, when the two outputs of the D-type flip-flops D 1  and D 2  have different values, the output result of the previous detection, which has been held in the D-type flip-flop D 3 , is directly input to the selector circuit SL 2 . In other words, the determination for detection or canceling is not performed unless the same detection (canceling) state continues at intervals of T, and hence an erroneous detection and an erroneous canceling caused by the influence of instantaneous noise can be prevented. 
     Subsequently, only when the XOR circuit X 2  connected to the output result of the previous detection, which has been held in the D-type flip-flop D 3 , and to the output of the D-type flip-flop D 1  have different values of the two outputs, an output signal of the selector circuit SL 1  is input to the D-type flip-flop D 3  via the selector circuit SL 2 , and hence the signal V 7  is finally latched at a timing φD 3 . On the other hand, when the two output values input to the XOR circuit X 2  are the same, the output result of the previous detection, which has been held in the D-type flip-flop D 3 , is directly input to the D-type flip-flop D 3  and latched. Further, the output of the XOR circuit X 2  and the ON/OFF signal φE 2  are input to the AND circuit AN 1 , and hence, only when the two output values input to the XOR circuit X 2  are different from each other, the ON/OFF signal φE 2  is input to the OR circuit OR 1  via the AND circuit AN 1 . Then, the ON/OFF signal φE 1  and the ON/OFF signal φE 2  are combined in the OR circuit OR 1  to be output as a φEN signal. On the other hand, when the two output values input to the XOR circuit X 2  are the same, the output of the AND circuit AN 1  is fixed to the L signal, and hence the ON/OFF signal φE 1  is directly output from the OR circuit OR 1  as the φEN signal. 
     In other words, when the result of the first latching is different from the previous detection result, the second determination is performed, and then matching is performed between the first and second results to determine the detection result. In this case, electric power corresponding to two detection periods (2 T) is consumed. On the other hand, when the result of the first latching and the previous detection result are the same, the second determination is not performed, and a current of the circuit for signal processing, such as the differential amplifier, is also stopped. In this case, electric power consumption corresponding to one detection period T can be reduced. Note that, even when the result of the first latching and the previous detection result are different, if the result of the first latching and the result of the second latching are different, the first determination becomes invalid, and hence electric power corresponding to two detection periods (2T) is consumed even though the detection result VOUT does not change. 
     In this manner, a result obtained by determination for detection or canceling on the magnetic field intensity may be prevented from being varied due to internal noise or external noise of the magnetic sensor device, and the electric power consumption may be minimized. 
     Further, as illustrated in  FIG. 3 , the present invention can be applied to the application of bipolar detection. As used herein, the bipolar detection means that an output logic is inverted when detection or canceling is determined for any one of the S-pole and the N-pole. In the present invention, for example, when detection or canceling is determined for the S-pole, the S-pole determination is performed again after normal determination for both the S-pole and the N-pole. When the two determination results are the same, the output logic is inverted. In this case, the second N-pole determination is not performed. On the other hand, also when detection or canceling is determined for the N-pole, the N-pole determination is similarly performed again after normal determination for both the S-pole and the N-pole. When the two determination results are the same, the output logic is inverted. In this case, the second S-pole determination is not performed. In this manner, the determination is again performed only for the polarity for which the detection or canceling has been determined, and hence it is possible to realize high-precision detection of a magnetic field intensity and suppression of electric power consumption. 
     In this embodiment, the output of the comparator  4  is connected to two D-type flip-flops. However, the output of the comparator  4  may be connected to three or more D-type flip-flops. In this case, the result obtained by previous detection is held unless all output values are matched with one another. Therefore, as the number of D-type flip-flops connected in parallel increases, the influence of noise may be further suppressed. 
     Further, in the magnetic sensor device exemplified in this embodiment, the circuits such as the Hall element  1  and the comparator  4  have the configuration of  FIG. 1 . However, the circuits are not limited to this circuit configuration. For example, as a reference voltage to be compared in the comparator  4 , an arbitrary voltage may be applied from an additionally provided reference voltage circuit. 
     Further, the magnetic sensor device according to the present invention may be used for alternation detection (for example, rotation detection of a motor). The magnetic sensor device for alternation detection is configured to switch from a state in which only one polarity (for example, S-pole) is detected to a state in which only another polarity (N-pole) is detected upon detection of the one polarity. 
     Also, a driving method according to the timing chart of  FIG. 2  may be changed such that a standby period is not provided between the detection period T and the subsequent detection period T, which produces the same effect.