Electronics notes/Capacitive sensing

From Helpful
Jump to: navigation, search
This is for beginners and very much by a beginner. It's meant to try to cover hobbyist needs, and as a starting point to find out which may be the relevant details for you, not for definitive information.

Some basics and reference: Volts, amps, energy, power · Ground · batteries · resistors · changing voltage · transistors · fuses · diodes · varistors · capacitors · inductors · transformers · baluns · amplifier notes · frequency generation · skin effect

And some more applied stuff:

IO: IO and wired communication · localish communication · wireless (ISM RF, GSM, RFID, more) · 802.11 (WiFi) · 802.15 (including zigbee)

Sensors: General sensor notes, voltage and current sensing · Knobs and dials · Pressure sensing · Temperature sensing · humidity sensing · Light sensing · Movement sensing · Capacitive sensing · Touch screen notes

Actuators: General actuator notes, circuit protection · Motors and servos · Solenoids

Some stuff I've messed with: Avrusb500v2 · GPS · Hilo GPRS · Bluetooth serial · JY-MCU · DMX · ESC/POS notes

Audio notes: basic audio hacks · microphones · amps and speakers · device voltage and impedance, audio and otherwise ·

Less sorted: Common terms, useful basics, soldering · Microcontroller and computer platforms · Arduino and AVR notes · ESP series notes · Electronics notes/Phase Locked Loop notes · mounts, chip carriers, packages, connectors · signal reflection · pulse modulation · electricity and humans · Unsorted stuff

See also Category:Electronics.

This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, fix, or tell me)

Intro and basic workings

This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, fix, or tell me)

Capactive sensing senses a change in effective capacitance of a circuit. Such as your finger on a metal plate. You locally add to that area's effective capacitance, basically by adding useful surface area for charge.

This change is often measures by how fast it charges/discharges, or how it resonates.

To deal with varying environments, this is typically compared compare with an earlier measurement.

Some setups work not on the local capacitive, but allow ground to play as well. It's the same idea, but because the circuit is much larger, this is more sensitive, and also much noisier, so this is often only useful to distinguish touch or no touch.

Some setups are designed to use the fact that the magnetic field fringes out. For example, capactive sensing of liquids in containers is often done with two plates with lots of fringing, (and possibly shielded from other directions), so that the largest different must be coming from change in dielectric in the setup, i.e. the liquid. If we assume/know the dielectric constants of liquid (and air) we can even make it a level gauge.

Some setups play with how much the static field can fringe out (which can combine interestingly with grounding, for better and/or worse), or intentionally make it fringe out in one direction, and create a basic motion sensor.

How local, how sensitive, how fast, and how directional are conflicting interests that make for varied designs depending on the exact purpose.


  • Fringing out by design often means coplanar antennae. Most other designs intentionally contain it.
  • Reliable measurement of capacitance change relies on
the change being on the same order as the circuit's basic capacitance
interference not being on the same order
This ends up a tradeoff between stability and sensitivity.
  • "Is there touch at all" is fairly simple to do. Fancier goals need fancier design.
  • A circuit will always have parasitic circuit capacitance on femtofarad-ish scale,
which is why one of the first things for basic stability is to add a capacitor of an order more than this.
  • The charge and discharge can be done via an AC signal (some sort of waveform), where
higher-frequency makes for lower electrode impedance and faster reaction time (e.g. used in servo-feedback mechanisms) and may help avoid certain coupling,
lower frequencies make for less noise but slower response.


Capacitive sensors can measure electric field, and dielectric fairly directly, motion and distance fairly easily, and indirectly anything else you can tie to them.

So indirectly it gets used for displacement, force, motion, pressure, fluid level, distance, thickness, even some basic material characteristics (...with assumptions made).

How well it applies depends a bit on scale.

In ICs you can have some very controlled designs (in part because the are so small, shieldable, and can do things on femtoFarad scale), and this can do some very precise motion and position sensing, as in micrometer scale.

At larger scale, you have less control over the environment's parasitic capacitance and interference.

Some can be controlled (automatic recalibration goes a long way), while some will always imply reduced precision.

There are some use cases where pragmatic details work for you. For example, detecting humans proximity at a meter is possible but hard to get reliable, while it turns out to be much easier than that to use huge electrodes to detect the speed of passing cars.

Varied designs

This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, fix, or tell me)

Precise measurements are typically constrained to precision-engineered cases in decently controlled environments, and containing any fringing, shielding EMI, and other interactions.

  • e.g. for precision positioning sensors, for thickness sensors, or density sensors
e.g. for assembly-line precision/quality checks, some machining applications

"Is there touch" designs (such as touch lamps, buttonless switches, keypads, sliders), will often only try to distinguish between 'at rest' and 'something else'. That is, threshold, rather than apply meaning to the actual values.

While this is probably the simplest variation to get to work stably, it still tends to have constant recalibration (to deal with changes parasitic capacitance of the environment, and in interference)

Variants on this design:

  • touch keypads have multiple probes, so that each only needs to decide there is touch or not
  • touch sliders, touch wheels, etc. add detection like "is the change in one inversely proportional to the other"

touchscreens are a further refinement, adding more precise localization.

Note that since these are biased for accuracy, they tend to specifically avoid being sensitive (as in larger-distance), meaning they usually require require fingers to be touching or at least very close (a glove is often already enough to not work).

There are a large number of refinements, mostly sortable into:

  • surface capacitance screens
one-touch localization:
Put a voltage on the corners of a metal area for a uniform electrostatic field. A closeby conductor creates capacitance between it and the plate.
Successive measurement from each corner can be used to localize.
Upsides: durable, and good enough for big-button interfaces like various kiosks, ATMs
Downsides: limited resolution, sensitive to interference, prone to parasitic capacitive coupling, needs good calibration
  • projected capacitance screens are etched, and the top layer is typically purely protective (unlike resistive touch). Projected is split into:
    • self capacitance screens, a.k.a. absolute capacitance, measures capacitance from single electrode to ground. There being a conductor nearby (such as a finger) alters the capacitance
      • multi-pad style (often 1-layer)
      • row-and-column style (2-layer), but multiple touches can be detected but not resolved.
essentially a small area in a larger ground plane. The field is a local parasitic capacitance between the two, and an interaction with external capacitance (such as a finger) is measurable.
The area needs to be smallish because the field is only significantly present at the edges(verify).
We need not care about the actual capacitance, mainly about changes.
    • mutual capacitance screens
holds a small charge between rows and columns -- effectively many individual capacitors. A closeby conductor steals charge.
controller scans all row-column combinations for the charge.
Resolved separately, so makes multitouch relatively simple.
Also less sensitive to EMI

Other cases:

  • use the measured capacitance (beyond a thresholded "is it different'), e.g. to sense how far a button is pressed, or how much of a sensor is being touched
This can work will decently in a few millimeters, and has roughly logarithmc response
  • capacitive fluid level sensing works with fixed sensors.
    • the basic design is in the liquid and effectively measures the difference in dielectric between the plates that changes, between air (no fluid) and whatever fluid
there are variations on the implementation
E.g. if you want to have no probe in the actual liquid, you would probably use parallel probes (and a shield) directly outside.
sensitive to parasitic capacitance (e.g. human). There are ways around that.
  • sense proximity
This relies on probes having largeish fringed fields, and the passerby having the same ground as the circuit (that last bit is not always easy to guarantee, which is one reason you don't see this design much outside of DIY
a few cm, a few dozen cm, depending on the tradeoff with stability

  • Swept Frequency Capacitive Sensing
essentially check the capacitive response at various frequencies (a capacitor is a resonator) and gives you a plot
which tells you a little more about the situation, in a raw-data sense, you'll need to feed these profiles to a learner

See also:

M Sato et al. (2012) "Touché: Enhancing Touch Interaction on Humans, Screens, Liquids, and Everyday Objects[1]

Design considerations

This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, fix, or tell me)

Direct effect on capacitance:

  • sensor area
  • sensor thickness (thinner can work better)
  • sensor separation (distance - e.g. plastic, paint, carpet, whatnot)
  • capacitance of the underlying electronics
  • capacitor you add to a probe (for predictability)

Effect on noise / accuracy / direction

  • parasitic capacitance
    • of objects very near to the capacitive field
    • due to shared earth
  • radio frequencies present the environment (EM interference)
  • environment humidity
  • environment temperature
  • capacitance of the underlying electronics
  • the sensitivity of the underlying electronics
  • an (active) shield can help direct the effect

A handful of those can chance over time and with location, so so constant recalibration is important to predictability. ("what values have I most seen recently" tends to work quite well for most purposes)

Note that

  • parasitic capacitance between (AC) power and chassis ground is unavoidable (comes from the transformer winding).
  • EMI filters (common to avoid interference entering digital ciruits) will add capacitance
also relates to ground loop hum and tingle (the hum intensity varying with effective capacitance(verify), though the current capacity is low for the tingle to hurt)


See also

And perhaps:

Arduino CapSense library

  • uses digital pins
  • auto-calibrating (in intervals)
  • you need one receive pin per sensor, and a resistor to tweak the sensitivity.
  • one send pin can be shared for multiple sensors

Keep in mind that calibration can be finicky - life may be simpler with ICs made for this.

See also: