---
title: Capacitive sensors
heading: Measuring motion, touch and level as a change in capacitance
eyebrow: B3 · Lesson 12 · Capacitive sensors
xp: 40
---

::: hook
The accelerometer in a phone is a speck of silicon on springs between fixed plates. When the phone tilts, the speck shifts by nanometers, one capacitor grows and the other shrinks, and a circuit measures the difference, a few femtofarads. The touchscreen above it detects your finger the same way, as a few picofarads added to an electrode. Fuel gauges, humidity sensors and liquid-level probes all work on one principle: anything that changes a gap, an overlap or a dielectric changes a capacitance, and capacitance is easy to measure precisely.
:::

::: play
- A movable plate sits between two fixed plates, each gap $d$ = 2 µm at rest, with 1 mm² of area. Moving it by $x$ shrinks one gap and widens the other.
- The curves are the two capacitances. Each one alone is nonlinear in $x$, but the readout's ratio, $\frac{C_1 - C_2}{C_1 + C_2}$, is exactly $x/d$.
- How large is the difference for a 10 nm shift?
:::
:::

```sim plot
view: graph
x: x = -1500..1500 nm
y: C = 0..20 pF
slider: x0 = -1500..1500 step 10 = 10 nm
plot: 8.854e-12*1e-6/(2e-6 - x*1e-9)*1e12 | label: C₁ (gap shrinking)
plot: 8.854e-12*1e-6/(2e-6 + x*1e-9)*1e12 | label: C₂ (gap growing) | color: ch2
marker: x = x0 | label: shift
readout: C₁ − C₂, fF = 8.854e-12*1e-6*(1/(2e-6 - x0*1e-9) - 1/(2e-6 + x0*1e-9))*1e15 | digits: 4
readout: (C₁ − C₂)/(C₁ + C₂) = ((1/(2e-6 - x0*1e-9) - 1/(2e-6 + x0*1e-9))/(1/(2e-6 - x0*1e-9) + 1/(2e-6 + x0*1e-9))) | digits: 4
readout: x/d = x0*1e-9/2e-6 | digits: 4
```

::: predict
## A parallel-plate sensor has a 2 µm gap and 4.4 pF. Its gap shrinks by 10 nm. About how much does its capacitance change?

- [ ] 4.4 pF
- [ ] 2.2 pF
- [x] About 22 fF
- [ ] About 22 aF

::: reveal
About 22 fF. For small moves, $\frac{\Delta C}{C} = -\frac{\Delta d}{d}$: a 0.5% change in the gap makes a 0.5% change in capacitance, and 0.5% of 4.4 pF is 22 fF. Measuring femtofarads is routine for an on-chip circuit, which is why MEMS sensors can see nanometer motions.
:::
:::

::: nameit
## Three ways to change a capacitance

$C = \frac{\varepsilon A}{d}$ can change through any of its three factors:

| Change | Sensors |
|---|---|
| gap $d$ | accelerometers, pressure sensors, microphones |
| overlap area $A$ | rotary and linear position sensors, MEMS comb drives |
| permittivity ε | humidity sensors, liquid-level and fuel gauges, proximity and touch |

## Gap sensors

For small changes, $\frac{\Delta C}{C} \approx -\frac{\Delta d}{d}$: sensitivity grows as the gap shrinks, which is why MEMS gaps are micrometers.

A **differential** sensor puts a moving plate between two fixed ones: $C_1 = \frac{\varepsilon A}{d - x}$ and $C_2 = \frac{\varepsilon A}{d + x}$. Then

$$\frac{C_1 - C_2}{C_1 + C_2} = \frac{x}{d}$$

exactly linear, and immune to anything that scales both capacitors alike (temperature, the exact area, ε). For small $x$, $C_1 - C_2 \approx 2C_0\frac{x}{d}$.

## Dielectric sensors

Two plates partly dipped in a liquid of permittivity $\varepsilon_r$, to height $h$ out of $H$, form two capacitors side by side:

$$C = \frac{\varepsilon_0w}{d}\left(\varepsilon_rh + (H - h)\right)$$

linear in the level $h$.

## Touch

A touch electrode has some capacitance to ground; a finger, coupled through the cover glass, adds a few picofarads. The circuit measures it by timing a charge through a known resistor ($\tau = RC$) or from an oscillator's frequency ($f \propto 1/C$), and reports a touch when it rises past a threshold.
:::

::: example
## A MEMS accelerometer has 1 mm² plates and 2 µm gaps. Find the rest capacitance and the differential change for a 10 nm shift.

::: solution
1. **Rest capacitance.**
   $$\begin{aligned} C_0 &= \frac{8.85 \times 10^{-12} \times 10^{-6}}{2 \times 10^{-6}} \\ &= 4.43\ \text{pF} \end{aligned}$$
2. **Relative shift.** A 10 nm shift is
   $$\frac{x}{d} = 0.005$$
3. **Differential change.** Each side changes by about 22 fF, and the difference is
   $$2C_0\frac{x}{d} = 44\ \text{fF}$$
4. **Ratio.** The ratio
   $$\frac{C_1 - C_2}{C_1 + C_2} = 0.0050$$
   is the shift over the gap.

**Answer:** the rest capacitance is 4.43 pF, and a 10 nm shift makes a differential change of 44 fF.
:::
:::

::: example
## A touch electrode has 10 pF to ground and is timed through 1 MΩ. A finger adds 5 pF. How does the time constant change?

::: solution
1. **Without the finger.**
   $$\begin{aligned} \tau &= RC \\ &= 10^6 \times 10^{-11} \\ &= 10\ \mu\text{s} \end{aligned}$$
2. **With the finger.** The 5 pF it adds makes τ = 15 µs.
3. **What the microcontroller sees.** Counting charge time with a fast clock, it sees a 50% jump, easy to tell from noise.

**Answer:** the time constant rises from 10 µs to 15 µs.
:::
:::

::: check
given: C = 2 | 10; d = 1 | 5; dd = 5 | 20
answer: C*1000*(dd/1000)/d
unit: fF
tolerance: 1%

## A {C} pF gap sensor has a {d} µm gap, which shrinks by {dd} nm. About how much does its capacitance grow?

::: right
Right. $\Delta C \approx C\frac{\Delta d}{d}$ = {answer}.
:::

::: misses
- [C*(dd/1000)/d] Convert pF to fF.
- [any] Not yet. $\frac{\Delta C}{C} \approx \frac{\Delta d}{d}$.
:::
:::

::: check
given: x = 10 | 50; d = 1 | 2
answer: x/1000/d
tolerance: 0.5%

## A differential capacitive sensor has {d} µm gaps, and its middle plate shifts by {x} nm. What is $\frac{C_1 - C_2}{C_1 + C_2}$?

::: right
Right. Exactly $x/d$ = {answer}.
:::

::: misses
- [2*x/1000/d] The ratio is $x/d$; it's the difference alone that's about $2C_0x/d$.
- [any] Not yet. Write out both capacitances and simplify.
:::
:::

::: check
given: A = 0.5 | 2; d = 1.5 | 3; x = 100 | 300
answer: 8.854e-12*A*1e-6/((d - x/1000)*1e-6)*1e12
unit: pF
tolerance: 0.5%

## A differential sensor has {A} mm² plates with {d} µm gaps. Its middle plate moves {x} nm toward one side. What is the capacitance on that side?

::: right
Right. $\frac{\varepsilon_0A}{d - x}$ = {answer}.
:::

::: misses
- [8.854e-12*A*1e-6/((d + x/1000)*1e-6)*1e12] That's the other side, whose gap grew.
- [any] Not yet. The gap is now $d - x$.
:::
:::

::: check
given: C = 8 | 15; dC = 2 | 6; R = 0.5 | 2
answer: R*1e6*(C + dC)*1e-12*1e6
unit: µs
tolerance: 0.5%

## A touch electrode of {C} pF is timed through {R} MΩ. A finger adds {dC} pF. What is the new time constant?

::: right
Right. $R(C + \Delta C)$ = {answer}.
:::

::: misses
- [R*1e6*C*1e-12*1e6] That's without the finger.
- [any] Not yet. $\tau = RC$ with the finger's capacitance added.
:::
:::

::: check
given: w = 2 | 3; d = 3 | 5; H = 20 | 30; h = 5 | 15; er = 2 | 2.5
answer: 8.854e-12*(w/100)/(d/1000)*(er*h/100 + (H - h)/100)*1e12
unit: pF
tolerance: 0.5%

## A level gauge has plates {w} cm wide and {H} cm tall, {d} mm apart, dipped to {h} cm in a fuel with $\varepsilon_r$ = {er}. What is its capacitance?

::: right
Right. The wet and dry parts are in parallel: {answer}.
:::

::: misses
- [8.854e-12*(w/100)/(d/1000)*(er*H/100)*1e12] Only the wet part has the fuel's permittivity.
- [any] Not yet. $\frac{\varepsilon_0w}{d}\left(\varepsilon_rh + (H - h)\right)$.
:::
:::

::: check
given: f = 100 | 500; C = 10 | 20; dC = 1 | 3
answer: f*C/(C + dC)
unit: kHz
tolerance: 0.5%

## A sensing oscillator runs at {f} kHz with {C} pF, with frequency proportional to $1/C$. A touch adds {dC} pF. What frequency results?

::: right
Right. $f\frac{C}{C + \Delta C}$ = {answer}.
:::

::: misses
- [f*(C + dC)/C] More capacitance means a lower frequency.
- [any] Not yet. $f \propto 1/C$.
:::
:::

::: explain
## Why does a differential capacitive sensor measure displacement more reliably than a single capacitor?

::: model
A single gap capacitor's value depends on the plate area, the permittivity and the gap, so temperature or humidity changes, or manufacturing spread, all look like motion. And its response, $1/(d - x)$, isn't linear. With two capacitors that change in opposite directions, the ratio $\frac{C_1 - C_2}{C_1 + C_2}$ comes out exactly $x/d$: any factor common to both, like ε or $A$, cancels, and the curvature of each cancels the other's. What's left depends only on the displacement and the rest gap.
:::
:::

::: practice

::: check
given: A = 1 | 4; d = 2 | 10
answer: 8.854e-12*A*1e-6/(d*1e-6)*1e12
unit: pF
tolerance: 0.5%

## What is the capacitance of {A} mm² plates {d} µm apart in air?

::: misses
- [any] $\varepsilon_0A/d$.
:::
:::

::: check
given: C0 = 2 | 5; x = 20 | 50; d = 2 | 4
answer: 2*C0*1000*(x/1000)/d
unit: fF
tolerance: 1%

## A differential sensor has {C0} pF per side at rest and {d} µm gaps. About what is $C_1 - C_2$ for a {x} nm shift?

::: misses
- [C0*1000*(x/1000)/d] Both sides change, in opposite directions: $2C_0x/d$.
- [any] $2C_0\frac{x}{d}$.
:::
:::

::: check
given: k = 2..10 int
answer: k
tolerance: 0.5%

## A gap sensor's gap is made {k} times smaller (same area). By what factor does its sensitivity $|dC/dd|$ grow, relative to its capacitance?

::: misses
- [k^2] Relative sensitivity $\frac{1}{C}\left|\frac{dC}{dd}\right| = \frac{1}{d}$.
- [any] $1/d$ grows by {k}.
:::
:::
:::
