EE3901/EE5901 Sensor Technologies
Week 8 Notes
Design of capacitive sensors with arbitrary geometries

Profile picture
College of Science and Engineering, James Cook University
Last updated: 21 March 2023

This week we learn how to use computer software to calculate the capacitance of arbitrary structures. This allows you to explore the sensitivity of various capacitive sensor designs, for example, as the sensor experiences changes in geometry or permittivity.

Introduction

If a capacitor has plane-parallel geometry, then the capacitance is given by the well-known formula C=ϵA/dC = \epsilon A/d, where ϵ=ϵrϵ0\epsilon = \epsilon_r \epsilon_0 is the permittivity of the material in between the electrodes, AA is the surface area of their overlap, and dd is the separation distance.

However, what if the system does not have this geometry? There are a few special geometries where exact solutions are known, but in general, there is no formula sheet for the capacitance of any arbitrary shape. If there is no simple formula, then we must turn to computer software to calculate capacitance. This week, we will learn how to calculate capacitance for any geometry that you can draw in a CAD package. We will do this using the finite element solver in Matlab’s PDE toolbox.

The meaning of capacitance

The meaning of capacitance can be understood through the formula

Q=CV,\begin{equation} Q = CV, \end{equation}

where QQ is the stored charge, CC is the capacitance, and VV is the potential difference between the conductors.

Equation (1) will be our recipe for calculating capacitance. We will set up a computer simulation with a given voltage VV applied to some geometry of conductors. Then, we will use the computer to find the charge QQ. Knowing both of these quantities, we can easily find the capacitance CC.

Recap of electrostatics

Electricity and magnetism are described by Maxwell’s equations. However, for the purposes of analysing capacitors, we will simplify Maxwell’s equations by applying the electrostatics approximation. We will also assume that there is no free charge outside of any conductor.

With these approximations, the key physics is Gauss’s law,

D=0,\begin{equation} \nabla \cdot \boldsymbol{D} = 0, \end{equation}

where D\boldsymbol{D} is called the electric displacement, and the 0 on the RHS indicates that there is no free charge.

However, for numeric calculations, it is convenient to calculate the electric potential (aka voltage) at every point, instead of the electric displacement. This is because the potential is a scalar value. The relevant equations are

D=ϵEE=U,\begin{align} \boldsymbol{D} & =\epsilon\boldsymbol{E}\\ \boldsymbol{E} & =-\nabla U, \end{align}

where E\boldsymbol{E} is the electric field, and UU is the electric potential. Substituting into Eq. (2), we obtain

(ϵU)=0.\begin{equation} \nabla \cdot (\epsilon \nabla U) = 0. \end{equation}

Capacitors are created when there are two or more conductors. We will assume that the conductors are ideal. This means that the potential is the same everywhere within the conductor. (In the language of circuit theory, the entire conductor is a single node.)

Therefore, the important and interesting physics is what happens in the region outside the conductors. Our problem formulation will look like Figure 1. This is a 2D slice through a general 3D geometry. In this example figure, there are two rectangular conductors shown in white. These should be viewed as extending into the page to create the overall 3D structure.

Figure 1: The calculation domain for an electrostatics capacitor problem. The region in grey is the domain in which we need to calculate the electric potential. Black borders indicate the edges of this domain. At every edge, we will specify a boundary condition in the form of a voltage. Zoom:

We will solve for the potential in the region between and around the conductors. To set up the problem, we must specify:

  1. The voltage at every edge, and
  2. The permittivity at every point within the domain.

From this, we can numerically solve Eq. (5) to obtain the electric potential.

There is one final piece of electrostatics theory that we will need. Gauss’s law can be converted into the so-called “integral form”, which reads:

SDdS=Qenc,\begin{equation} \oint_{S}\boldsymbol{D}\cdot d\boldsymbol{S}=Q_{enc}, \end{equation}

where the integration is around a closed contour SS, and QencQ_{enc} is the charge located within the contour. We will numerically integrate around the contour, for example, using the trapezoidal rule. From this, we obtain the amount of charge on each conductor. Knowing the amount of charge and the voltage, we can then find the capacitance.

The case of more than two conductors

Some capacitive sensor designs will need electrodes to act as shields. (You may recall the concept of guard electrodes from last week.) Therefore, we need to define a capacitance matrix, as a way to describe the capacitive effects between systems of conductors.

Firstly, let’s consider just one conductor. Even a single, isolated conductor has capacitance. Suppose that you place some electric charge on this isolated conductor; then the charge will induce an electric field in its vicinity. These electric field lines must terminate somewhere. By convention, we define self-capacitance as the capacitance between the object and a conducting sphere at infinite distance.

Figure 2: Capacitive interactions between 3 conductors. Each conductor has a self-capacitance Cm,iiC_{m,ii} which is defined to be the capacitance between that object and a conductor at infinity. Mutual capacitances between conductors are denoted Cm,ijC_{m,ij}. The diagram shows multiple parallel capacitive connections, which can be analysed using standard circuit theory. Zoom:

Now, suppose that there are multiple conductors in the system. As shown in Figure 2, there will be interactions between all pairwise combinations of conductors. These are called mutual capacitances. We can express the mutual capacitances in a matrix as follows:

Cm=[Cm,11Cm,12Cm,1NCm,21Cm,22Cm,2NCm,N1Cm,N2Cm,NN],\begin{equation} C_{m}=\left[\begin{array}{cccc} C_{m,11} & C_{m,12} & \cdots & C_{m,1N}\\ C_{m,21} & C_{m,22} & \cdots & C_{m,2N}\\ \vdots & \vdots & \ddots & \vdots\\ C_{m,N1} & C_{m,N2} & \cdots & C_{m,NN} \end{array}\right], \end{equation}

where NN is the number of conductors. The diagonal entries are the self-capacitances, and the off-diagonal elements are the mutual capacitances. Notice that mutual capacitances are symmetric: Cm,ij=Cm,jiC_{m,ij} = C_{m,ji}.

The Maxwell capacitance matrix

Let’s analyse the 3-conductor system of Figure 2 more closely. The charge on conductor 1, given a certain arrangement of voltages, can be obtained by summing up the contributions due to each capacitor shown in the figure:

Q1=Cm,11V1+Cm,12(V1V2)+Cm,13(V1V3).\begin{equation} Q_{1}=C_{m,11}V_{1}+C_{m,12}\left(V_{1}-V_{2}\right)+C_{m,13}(V_{1}-V_{3}). \end{equation}

However, Equation (8) is not very convenient to use because the expressions involve differences between voltages. It would be nicer to treat all voltage terms as being defined with respect to a common ground reference, just like we normally do in circuit theory. We would prefer an equation of the form:

Q1=C11V1+C12V2+C13V3.\begin{equation} Q_{1}=C_{11}V_{1}+C_{12}V_{2}+C_{13}V_{3}. \end{equation}

If we expand the brackets in Eq. (8) and equate coefficients to those in Eq. (9), we find

C11=Cm,11+Cm,12+Cm,13C12=Cm,12C13=Cm,13.\begin{align*} C_{11} & =C_{m,11}+C_{m,12}+C_{m,13}\\ C_{12} & =-C_{m,12}\\ C_{13} & =-C_{m,13}. \end{align*}

In general we have

Cii=k=1NCm,ikCij=Cm,ij.\begin{align} C_{ii} & =\sum_{k=1}^{N}C_{m,ik}\\ C_{ij} & =-C_{m,ij}. \end{align}

This leads us to define the Maxwell capacitance matrix as follows:

(Q1Q2QN)=[C11C12C1NC21C22C2NCN1CN2CNN](V1V2VN)=[k=1NCm,1kCm,12Cm,1NCm,21k=1NCm,2kCm,2NCm,N1Cm,N2k=1NCm,Nk](V1V2VN).\begin{align} \left(\begin{array}{c} Q_{1}\\ Q_{2}\\ \vdots\\ Q_{N} \end{array}\right) & =\left[\begin{array}{cccc} C_{11} & C_{12} & \cdots & C_{1N}\\ C_{21} & C_{22} & \cdots & C_{2N}\\ \vdots & \vdots & \ddots & \vdots\\ C_{N1} & C_{N2} & \cdots & C_{NN} \end{array}\right]\left(\begin{array}{c} V_{1}\\ V_{2}\\ \vdots\\ V_{N} \end{array}\right)\\ & =\left[\begin{array}{cccc} \sum_{k=1}^{N}C_{m,1k} & -C_{m,12} & \cdots & -C_{m,1N}\\ -C_{m,21} & \sum_{k=1}^{N}C_{m,2k} & \cdots & -C_{m,2N}\\ \vdots & \vdots & \ddots & \vdots\\ -C_{m,N1} & -C_{m,N2} & \cdots & \sum_{k=1}^{N}C_{m,Nk} \end{array}\right]\left(\begin{array}{c} V_{1}\\ V_{2}\\ \vdots\\ V_{N} \end{array}\right). \end{align}

Notice that the off-diagonal terms in the Maxwell capacitance matrix are negative. The physical meaning of the negative sign is that a positive voltage on one conductor induces a negative charge on another capacitor.

Given some entries in the Maxwell capacitance matrix, we can find the mutual capacitances by inverting Eqs. (5) and (6) to obtain

Cm,ii=Ciik=1kiNCm,ikCm,ij=Cij.\begin{align} C_{m,ii} & =C_{ii}-\sum_{\substack{k=1\\ k\neq i } }^{N}C_{m,ik}\\ C_{m,ij} & =-C_{ij}. \end{align}

Overall, we can see that there are two ways to define a “capacitance matrix” for a multi-conductor system. The matrix of mutual capacitances has the advantage that the network can be analysed via circuit theory to find the parallel combination of capacitors between any two conductors. Conversely, the Maxwell capacitance matrix has the advantage that it is easy to calculate. We will describe the process to calculate the Maxwell capacitance matrix next.

How to calculate capacitance

Consider once more the 3 capacitor system of Figure 2. Suppose that we apply a voltage to conductor 1, and we ground all the other conductors. Therefore, substituting V2=0V_2 = 0 and V3=0V_3 = 0 into Eq. (12), we find

(Q1Q2Q3)=[C11C12C13C21C22C23C31C32C33](V100),\begin{align*} \left(\begin{array}{c} Q_{1}\\ Q_{2}\\ Q_{3} \end{array}\right) & =\left[\begin{array}{ccc} C_{11} & C_{12} & C_{13}\\ C_{21} & C_{22} & C_{23}\\ C_{31} & C_{32} & C_{33} \end{array}\right]\left(\begin{array}{c} V_{1}\\ 0\\ 0 \end{array}\right), \end{align*}

which leads to simple expressions for the first column of the Maxwell capacitance matrix:

Q1=C11V1Q2=C21V1Q3=C31V1.\begin{align*} Q_{1} & =C_{11}V_{1}\\ Q_{2} & =C_{21}V_{1}\\ Q_{3} & =C_{31}V_{1}. \end{align*}

Next, we apply a voltage to conductor 2 and ground all the other conductors, to calculate the second column of the Maxwell capacitance matrix. Continuing in this way, we obtain the full description of all capacitive interactions in the system.

Practical example

Below is an example of analysing a real example using Matlab’s PDE Toolbox.

Defining the geometry

Firstly, you must draw the geometry that you wish to calculate. The geometry must cover the region surrounding the conductors with a sufficiently large “air gap” around the outside. Typically the easiest way to do this is to define a large rectangle, then draw features within this region. The features you draw will be either conductors or regions of differing permittivity. An example is shown in Figure 3.

Figure 3: Example of drawing a capacitive sensor in the Fusion 360 CAD software. Dimensions are specified in mm. There are two thin electrodes (0.1mm x 24.95mm) separated from each other by 0.1mm. There is a region of higher permittivity located near the electrodes. The inset shows a zoomed in section at the centre of the drawing. Zoom:

The Matlab PDE toolbox requires geometries specified in the STL file format. For 2D problems, such as this, the STL file must have all its geometry lying with a plane. This means that you cannot extrude your sketch into a 3D shape, because the result will be a 3D geometry that will be treated by Matlab as a 3D problem.

To generate a planar geometry in Fusion 360, select the “Surface” toolbar and click “Patch” (as shown in Figure 4).

Figure 4: The location of the Patch tool. Zoom:

Next, click on the air gap part of the sketch to create the patch. There will be holes in the patch where the electrodes and other features are defined. You can then export this patch to an STL file by right clicking on it in the browser and selecting the Save As Mesh option (Figure 5).

Figure 5: Generate the STL file by using the Save As Mesh feature. Zoom:

You should export the STL in binary format using metres as the dimension (Figure 6), since if you specify geometry in SI units then you avoid having to perform unit conversions later.

Figure 6: Selecting meters as the dimension means no further scaling is necessary once you load the geometry into Matlab. Zoom:

You may download this example geometry as:

Loading the geometry into Matlab

The STL file is loaded and displayed as follows.

%% Load geometry and show the edges
geometry = importGeometry('geometry.stl');

figure();
pdegplot(geometry,'EdgeLabels','on');
xlabel('X distance (m)');
ylabel('Y distance (m)');
Figure 7: The geometry with the edges labelled. In this case, you would need to use the zoom controls in the Matlab figure window to identify the labels that appear to overlap. Zoom:

By zooming in on the figure in Matlab, you can identify which edges correspond to which features.

% specify the edge IDs
outside_edges = [2 4 11 13];
dielectric_edges = [7 10 15 14];
electrode1_edges = [4 1 8 6];
electrode2_edges = [9 12 5 16];

This geometry currently has three “holes” in it. There is a hole where we intend to place the dielectric, and a hole for each of the electrodes. The dielectric must be “filled in” so that the electric potential will be calculated in this region. This can be done using the addFace function:

% fill in the dielectric region
geometry = addFace(geometry, dielectric_edges);
% leave the conductors as holes in the geometry

% show the faces 
pdegplot(geometry,'FaceLabels','on');

Notice that the electrodes are left as holes. This is important. The Matlab PDE toolbox can only specify voltage boundary conditions at the edges of the domain. Therefore, every conductor must be treated as a gap within the domain. If you accidentally use addFace to fill in a conductor, then the voltage specified there will be completely ignored.

Preparing the mesh

The finite element solver uses triangular meshes to represent the geometry. You need smaller meshes near the electrodes (to capture the rapid variation in voltage in this region). This can be achieved using the HEdge parameter when calling generateMesh.

%% create the model and look at the mesh
emagmodel = createpde('electromagnetic','electrostatic');
emagmodel.Geometry = geometry;

generateMesh(emagmodel, "HEdge", {[electrode1_edges electrode2_edges], 1e-5}); 
figure();
pdeplot(emagmodel);
Figure 8: The mesh geometry generated using the code above. Zoom:

You must have the mesh covering all the dielectric regions, and there must be a hole in the mesh for each conductor.

Setting material properties and boundary conditions

%% Set material properties
emagmodel.VacuumPermittivity = 8.8541878128E-12;
electromagneticProperties(emagmodel, "Face", 1, "RelativePermittivity", 1);
electromagneticProperties(emagmodel, "Face", 2, "RelativePermittivity", 15);

%% Set conductor 1 to 1V and others to 0, and find the charge on each conductor
electromagneticBC(emagmodel, "Voltage", 1, "Edge", electrode1_edges);
electromagneticBC(emagmodel, "Voltage", 0, "Edge", electrode2_edges);
electromagneticBC(emagmodel, "Voltage", 0, "Edge", outside_edges);

% Solve
R = solve(emagmodel); 

% Plot electric potential
figure()
pdeplot(emagmodel,'XYData',R.ElectricPotential);
xlabel('X distance (m)');
ylabel('Y distance (m)');
c=colorbar(gca());
c.Label.String = 'Electric potential (V)';
axis tight;
axis equal;
hold on;
pdegplot(geometry);
Figure 9: The electric potential computed using the above code. Notice how the region of higher potential extends further into the high dielectric material than it does into the air gap below the electrodes. Zoom:

Calculating capacitance

Recall that to calculate capacitance we need to know the charge on each conductor, and for that, we must perform a line integral around the conductor:

SDdS=Qenc.\oint_{S}\boldsymbol{D}\cdot d\boldsymbol{S}=Q_{enc}.

The attached code implements a function charge_on_conductor() that will perform this integral.

Given the solution above (where conductor 1 has a voltage of 1V, and all other conductors are grounded), the entries in the Maxwell capacitance are given by the code below.

C11 = charge_on_conductor(R, electrode1_edges)
C21 = charge_on_conductor(R, electrode2_edges)

% Calculate the mutual capacitance
Cm12 = -C12
Cm11 = C11 - Cm12

The results (for the values in the code above) are

Cm,11=11.15 pF/mCm,12=91.40 pF/m.\begin{align*} C_{m,11} & =11.15\ \text{pF/m}\\ C_{m,12} & =91.40\ \text{pF/m}. \end{align*}

Since this is a 2D problem, it represents a slice through a real 3D geometry. Therefore the units are farads per metre, i.e. the amount of capacitance per depth into the page.

We can interpret these capacitances by recalling the equivalent circuit of these self and mutual capacitances (Figure 10).

Figure 10: The meaning of the mutual capacitances for the 2 electrode system. Zoom:

A capacitance meter connected between the two electrodes would measure the parallel combination of capacitances, i.e.

Ctotal=Cm,12+11Cm,11+1Cm,22.C_{total} = C_{m,12} + \frac{1}{\frac{1}{C_{m,11}} + \frac{1}{C_{m,22}}}.

Complete code sample

Conclusion

We have developed a method to calculate the capacitance of arbitrary geometries. You can use this to design capacitive sensors. For example, if the underlying mechanism involves changes in permittivity, then you run the calculations with different values of permittivity and examine the resulting changes in capacitance. If your design involves changes in geometry, then you can draw multiple geometries and calculate the capacitance for each one. In this way, you can trial different design concepts and identify the one that will lead to the highest performing sensor.

You will apply this knowledge in Assignment 2 to design your own capacitive sensor.