Capacitance Measurement Using AN231E04 FPAA

App Note 306 - Capacitance Measurement Using AN231E04 FPAA

1. Purpose

The purpose of this document is to describe how to measure capacitance with the AN231E04 dpASP by creating an oscillator whose frequency depends on the capacitance under test. The document also describes the circuitry required to convert the oscillation frequency to a voltage level, and how to linearize the output. Finally there is a description of a real application using a capacitive humidity sensor.

2. AnadigmDesigner2 Circuit

2.1. Oscillator

Comparator oscillator with matched feedback resistors and capacitor under test across its inputs.
Figure 1: Oscillator circuit

It is not enough to connect the comparator output back to its input via an RC network; to get oscillation there needs to be hysteresis. This is achieved by using the comparator which is part of the GainSwitch CAM and connecting its inputs to a +2V DC source and its output to the second input of the comparator which is dual input mode, as shown in figure 1. The settings of the GainSwitch CAM are shown below:

GainSwitch settings providing comparator hysteresis, with upper gain 0.8 and lower gain −0.8.
GainSwitch CAM settings

The corner frequency is set high and should be above the oscillation frequency. The input gains should be opposite polarity to provide hysteresis, the positive value should be less than +1, the negative value greater than -1. Figure 2 below shows frequency versus capacitance for this circuit, and also a plot of 1/Frequency versus capacitance.

Oscillator frequency decreases as capacitance increases.
Figure 2a: Frequency versus capacitance
Reciprocal frequency, or oscillation period, increases linearly with capacitance.
Figure 2b: Period versus capacitance

2.2. Frequency To Voltage Convertor

It may be desirable to convert the oscillator frequency into a voltage which can more easily be measured. The circuit in figure 3 shows the oscillator circuit of figure 1 connected to 3 CAMs which act as a frequency to voltage converter. The fourth CAM is a low pass filter that just smoothes the output.

AD2 circuit combining the capacitance oscillator, integrator, SumInv, hold, and low-pass filter CAMs.
Figure 3: Oscillator and frequency-to-voltage converter

The way this circuit works is as follows: a repeating ramp is created using an integrator with DC voltage on its input. The output of the integrator ramps from 0V but is reset by the oscillator back to 0V once per cycle. The SumInv CAM expands the ramp so that it covers the full -3V to +3V signal range for the AN231E04, and just before the ramp is reset it is sampled by the HoldVoltageControlled CAM.

The point at which the ramp is sampled and then reset is determined by the period of the oscillation in a linear way, so period is converted linearly to voltage. Figure 2 shows that the oscillation period (1/Frequency) varies linearly with capacitance, so the circuit of figure 3 will convert capacitance linearly to voltage. This is shown in figure 4 below. The low pass bilinear filter is there simply to smooth the output.

The parameters of this circuit have been set so that a capacitance of 330pF gives a differential output voltage of 0V. The reason for this is that in section 3 we look at a real application using a capacitive sensor whose normal capacitance is 330pF. For measuring capacitances over a different range it may be necessary to adjust the integrator constant i.e. for a larger capacitor one should use a lower integration constant. Alternatively one can change the values of the feedback resistors i.e. for a larger capacitor use smaller resistor values.

Differential output voltage versus capacitance, crossing zero near 330 pF.
Figure 4: Output voltage versus capacitance

The parameter settings for the 3 CAMs in the frequency to voltage converter are shown below:

The original application package references the design file Capacitance Meas plus F2V v2.ad2.

Sample-and-hold settings for the first frequency-to-voltage converter.
HoldVoltageControlled CAM settings
Integrator settings with integration constant 0.045 per microsecond.
Integrator CAM settings
Inverting sum stage settings with gains of 1.5 and 2.
SumInv CAM settings

The parameter settings for the low pass filter are shown below:

Bilinear low-pass filter settings with corner frequency 0.138 kHz and gain 1.
Low-pass filter CAM settings

2.3. Linearization

The circuit of figure 3 converts capacitance to differential output voltage in a linear way. However, it may be that the purpose of using this circuit is not to measure capacitance itself but to measure some other parameter that influences capacitance. The capacitor in this case is called a capacitive sensor. Capacitive sensors are used to measure a wide variety of parameters e.g. proximity, position or displacement, humidity, fluid level, pressure, acceleration. Although the circuit of figure 3 outputs a voltage that varies linearly with capacitance, it may be that the sensor capacitance does not vary linearly with the parameter to be measured.

The circuit of figure 3 can be modified to compensate for non-linearity in the sensor. The compensated circuit is shown in figure 5. The linearization is performed by a transfer function CAM.

Capacitance measurement circuit with an added TransferFunction CAM for sensor linearization.
Figure 5: Oscillator, converter, and linearization

The transfer function CAM implements a user specified voltage transfer function with 256 quantization steps stored in a look-up table. It produces a specified output voltage in response to the value of the sampled input voltage, so for 256 input voltage steps between -3V and +3V the user needs to define 256 corresponding output voltages. The user can do this manually but this is laborious, there is a much easier way using Microsoft Excel.

By creating a column of 256 values in Excel that describe the required transfer function (all between -3V and +3V), these values can then be saved as a .CSV file (comma-separated values). This CSV file can then be uploaded into the transfer function CAM by double clicking on the CAM, clicking on Lookup Table, clicking on Load, navigating to the CSV file and then clicking Open. Then click OK, then OK again and it is done.

It is up to the user to correctly define the transfer function so that it compensates for the non-linearity of the capacitive sensor. The parameter settings for the transfer function CAM and the first part of the Look-Up Table are shown below:

The original application package references the design file Cap Meas plus F2V plus Transfer.ad2.

The original application package also references “linear transfer.csv”, which contains values for a linear transfer function. Substitute your own values to implement a different transfer function.

User-defined voltage transfer function CAM configuration.
TransferFunction CAM settings
Lookup table showing sampled input ranges and requested and realized output voltages.
TransferFunction lookup table

3. Application Example: Humidity Sensor

The capacitive sensor used for this application is the HCH-1000 from Honeywell. The response of this sensor is shown in figure 6.

Honeywell HCH-1000 capacitance versus relative humidity for measurement frequencies from 10 to 100 kHz.
Figure 6: HCH-1000 capacitance versus humidity

The plot in figure 6 shows that the capacitance of the HCH-1000 is approximately 330pF +/-30pF. Using 10kΩ feedback resistors, the oscillator circuit of section 2.1 will oscillate at about 30kHz with this sensor. Since the capacitance of the HCH-1000 varies linearly with humidity then it is not necessary to add a transfer function CAM for linearization.

The plot in figure 4 shows that the output voltage of the circuit in section 2.2 will only vary by about 0.5V across the full range of humidity. It is possible to increase the output range by increasing the gains in the SumInv CAM, but this will not improve the resolution as this is determined by the integrator output. The ramp on the output of the integrator consists of discrete steps which determine the resolution of the frequency to voltage converter.

An alternative frequency to voltage converter is proposed for use with sensors where the capacitance varies over a narrow range. The full circuit is shown in figure 7.

Alternative converter combining xVCO, voltage-controlled hold, and low-pass filter CAMs.
Figure 7: Oscillator and alternative converter

The circuit in Figure 7 uses a custom voltage-controlled oscillator CAM called xVCO. At the time of the original note, this CAM was not available in the standard AnadigmDesigner2 library. Contact Okika Devices Support to confirm availability before implementing this circuit. The xVCO CAM outputs a periodic waveform, both a square wave and a ramp, whose frequency depends on the input control voltage. The original note describes its output frequency as varying continuously with input voltage, without quantization effects.

The xVCO CAM is combined with a voltage controlled Hold CAM and a low pass bilinear filter CAM to make a circuit which is similar to a phase locked loop. The output frequency of the xVCO locks onto the oscillator frequency and the control voltage is used as the output to make a frequency to voltage converter. The resolution of this circuit is much better than the previous version.

The centre frequency of the xVCO should be set to the oscillator frequency when the sensor is approximately mid-range, in this case 30kHz. The % variation should be greater than the maximum deviation of oscillator frequency i.e. it should encompass the full range of frequencies for humidity between 0 and 100%. The parameter settings for all 3 CAMs are shown below:

The original application package references the design file Capacitance Meas plus F2V v3.ad2.

Voltage-controlled oscillator settings with centre frequency 30 kHz and frequency variation ±10 percent.
xVCO CAM settings
Bilinear low-pass filter with corner frequency 2.2 kHz and gain 1.
Alternative converter low-pass filter settings
Voltage-controlled sample-and-hold settings for the xVCO-based converter.
Alternative converter hold settings

Companion files: The source document references three AD2 circuit files and linear transfer.csv. These files are not embedded in the document. Obtain the original design package before reproducing the examples. For assistance, contact Okika Devices Support.