# Patent

## Title
Autonomously calibrated magnetic field sensor

## Abstract

Magnetic field sensor including a magnetic field sensing circuit (2) comprising a reference magnetic field generator (8) and a magnetic field sensing cell (6), and a signal processing circuit (4) connected to the output of the magnetic field sensing cell and comprising a demodulator circuit and a gain correction feedback circuit (30, 28, 47) for correcting error fluctuations in the transfer characteristic of the magnetic field sensor. The sensor further comprises a reference current generator (3) configured to generate a reference current I ref, the reference current generator connected to the magnetic field sensing circuit (2) configured for generating the reference magnetic field B ref and to the gain correction feedback circuit configured for providing a reference signal (yref) to which an output signal of the demodulator circuit may be compared.

## Background
The present invention relates to a magnetic field sensor that is autonomously calibrated to compensate for fluctuations in the transfer characteristic due to factors, such as temperature, ageing, mechanical stress, and voltage offset. The present invention also relates to a current sensor that measures the current flowing in an external conductor by means of the calibrated magnetic field sensor.
Magnetic field sensors that are calibrated during manufacturing to compensate for voltage offset and temperature drift cannot compensate adequately for fluctuations of the sensor transfer characteristics originating from factors such as mechanical stress and ageing of components. To address this drawback, it is known to provide sensors that are calibrated during use as described in U.S. Pat. No. 4,752,733 and WO 2006/056829.
WO2006/056829 discloses a magnetic field sensor comprising a reference magnetic field generator, a magnetic field sensing cell, and a signal processing circuit connected to the output of the magnetic field sensing cell and comprising one or more feedback loops for correcting variations in the transfer characteristic of the magnetic field sensing cell. The external magnetic field is measured by superimposing a modulated reference magnetic field on the external magnetic field, modulating the output signal of the magnetic field sensing cell at a frequency different from the modulation frequency of the reference magnetic field, one of the frequencies being an integer multiple of the other, and adding or subtracting different phases of the modulated signal in order to extract a measurement signal corresponding to the external magnetic field and a reference signal corresponding to the reference magnetic field. The reference signal is separated from the measurement signal so that it can be used in a feedback loop to compensate for error fluctuations in the magnetic field sensing cell transfer characteristic and at the same time produce an output sensor signal that is free of the reference field component.
The generation of the modulated reference magnetic field however relies on an external reference current source for the reference coil generating the reference magnetic field, which complicates the installation and interconnection of the sensor to external circuitry and components and increases overall costs of implementation. Reliance on an external reference current may also reduce reliability or accuracy of the sensor.
In view of the aforegoing, an object of this invention is to provide a reliable magnetic field sensor that remains accurate over time and is easy and economical to implement in external circuitry or devices.
It is a further object to provide an electrical current sensor including a reliable magnetic field sensor that remains accurate over time and is easy and economical to implement in external circuitry or devices.
It is advantageous to provide a magnetic field sensor with inputs and outputs that allow easy configuration and implementation in different circuits for various applications.
It is advantageous to provide a magnetic field sensor that is economical to manufacture on an industrial scale.
Disclosed herein is a magnetic field sensor including a magnetic field sensing circuit comprising a reference magnetic field generator and a magnetic field sensing cell, and a signal processing circuit connected to the output of the magnetic field sensing cell and comprising a demodulator circuit and a gain correction feedback circuit for correcting fluctuations in the transfer characteristic of the magnetic field sensor, including fluctuations due to errors. The sensor further comprises a reference current generator configured to generate a reference current, the reference current generator connected to the magnetic field sensing circuit configured for generating the reference magnetic field and to the gain correction feedback circuit configured for providing a reference signal to which an output signal of the demodulator circuit may be compared.
Advantageously, incorporation of an internal reference current generator in the sensor simplifies implementation in external circuits for various applications, such as for current sensing applications.
The reference current generator may be connected to a reference coil of the reference magnetic field generator via a current mirror circuit configured to copy the reference current and to generate a second reference current that drives the coil to generate the reference magnetic field.
The gain correction feedback circuit may be connected to the reference current generator via a current mirror circuit configured to copy the reference current Iref and to generate a further reference current that is fed into the gain correction feedback circuit. The current mirror circuit may be connected to a demodulator of the gain correction feedback circuit.
The reference current generator may comprise an integrated circuit element generating a bandgap voltage reference VBG applied across an internal resistor RBS to generate the reference current Iref.
The signal processing circuit may include a voltage-current (V/I) conversion circuit connected to outputs of a measurement signal demodulator of the signal processing circuit. The voltage-current (V/I) conversion circuit may advantageously be combined with the sample and hold function on the measurement signal.
The signal demodulator circuit may comprise at least two demodulators in parallel configured to separate the measurement signal and the reference signal simultaneously, or a single demodulator operable in at least two successive demodulation modes configured to process the measurement and reference signals separately, for example by time division multiplexing.
In an embodiment, the magnetic field sensor may be integrated in an electrical current sensor for measuring an electrical current flowing in a conductor by measuring an external magnetic field generated by the current to be measured. The current sensor may comprise a magnetic core made of a material with high magnetic permeability and having an air-gap in which the magnetic field sensing cell is positioned.



Further objects and advantageous features of the invention will become apparent from the claims, the following description, and the drawings in which:
FIG. 1 is a diagram schematically illustrating the overall circuit principle of a magnetic field sensor according to an embodiment of this invention;
FIG. 2 is a diagram illustrating the circuit of a magnetic field sensor according to an embodiment of this invention;
FIG. 3a illustrates an embodiment of a voltage-current conversion circuit of a magnetic field sensor according to an embodiment of this invention, the FIGS. 3b to 3d showing different connection configurations related to different operation phases of the circuit.



Referring first to FIG. 2, a schema illustrating the principle of a circuit of a magnetic field sensor 1 according to an embodiment of the invention is shown comprising generally a magnetic field sensing circuit 2, an internal reference current generator 3 and a signal processing circuit 4. The magnetic field sensing circuit 2 comprises a magnetic field sensing cell 6, a reference magnetic field generator 8, and a gain correction input 10. The magnetic field sensor according to this invention may advantageously be used as a current sensor, based on detecting the magnetic field generated by the current to be measured. The magnetic field sensor according to this invention may also be implemented in other magnetic field sensing applications.
The magnetic field sensing cell 6 may comprise one or a plurality of magnetic field sensing elements, for example a Hall effect sensor or an array of Hall effect sensors formed in an integrated circuit as is known in the art, the magnetic field sensing cell 6 further comprising a modulator for modulating the output signal of each magnetic field sensing element. Other magnetic field sensors such as fluxgate, giant magneto resistive or other known magnetic field sensors may also be used within the scope of this invention.
The reference magnetic field generator 8 comprises a modulated reference current input 12 feeding a coil reference current Iref,coil driving one or a plurality of reference coils 14 for the purposes of generating a reference magnetic field Bref applied to the magnetic field sensing cell 6. The clock frequency at which the reference coil and magnetic field sensor signal modulators are driven are controlled by switch boxes 16a, 16b whereby the clock frequency of the magnetic field sensing cell modulator is preferably an even factor or multiple, for example one half or two, of the clock frequency controlling the reference coil modulator.
The signal processing circuit 4 comprises an amplifier circuit portion 18, connected to the outputs 20 of the magnetic field sensing cell 6, a demodulating circuit portion 22 and a feedback loop 28 for gain correction feeding back to the input of the magnetic field sensing cell 6. The demodulating circuit portion has a demodulator 24 with an output 23 leading to the magnetic field sensor output 26, a demodulator 30 with an output 25 leading into the gain correction feedback line 28, and a demodulator 32 with an output leading into an offset correction feedback line 27.
The purpose of the demodulators is to separate both components present in the signal at the output of the amplifier, namely the measurement signal and the reference signal. If both signals are present simultaneously, the demodulators can extract the signals by additions and subtractions, as described in WO 2006/056829. This can be done on both signals simultaneously using two demodulators in parallel. Another option is to extract the reference and measurement signals using one single demodulator, which is then operated in two successive demodulation modes. The same approach can also be applied when the measurement and reference signals are processed separately in the amplification chain, i.e. when the sensors are connected so to measure only the external field or the reference field while canceling the other signal.
In the embodiment of FIG. 2, separate demodulators 32, 30 are used for offset correction and gain correction to improve accuracy and responsiveness. A single demodulator which feeds into the offset correction feedback line and gain correction feedback line could however be used. It would further be possible to have only a single demodulator for the feedback lines and the sensor output line 26 by adapting the demodulation scheme to intermittently produce the output signal and offset correction signals. In other words, connected to the pre-amplifier output can be as many demodulators as necessary to demodulate the different components present in the signal:

    
    
        The measurement of the external magnetic field Bext 
        The measurement of the reference magnetic field Bref used to calibrate the gain
        The sensor and preamplifier offset
    
    


Each of these signal components can be extracted by a separate demodulator as shown in FIG. 2, or some of them can be extracted one after another by the same demodulator applying different demodulation schemes on a periodic time basis.
In the present invention, the output of the measurement signal demodulator 24 is advantageously a voltage output, whereby the magnetic field sensor output 26 may thus be easily configured to be a voltage output, or to be a current output by means of a voltage-current (V/I) conversion circuit 34 connected to the demodulator outputs 23. The choice of output—current or voltage—improves the flexibility of implementation of the magnetic field sensor in an external circuit.
Referring now to FIG. 1, the general functioning principle of the sensor according to an embodiment of the invention will be broadly described, before discussing more specific embodiments or aspects thereof illustrated in FIGS. 2 and 3. As mentioned above, the circuit comprises a gain correction feedback circuit with a feedback loop 28. In order to measure the gain error, a reference signal is generated and amplified along with the external signal. To generate the reference signal, a stable reference current Iref is needed. An advantageous aspect of the invention is that the stable reference current Iref is generated by the internal reference current generator 3 that is used to generate a reference magnetic field Bref through the reference coil 14:

Bref=EcoilIref  (1)

where Ecoil is the coil efficiency. By varying the direction of the current reference Iref, reference magnetic field Bref can be positive or negative. Therefore the total magnetic field (B) present at the input of the magnetic field sensor 6—for instance a Hall sensor—is a sum or a difference of the external (Bext) and reference (Bref) field. The magnetic field sensor generates the voltage:

VH=SIBIbias  (2)

where SI is a sensitivity of the Hall sensor and Ibias is a biasing current of the sensor. The signal x at the output of the amplifier is then:

x=f(A,SI,B,Ibias)  (3)

where A is a gain of the amplifier.

The signal x contains the image of both external and reference field that is separated by a demodulation technique as known per se in the prior art, for instance as described in WO2006/056829. For each signal a separate demodulator is provided.
At the output of a first demodulator D1 the signal yout is:

yout=f(GS,Bext)  (4)

while the output of a second demodulator D2 is:

yout_ref=f(GR,Bref)  (5)

where Gs and GR are the gain of the external and reference field respectively.

The demodulated signal on the reference path presents an analogue image of the reference magnetic field Bref through the amplifying chain. To measure an error of the gain, this signal has to be compared to some stable analogue signal generated on the chip. Reference current Iref is already available and stable. Additionally reference current Iref is generating reference magnetic field Bref and the output yout_ref of the second demodulator D2 is an image of reference magnetic field Bref, hence their ratio is constant and can be used for gain correction. It is necessary to ensure that the output yout_ref and reference current Iref are comparable quantities.
If there is no variation of the gain while the signal is amplified, the output of a comparator will be zero. If there is a variation of the gain of the reference field GR, then two scenarios are possible:

    i) if yout_ref>f(Iref), then the output of the comparator Comp=−Δ
    ii) if f(Iref)>yout_ref, then Comp=+Δ
    This output controls the gain correction biasing current of the magnetic field sensor cell (e.g. Hall cell) 6 by decreasing/increasing the bias current Ibias to perform a gain correction. When demodulators D1 and D2 are perfectly matched

ΔGR=ΔGS,

where ΔGi(i=S,R) signifies a gain error, and therefore the gain correction will be equally acting on the demodulator outputs yout and yout_ref, assuring that the output yout is an image of the external magnetic field Bext with a minimal error.



A signal in the amplifying chain can either be a voltage or a current. The output of a Hall sensor is already a voltage. If the amplifier output x is a voltage then the demodulator D2 output yout_ref will be a voltage as well. To make this signal a comparable quantity to the reference current Iref then:

    i) either Iref needs to be converted into a voltage
    ii) or yout_ref needs to be converted into a current
    In order to minimize the gain error, it is also useful to ensure that variation in the gain of the reference and external fields are close to equal ΔGR=ΔGS.


The proposed integrated reference gives a current. The output of a reference demodulator is a voltage. These two quantities need to be compared and their difference is used for gain correction. To maintain ΔGR as close as possible to ΔGS the conversion of the current reference into a voltage has to be done with high precision and low temperature drift. The basic relation between the current and voltage is: V=RI, where R is a resistance. Possible ways of conversion would be through: (i) a very stable oscillator and capacitor which implies a stable resistor; (ii) an external resistor; or (iii) an internal resistor as proposed in embodiments of the present invention.
Preferably, the implemented solution would ensure that a change in current is proportional to a change in voltage ΔI ̃ΔV, so that the ratio of the demodulator output yout_ref for gain correction and the reference current Iref remains intact.
A very stable oscillator is an expensive solution, while the external resistor would be a less costly solution, but the system would then not be fully integrated. An integrated resistor has high temperature drift and if it is used only in the reference path it would not be suitable for the intended sensor applications. However, if another resistor matched with the previous one is used in the signal path, then the temperature drift equally affects both reference and measurement signals and is thus cancelled out so that ΔGR=ΔGS. As a consequence, an output signal of the system according to the invention is a current instead of a voltage.
The functioning of a magnetic field sensor according to the embodiment illustrated in FIG. 2 will now be described. In the embodiment illustrated, the reference current generator 3 comprises an integrated circuit element generating a bandgap voltage reference VBG 35 that is applied across an internal resistor RBG to generate a reference current Iref:

Iref=VBG/RBG  (1)

The reference current may however be generated by other means—for example derived from other known sources of stable or constant voltage. The reference current Iref is copied by a current mirror circuit 36a to generate a second reference current Iref,coil:

Iref,coil=α1Iref  (2)

Where α1 is the nominal ratio between Iref,coil and Iref.

A third reference current is also generated by a further current mirror circuit 36b: 

Iref,r=α2Iref  (3)

With α2 the nominal ratio between Iref,r and Iref.

The second reference current Iref,coil biases the reference coil 14 in order to generate the reference magnetic field Bref:

Bref=EcoilIref,coil  (4)

Where Ecoil is the coil efficiency.

The third reference current Iref,r biases an internal resistor Rvref in order to generate a reference voltage Vref:

Vref=RrefIref,r  (5)

In a variant, the configuration can be simplified in the case where Iref,coil=Iref,r, because the reference coil and the reference resistor can then be placed in series and directly biased with the same current. For a magnetic field sensor in the form of a Hall sensor microsystem, the external magnetic field Bext may be measured and amplified to produce an amplified voltage signal VA,ext representative of the external field as follows:

VA,ext=SIIbiasApreampBext  (6)

where SI is the Hall sensor current-related sensitivity, Ibias the current that biases the sensor, and Apreamp the gain of the preamplifier chain. The reference magnetic field Bref can also be measured by the same circuit to produce an amplified voltage signal VA,ref representative of the reference field as follows:

VA,ref=SIIbiasApreampBref  (7)

The two amplified voltage signals VA,ext and VA,ref can be processed simultaneously by the system if a modulation technique is used (e.g. as in WO2006/056829), or sequentially by alternatively cancelling Bext and Bref so to process only one signal at a time.
The reference demodulator 30 is included in a sensitivity calibration loop. Its aim is to make the gain of the system, namely SIIbiasApreamp, constant during operation, so that the system displays ideal characteristics when compensated. To do so, the loop stabilizes the reference voltage signals:

VA,ref=Vref  (8)

Which results in:

SIIbiasApreampEcoilα1Iref=Rvrefα2Iref  (9)

When all terms in equation (8) are expanded using previous equations. The bias current of the magnetic field sensor is thus adjusted to be:

Ibias=(Rvref/SIApreampEcoil)·(α2/α1)  (10)

The signal output 26 of the system may be directly the amplified voltage signal VA,ext, or its conversion into a current Iout through a voltage-current V/I conversion circuit or through a resistor:

Iout=VA,ext/RVI=SIIbiasApreampBext/RVI  (11)

If the calibration loop is active, the bias current Ibias calculated in equation (10) can be replaced in (11):





  
    
      
        
          
            
              
                I
                out
              
              =
              
              ⁢
              
                
                  V
                  
                    A
                    ,
                    ext
                  
                
                /
                
                  R
                  VI
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  (
                  
                    
                      S
                      I
                    
                    ⁢
                    
                      A
                      preamp
                    
                    ⁢
                    
                      
                        B
                        ext
                      
                      /
                      
                        R
                        VI
                      
                    
                  
                  )
                
                ·
                
                  (
                  
                    
                      
                        R
                        vref
                      
                      /
                      
                        S
                        I
                      
                    
                    ⁢
                    
                      A
                      preamp
                    
                    ⁢
                    
                      E
                      coli
                    
                  
                  )
                
                ·
                
                  (
                  
                    
                      α
                      2
                    
                    /
                    
                      α
                      1
                    
                  
                  )
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  
                    B
                    ext
                  
                  ⁡
                  
                    (
                    
                      1
                      /
                      
                        E
                        coli
                      
                    
                    )
                  
                
                ·
                
                  (
                  
                    
                      R
                      vref
                    
                    /
                    
                      R
                      VI
                    
                  
                  )
                
                ·
                
                  (
                  
                    
                      α
                      2
                    
                    /
                    
                      α
                      1
                    
                  
                  )
                
              
            
          
        
      
    
    
      
        (
        12
        )
      
    
  




In equation (12), it may be noted that the external field Bext is advantageously multiplied by a stable constant, because:

    a) The efficiency of the coil depends on geometrical dimensions only, which are very little subject to change with temperature or ageing.
    b) The resistor ratio Rvref/RVI can be guaranteed to be stable if both components are matched internally, i.e. the devices are made similar and are placed near each other on the silicon.
    c) The current ratio α2/α1 can also be made stable because it may be generated by two transistors forming a current mirror which can be matched like the resistors. This implies that the calibration loop can efficiently adjust the sensitivity of the system so that the output current is:

Iout=Bext·K  (13)

Where K is constant and equal to:

K=(1/Ecoil)·(Rvref/RVI)·(α1/α2)  (14)

A sensitivity change can be caused by a change in one of the three components discussed in a), b) and c). This can advantageously be minimized for example by increasing the relative surface area occupied by the devices to improve the quality of the matching of integrated components.



Referring to FIGS. 3a to 3d, an embodiment of a voltage-current (V/I) conversion circuit 34 that may be included in the signal processing circuit 4, will now be described. According to an advantageous embodiment, the V/I circuit 34 may include a sample and hold function.
The integration is done through the amplifier with the capacitors C1-C5 and switches T1, T2. The sample and hold operation is possible due to the presence of the capacitors C3 and C6, while the voltage to current conversion is done through the resistor R.
The V/I converter 34 is connected to the outputs 23 of the signal demodulator 24 and has a differential input voltage inputs Vin_n, Vin_p so we can write:

Vin_n=vcm−Vin/2  (1)

Vin_p=vcm+Vin/2  (2)

where vcm is the common-mode voltage. Operation of the voltage to current converter comprises three phases. In a first phase, switches T1 are closed (FIG. 3b). During this phase the input voltage Vin is sampled. If Qi(phase 1) represents the charge on the capacitor Ci in the first phase, then corresponding capacitor charges collected on the input capacitors C1 and C2 can be written as:

Q1(phase 1)=C1(Vin_p−vcm)=C1Vin(phase 1)/2  (3)

Q2(phase 1)=C2(Vin_n−vcm)=−C2Vin(phase 1)/2  (4)

The output of the amplifier—node B and node A—are connected to the common-mode voltage vcm through the capacitors C3 and C6. If previously C4 and C5 were discharged in a reset phase then since there is no current from the inputs of the amplifier and the voltages VA and VB at nodes A and B are equal to the supply voltage vcm: VA=VB=vcm. Therefore no current can flow through the resistor R, so the output current is zero: Iout=0. Otherwise, if there was no reset phase, capacitor C5 would not be able to discharge since no current flows in/from the V− node so that the voltage VB at node B would keep its value from the previous cycle and Iout(phase 1)=Iout(phase 0).

In a second phase the switches T2 are closed (FIG. 3c). The capacitor charges collected on C1 and C2 are being transferred to C4 and C5. Now the input nodes (V− node, V+ node) of the amplifier 38 are connected to the common-mode voltage vcm through capacitors C3 and C6.

ΔQ1=ΔQ4+ΔQ3  (5)

ΔQ2=ΔQ5+ΔQ6  (6)

From the equations above we can calculate the voltages at the inputs of the amplifier:

Q1(phase 2)−Q1(phase 1)=Q3(phase 2)−Q3(phase 1)+Q4(phase 2)−Q4(phase 1)  (7)

Q3(phase 1)=0 and Q4(phase 1)=0  (8)

C1(vcm−V+−Vin(1)/2)=C3(vcm−V+)+C4(vcm−V+)  (9)

for C3=C4 and C1=2C3

V+=vcm−Vin/10  (10)

Due to the negative feedback in the converter and high gain of the amplifier, the amplifier input voltages are equal: V+=V−.

From the equations (6) and (10), the voltage at node B is VB=vcm−Vin/2. Therefore the output current is directly proportional to the sampled input:

Iout=IR=(VB−vcm)/R=−Vin/2R  (11)

During the third phase all the switches are opened (FIG. 3d) and there is no current through the capacitors C4 and C5. In that case the voltage VB at node B will keep its previous value and the output current Iout will not change.
The amplifier 38 used in the converter may comprise an offset cancellation within its structure. The offset may be cancelled by an input chopper, so that during one period V+=Vin_p and V−=Vin_n, while during the second period V+=Vin_n and V−=Vin_p. Since we have a single ended output when the inputs are crossed, signal paths are internally crossed as well.

## Claims

1. Magnetic field sensor including a magnetic field sensing circuit comprising a reference magnetic field generator and a magnetic field sensing cell, and a signal processing circuit connected to the output of the magnetic field sensing cell and comprising a gain correction feedback circuit for correcting fluctuations in the transfer characteristic of the magnetic field sensor, the sensor further comprising a reference current generator configured to generate a reference current Iref, the reference current generator connected to the magnetic field sensing circuit configured for generating the reference magnetic field Bref and to the gain correction feedback circuit, the gain correction feedback circuit comprising a demodulator configured to generate a reference output signal yout_ref that is an image of the reference magnetic field Bref, the gain correction feedback circuit further comprising a comparator configured to compare said reference output singal yout_ref to a signal f(Iref) based on the reference current Iref.

2. Sensor according to claim 1, wherein the reference current generator is connected to a reference coil of the reference magnetic field generator via a current mirror circuit configured to copy the reference current Iref and to generate a second reference current Iref,coil that drives the coil to generate the reference magnetic field Bref.

3. Sensor according to claim 1, wherein the gain correction feedback circuit is connected to the reference current generator via a current mirror circuit configured to copy the reference current Iref and to generate a further reference current (Iref,r) that is fed into the gain correction feedback circuit.

4. Sensor according to claim 1, wherein the current mirror circuit is connected to the demodulator of the gain correction feedback circuit.

5. Sensor according to claim 1, wherein the reference current generator comprises an integrated circuit element generating a bandgap voltage reference VBG applied across an internal resistor RBG to generate the reference current Iref.

6. Sensor according to claim 1, wherein the signal processing circuit includes a voltage-current (V/I) conversion circuit connected to outputs of a measurement signal demodulator of the signal processing circuit.

7. Sensor according to claim 6, wherein the voltage-current (V/I) conversion circuit comprises a circuit configured to integrate and sample and hold a measurement signal.

8. Sensor according to claim 1, wherein the signal processing circuit includes a demodulator circuit comprising at least two demodulators in parallel configured to separate the measurement signal and the reference signal simultaneously.

9. Sensor according to claim 1, wherein the signal processing circuit includes a demodulator circuit comprising a demodulator operable in at least two successive demodulation modes configured to process the measurement and reference signals separately.

10. Electrical current sensor for measuring an electrical current flowing in a conductor by measuring an external magnetic field generated by the current to be measured, the electrical current sensor comprising a magnetic field sensor according to claim 1.

11. Electrical current sensor according to claim 10, comprising a magnetic core made of a material with high magnetic permeability and having an air-gap in which the magnetic field sensing cell is positioned.