# Patent

## Title
Successive approximate capacitance measurement circuit

## Abstract

A capacitance measurement circuit includes a current source, a switch, and a comparator. The current source is coupled to drive a current through a circuit node. The switch is coupled to the circuit node to switch the current into a device under test (“DUT”) capacitor. The comparator includes first and second input ports. The comparator is coupled to compare a first voltage received on the first input port against a reference voltage received on the second input port. The first voltage is related to the current driven through the circuit node, a frequency at which the switch is switched, and a capacitance of the DUT capacitor.

## Background
REFERENCE TO RELATED APPLICATIONS
This application is a divisional of Ser. No. 11/337,272 filed Jan. 20, 2006 now U.S. Pat. No. 7,312,616.


TECHNICAL FIELD
This disclosure relates generally to electronic circuits, and in particular but not exclusively, relates to capacitance measurement circuits.
BACKGROUND INFORMATION
Capacitance sensors are used to implement a variety of useful functions including touch sensors (e.g., touch pad, touch dial, touch wheel, etc.), determining the presence of an object, accelerometers, and other functions. FIG. 1 illustrates a conventional capacitance sensor 100 including three switches 105 with control terminals φ0, φ1, and φ2, an integrating capacitor 110 having a capacitance CINT, and an analog to digital (“ADC”) converter 115. Capacitance sensor 100 may be used to sense changes in capacitance on a device under test (“DUT”) capacitor 120 having a changing capacitance CDUT.
During operation, capacitance sensor 100 operates as follows to sense capacitance changes on DUT capacitor 120. First, integrating capacitor 110 is discharged to a ground potential by asserting control terminal φ0 to open circuit switch SW0 and by asserting control terminal φ1 to close circuit switch SW1. Once discharged to ground, integrating capacitor 110 is disconnected from ground by asserting φ1 to open switch SW1. Then, DUT capacitor 120 is charged to the supply voltage VS by asserting φ0 to open circuit switch SW0 and asserting φ2 to close circuit switch SW2. Once DUT capacitor 120 charges to the supply voltage VS, the charge on DUT capacitor 120 is transferred onto integrating capacitor 110 and distributed between the two capacitors. Charge transfer occurs by asserting φ1 and φ2 to open circuit switches SW1 and SW2, respectively, and asserting φ0 to close circuit switch SW0.
The above stages of charging DUT capacitor 120 and transferring the charge onto integrating capacitor 110 are repeated a fixed number times causing the voltages of nodes N1 and N2 to ramp with time as illustrated in line graphs 130 and 135, respectively. After a fixed number of consecutive charging stages and charge transferring stages, ADC converter 115 samples the final voltage on node N2. The capacitance CDUT is determined based on the output of ADC converter 115 and is proportional to the voltage at node N2 after the final charge transfer stage.
Capacitance sensor 100 functions properly if CINT is considerably larger than CDUT (e.g., 1000× larger) so as to average out noise on the supply voltage VS. However, using a large CINT value requires a large number of charge transfer cycles to achieve a good capacitance measurement of CDUT. Therefore, capacitance sensor 100 may have a relatively slow measurement time. Furthermore, capacitance sensor 100 uses ADC 115 which is a relatively complex and expensive component.



BRIEF DESCRIPTION OF THE DRAWINGS
Non-limiting and non-exhaustive embodiments of the invention are described with reference to the following figures, wherein like reference numerals refer to like parts throughout the various views unless otherwise specified.
FIG. 1 is a block diagram illustrating a conventional capacitance sensor.
FIG. 2 is a circuit diagram illustrating a capacitance measurement circuit, in accordance with an embodiment of the invention.
FIG. 3 is a flow chart illustrating a process of operation of a capacitance measurement circuit, in accordance with an embodiment of the invention.
FIG. 4 is a circuit diagram illustrating a capacitance measurement circuit, in accordance with an alternative embodiment of the invention.
FIG. 5 is a circuit diagram illustrating a capacitance measurement circuit, in accordance with an alternative embodiment of the invention.
FIG. 6 illustrates a demonstrative integrated circuit for implementing an embodiment of the invention.



DETAILED DESCRIPTION
Embodiments of an apparatus and method of operation for a capacitance measurement circuit are described herein. In the following description numerous specific details are set forth to provide a thorough understanding of the embodiments. One skilled in the relevant art will recognize, however, that the techniques described herein can be practiced without one or more of the specific details, or with other methods, components, materials, etc. In other instances, well-known structures, materials, or operations are not shown or described in detail to avoid obscuring certain aspects.
Reference throughout this specification to “one embodiment” or “an embodiment” means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the present invention. Thus, the appearances of the phrases “in one embodiment” or “in an embodiment” in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
FIG. 2 is a circuit diagram illustrating a capacitance measurement circuit 200, in accordance with an embodiment of the invention. The illustrated embodiment of capacitance measurement circuit 200 includes a current source 205, a comparator 210, switches 215, switching logic 220, filter capacitors CF1 and CF2, a resistor RF, and a switchable filter circuit 225. The illustrated embodiment of filter circuit 225 includes a switch SW6 and a capacitor CF3. Capacitance measurement circuit 200 may be used to measure the absolute capacitance CDUT of a DUT capacitor 230 or to measure/monitor capacitance changes ΔCDUT of DUT capacitor 230.
The components of capacitance measurement circuit 200 are coupled as follows. Current source 205 is coupled to a node N3 to drive a current IDAC through node N3. Switching logic 220 is coupled to switches 215 to selectively open and close switches 215 at a switching frequency f in a predetermined manner. As switches 215 are opened and closed in the predetermined manner, DUT capacitor 230 is continuously charged by current source 205 and discharged to a ground potential. Switching logic 220 may be logic embodied within hardware circuits or software code executed by a microcontroller or processor.
During operation, current IDAC is switched into DUT capacitor 230 at the switching frequency f. When current is switched into DUT capacitor 230, it has an effective resistance REFF given by relation 1 below,




  
    
      
        
          R
          EFF
        
        =
        
          2
          
            f
            ·
            
              C
              DUT
            
          
        
      
    
    
      
        (
        
          Relation
          ⁢
          
            
          
          ⁢
          1
        
        )
      
    
  




and therefore according to Ohm's Law, an effective voltage appears across DUT capacitor 230 at node N3 given by relation 2 below,





  
    
      
        
          V
          
            N
            ⁢
            
              
            
            ⁢
            3
          
        
        =
        
          
            
              I
              DAC
            
            ·
            
              R
              EFF
            
          
          =
          
            
              I
              DAC
            
            ·
            
              
                2
                
                  f
                  ·
                  
                    C
                    DUT
                  
                
              
              .
            
          
        
      
    
    
      
        (
        
          Relation
          ⁢
          
            
          
          ⁢
          2
        
        )
      
    
  




Therefore, changing either the switching frequency f or the charging current IDAC will cause the voltage at node N3 to change proportionally according to relation 2. As illustrated in relation 2, there are four variables (VN3, IDAC, f, and CDUT). If IDAC and f are known or programmable values and VN3 can be measured or successively approximated, then the absolute capacitance CDUT or change in capacitance ΔCDUT of DUT capacitor 230 can be resolved.
In one embodiment, current source 205 is a variable current source capable of generating a selectable charging current IDAC in response to a select input 207. In one embodiment, select input 207 is a digital input coupled to receive a multi-bit select value (e.g., 8-bit value). Accordingly, voltage VN3 may be made to vary either by varying the multi-bit select value on select input 207 (i.e., varying the charging current) or by varying the switching frequency f via switching logic 220.
In one embodiment, comparator 210 is a voltage comparator coupled to compare a voltage VN4 at node N4 received on port P1 against a reference voltage VR received on port P2. Voltage VN4 at node N4 is approximately equal to voltage VN3 at node N3 (e.g., filtered or averaged version thereof) or otherwise related in a determinable or known manner to VN3. When voltages VN4 and VR crossover, comparator 210 toggles its output ‘O’ as an indication of the crossover event. The logic state of output ‘O’ is also an indication of whether VN4 is greater than or less than VR. Accordingly by continuously adjusting either the switching frequency f and/or the charging current IDAC, a technique of “successive approximation” may be used to iteratively approximate the value of capacitance CDUT by way of relation 2. The successive approximation technique sequentially adjusts the switching frequency f and/or the charging current IDAC after comparing VN4 to VR to iteratively bring VN4 closer to VR, until VN3 in relation 2, can be substituted with the value of VR within an acceptable margin of error (note: VN3≅VN4). With VN4 assumed to be approximately equal to VR, relation 2 can be solved to determine CDUT or ΔCDUT.
In the illustrated embodiment, filtering capacitor CF1 is coupled to node N3, filtering capacitor CF2 is coupled to node N4, and resistor RF is coupled between nodes N3 and N4. Filtering capacitors CF1 and CF2 and resistor RF act to filter noise on node N3 and average its value over time. Filter circuit 225 provides an additional filtering function that may be enabled/disabled by appropriate assertion of φ6 to open or close switch SW6. In one embodiment, resistor RF and filtering capacitor CF2 are variable to provide adjustable filtering having adjustable cutoff frequencies. If switching frequency f is used as the knob to adjust the effective resistance REFF of DUT capacitor 230 and therefore adjust voltage VN3 at node N3, then appropriate adjustment of RF and CF2 can be used to tune the filtering cutoff frequency accordingly. Example components values for a CDUT≅10 pF are VS≅3.3V, VR=1.30V, CF1≅100 pF, CF2≅10 pF, and RF≅1 MΩ.
Circuit diagram 240 is the circuit equivalent of capacitance measurement circuit 200 about node N3 when switch SW6 is open circuited. As can be seen, filtering capacitors CF1 and CF2 and resistor RF form a low pass filter coupled to node N3. REFF represents the effective resistance of DUT capacitor 230 switched at a frequency f. Adjustment of CF2 and/or RF will adjust the cutoff frequency of the low pass filter illustrated in circuit diagram 240.
FIG. 3 is a flow chart illustrating a process 300 of operation for capacitance measurement circuit 200, in accordance with an embodiment of the invention. The order in which some or all of the process blocks appear in each process should not be deemed limiting. Rather, one of ordinary skill in the art having the benefit of the present disclosure will understand that some of the process blocks may be executed in a variety of orders not illustrated.
In a process block 305, power is asserted to capacitance measurement circuit 200 or capacitance measurement circuit 200 is reset. In a process block 310, node N3 is pre-charged. Pre-charging node N3 aids the successive approximation by providing a starting voltage that is closer to VR and therefore capacitance measurement circuit 200 achieves steady state operation quicker. In one embodiment, node N3 is precharged to the supply voltage VS.
In a process block 315, DUT capacitor 230 is charged. DUT capacitor 230 may be charged by asserting φ5 to open circuit switch SW5 and asserting φ4 to close circuit switch SW4. With switch SW4 closed circuited, current IDAC flows into DUT capacitor 230 from node N3. In one embodiment, current source 205 charges DUT capacitor 230 up to the supply voltage VS each charging cycle.
In a process block 320, DUT capacitor 230 is discharged. DUT capacitor 230 may be discharged by asserting φ4 to open circuit switch SW4 and asserting φ5 to close circuit switch SW5. Once switch SW5 is close circuited, charge will flow from DUT capacitor 230 into the return path voltage rail (GND) thereby discharging DUT capacitor 230. While switch SW4 is open circuited, charging current IDAC may be recharging filter capacitor CF1. Accordingly, it should be understood that a portion of the charging current IDAC used to charge DUT capacitor 230 when switch SW4 is close circuited may be sourced from filter capacitor CF1.
The switching frequency f and the determination of when to open and close circuit switches 215 is executed by switching logic 220. In one embodiment, switching logic 220 selects a 50% duty cycle between switches SW4 and SW5; however, other duty cycles may be used.
In a process block 325, the voltage VN4 at node N4 is compared by comparator 210 to the reference voltage VR. Although FIG. 3 illustrates process block 325 as occurring after discharging DUT capacitor 230, it should be appreciated that process block 325 may occur prior to discharging DUT capacitor 320, occur in parallel with either/both of the discharging or charging stages, or even occur independent of the charging and discharging stages.
If the voltage VN4 is greater than the reference voltage VR (decision block 330), then process 300 continues process block 335. In process block 335, the knob used to adjust the effective resistance REFF of DUT capacitor 230 is adjusted to reduce REFF and therefore reduce VN4. REFF may be reduced by decreasing charging current IDAC and/or increasing switching frequency f. If the voltage VN4 is less than the reference voltage VR (decision block 330), then process 300 continues to a process block 340. In process block 340, the knob used to adjust the effective resistance REFF of DUT capacitor 230 is adjusted to increase REFF and therefore increase VN4. REFF may be increased by increasing charging current IDAC and/or decreasing switching frequency f.
After adjustment of the circuit knob (e.g., switching frequency or charging current), process 300 returns to process block 315, if the desired successive approximation resolution has not yet be achieved (decision block 345). In one embodiment, the desired resolution may be achieved after a fixed number of adjustment cycles (e.g., 8, 16, etc.). In one embodiment, the desired resolution may be achieved when the voltage difference between VR and VN4 is measured by comparator 210 to be within a predetermined threshold. After the desired resolution (i.e., amount of acceptable deviation between VN4 and VR) has been achieved, the current values of charging current IDAC and switching frequency f are plugged into relation 2 with the value of VR substituted for VN3, and relation 2 solved to determine CDUT (process block 350).
In one embodiment, process 300 may be executed while only adjusting charging current IDAC as the sole circuit knob for manipulating REFF of DUT capacitor 230. In one embodiment, process 300 may be executed while only adjusting switching frequency f as the sole circuit knob for manipulating REFF of DUT capacitor 230. In one embodiment, both charging current IDAC and switching frequency f may be adjusted to provide greater successive approximation resolution. In alternative embodiments, the value of the reference voltage VR itself may be adjusted while maintaining voltage VN4 at a fixed value by fixing the charging current IDAC and the switching frequency f. In this alternative embodiment, VR would be sequentially adjusted until it approximately equaled VN4. The final value of VR would then be substituted into relation 2 for VN3, with the assumption that VN4≅VN3. Furthermore, all three circuit knobs (VR, f, and IDAC) may be adjusted in turn to provide even greater flexibility and successive approximation resolution.
As mentioned above, capacitance measurement circuit 200 may also be used to monitor for a change in capacitance ΔCDUT (e.g., operated as a proximity sensor). Capacitance measurement circuit 200 may be initialized using process 300 until VN4 is substantially equal to VR. Then, a voltage margin may be added to VR. While holding switching frequency f and charging current IDAC steady, comparator 210 monitors the voltage at node N3. When the capacitance CDUT of DUT capacitor 230 changes by a predetermined amount corresponding to the voltage margin added to the reference voltage VR, output O of comparator 210 toggles indicating the event.
FIG. 4 is a circuit diagram illustrating a capacitance measurement circuit 400, in accordance with an alternative embodiment of the invention. Capacitance measurement circuit 400 is similar to capacitance measurement circuit 200, with the exceptions discussed below. Capacitance measurement circuit 400 may be used to measure the absolute capacitance CDUT of a DUT capacitor 230 or to measure/monitor capacitance changes ΔCDUT of DUT capacitor 230 in a similar manner as discussed in process 300. The illustrated embodiment of capacitance measurement circuit 400 includes current source 205, comparator 210, switches 215 (including switches SW4, SW5, SW7, SW8, and SW9), switching logic 220, filter capacitor CF1, and a low pass filter (“LPF”) 405.
LPF 405 and switch SW9 are coupled between port P1 of comparator 210 and circuit node N3. Filter 405 illustrates that a variety of filtering circuits may be used to implement the filtering and averaging functions executed by resistor RF and filtering capacitor CF2 in FIG. 2. The filtering function implemented by LPF 405 may be adjustable or fixed. In one embodiment, the filtering function may be selectable under control of a microcontroller or even switching logic 220.
Switches SW7, SW8, and SW9 are included within capacitance measurement circuit 400 to selectively isolate node N3. Node N3 may be isolated for pre-charging, for coupling and measuring different DUT capacitors 230, for coupling a variety of different filtering capacitors CF1, or otherwise. Switch SW8 specifically illustrates how node N3 may be pre-charged to the supply voltage VS by open circuiting switches SW4, SW7, and SW9 while close circuiting switch SW8.
FIG. 5 is a circuit diagram illustrating a capacitance measurement circuit 500, in accordance with an alternative embodiment of the invention. FIG. 5 illustrates how the various subcomponents of capacitance measurement circuits 200 and 400 may be implemented in a circuit design. As illustrated, multiple switches may be coupled to node N3, which are in turn coupled to multiple pins. The multiple pins may be used to couple to a variety of different DUT capacitors 230. The switches may be selectively enabled to measure the capacitance of each DUT capacitor 230. In this manner, capacitance measurement circuit 500 may be time shared by a plurality of pins for measuring/monitoring the capacitance of multiple DUT capacitors 230 each coupled to a different pin.
FIG. 6 illustrates a demonstrative integrated circuit (“IC”) 600 implemented using an embodiment of capacitance measurement circuits 200, 300, or 500. IC 600 illustrates a Programmable System on a Chip (PSoCTM) microcontroller by Cypress Semiconductor Corporation. The illustrated embodiment of IC 600 includes input/output (“I/O”) ports 602. I/O ports 602 may be programmable. I/O ports 602 are coupled to Programmable Interconnect and Logic (“PIL”) 604 which acts as an interconnect between I/O ports 602 and a digital block array 606. Digital block array 606 may be configured to implement a variety of digital logic circuits (e.g., DAC, digital filters, digital control systems, etc.) using configurable user modules (“UMs”). Digital block array 606 is further coupled to a system bus 612.
Static Random Access Memory (“SRAM”) 610 and processor 611 are also coupled to system bus 612. Processor 611 is coupled to non-volatile storage (“NVS”) 616 which may be used to store firmware (e.g., control algorithms executable by processor 225 to implement process 300). In one embodiment, processor 611 implements switching logic 220.
An analog block array 618 is coupled to system bus 612. Analog block array 618 also may be configured to implement a variety of analog circuits (e.g., ADC, analog filters, comparators, current sources, etc.) using configurable UMs. Analog block array 618 is also coupled to an analog I/O unit 624 which is coupled to I/O ports 602.
As illustrated, capacitance measurement circuits 200, 300, or 500 may be incorporated into IC 600 and coupled to analog I/O unit 624 for coupling to an externally coupled DUT capacitor 230 via I/O ports 602. Various subcomponents of capacitance measurement circuits 200, 300, or 500 may be implemented with various UMs of digital clock array 606 or analog block array 618 or the subcomponents may be stand alone components.
The process described above may constitute machine-executable instructions embodied within a machine (e.g., computer) accessible medium, which when executed by a machine will cause the machine to perform the operations described herein. Additionally, the processes may be embodied within hardware, such as an application specific integrated circuit (“ASIC”) or the like. A machine-accessible medium includes any mechanism that provides (i.e., stores and/or transmits) information in a form accessible by a machine (e.g., a computer, network device, personal digital assistant, manufacturing tool, any device with a set of one or more processors, etc.). For example, a machine-accessible medium includes recordable/non-recordable media (e.g., read only memory (ROM), random access memory (RAM), magnetic disk storage media, optical storage media, flash memory devices, etc.), as well as electrical, optical, acoustical or other forms of propagated signals (e.g., carrier waves, infrared signals, digital signals, etc.).
As described above, capacitance measurement circuits 200, 300, or 500 may be incorporated into IC 600, as well as, various other integrated circuits. Descriptions of capacitance measurement circuits 200, 300, or 500 may be generated and compiled for incorporation into other integrated circuits. For example, behavioral level code describing capacitance measurement circuits 200, or portions thereof, may be generated using a hardware descriptive language, such as VHDL or Verilog, and stored to a machine-accessible medium. Furthermore, the behavioral level code can be compiled into register transfer level (“RTL”) code, a netlist, or even a circuit layout and stored to a machine-accessible medium. The behavioral level code, the RTL code, the netlist, and the circuit layout all represent various levels of abstraction to describe capacitance measurement circuits 200, 300, or 500.
The above description of illustrated embodiments of the invention, including what is described in the Abstract, is not intended to be exhaustive or to limit the invention to the precise forms disclosed. While specific embodiments of, and examples for, the invention are described herein for illustrative purposes, various modifications are possible within the scope of the invention, as those skilled in the relevant art will recognize.
These modifications can be made to the invention in light of the above detailed description. The terms used in the following claims should not be construed to limit the invention to the specific embodiments disclosed in the specification. Rather, the scope of the invention is to be determined entirely by the following claims, which are to be construed in accordance with established doctrines of claim interpretation.

## Claims

1. A method of measuring a capacitance of a device under test (“DUT”) capacitor, comprising:
generating a selectable current having a current magnitude, using a variable current source;
switching between charging the DUT capacitor with the selectable current by driving the selectable current into the DUT capacitor and discharging the DUT capacitor at a switching frequency;
comparing a first voltage, responsive to a second voltage on the DUT capacitor, to a reference voltage to determine whether the first voltage is greater than or less than the reference voltage; and
adjusting at least one of the switching frequency, the current magnitude, or the reference voltage until the first voltage is substantially equal to the reference voltage;
monitoring the first voltage while holding the switching frequency and current magnitude steady; and
indicating when the first voltage crosses over the reference voltage.

2. The method of claim 1, further comprising:
adjusting at least one of the switching frequency or the current magnitude multiple times; and
comparing the first voltage to the reference voltage after each adjustment to the switching frequency or the current magnitude.

3. The method of claim 2, wherein adjusting at least one of the switching frequency or the current magnitude comprises adjusting at least one of the switching frequency or the current magnitude to iteratively bring the first voltage closer to the reference voltage after each adjustment.

4. The method of claim 3, further comprising successively approximating the capacitance of the DUT capacitor using the following equation:




  
    V
    =
    
      I
      ·
      
        2
        
          F
          ·
          C
        
      
    
  
  ,




where V represents the second voltage, I represents the current magnitude, F represents the switching frequency, and C represents the capacitance of the DUT capacitor.

5. The method of claim 2, further comprising precharging a circuit node coupled to an output of the variable current source generating the selectable current while a switch coupled between the circuit node and the DUT capacitor is open circuited.

6. A method of measuring a capacitance of a device under test (“DUT”) capacitor, comprising:
generating a current having a current magnitude;
switching between charging the DUT capacitor with the current and discharging the DUT capacitor at a switching frequency;
adjusting at least one of the switching frequency or the current magnitude multiple times;
after each adjustment to the switching frequency or the current magnitude, comparing a first voltage, responsive to a second voltage on the DUT capacitor, to a reference voltage to determine whether the first voltage is greater than or less than the reference voltage;
adjusting at least one of the switching frequency or the current magnitude until the first voltage is substantially equal to the reference voltage;
changing the reference voltage by a first margin;
monitoring the first voltage while holding the switching frequency and current magnitude steady; and
indicating when the first voltage crosses over the reference voltage.

7. The method of claim 1, further comprising filtering the second voltage on the DUT capacitor to generate the first voltage.

8. The method of claim 1, wherein the first voltage and the second voltage are substantially equivalent.