Skip to main content
Tutorials

Building a Capacitive Touch Slider

Overview

A capacitive touch slider detects finger position along a linear or rotary surface without moving parts. The design uses copper pads covered with solder mask — the solder mask acts as a thin dielectric layer, enabling capacitive coupling between the user's finger and the copper electrode underneath.

This tutorial walks through creating a 5-segment linear capacitive touch slider with diamond-shaped polygon pads.

How Capacitive Touch Works

  Finger (conductor)
──────────────────────
Solder mask (dielectric) ← coveredWithSolderMask={true}
══════════════════════
Copper pad (electrode)
──────────────────────
PCB substrate (FR4)

When a finger moves over the solder mask, it changes the capacitance of the pad underneath. A microcontroller reads each pad's capacitance and interpolates finger position.

Creating the Slider Footprint

The key building block is <smtpad shape="polygon" coveredWithSolderMask={true} />. The coveredWithSolderMask prop:

  • Sets is_covered_with_solder_mask: true in the circuit JSON
  • Prevents solder paste from being generated (no pcb_solder_paste elements)
  • The pad remains electrically connected but is physically covered by solder mask

Key Properties

PropertyDescription
shape="polygon"Defines an arbitrary polygon shape using points
pointsArray of { x, y } objects defining the polygon vertices (in mm)
coveredWithSolderMask={true}Covers the pad with solder mask (no solder paste generated)
portHintsConnects the pad to a named port on the chip

Using Solder Mask Margin

You can fine-tune the solder mask opening with solderMaskMargin. A negative margin means the solder mask extends inward (larger coverage), while a positive value creates a larger opening:

<smtpad
shape="rect"
width="4mm"
height="4mm"
portHints={["pad1"]}
coveredWithSolderMask={true}
solderMaskMargin={-0.1} // 0.1mm inset — mask extends slightly beyond pad
/>

Other Pad Shapes for Touch Sliders

Rectangular Pads

Simpler rectangular pads work well when pad-to-pad separation is less critical:

Circle Pads (Discrete Touch Buttons)

Round pads are great for discrete touch points or when aesthetics matter:

Connecting to a Microcontroller

Here's a complete example connecting a 4-segment touch slider to an RP2040 chip via capacitive touch-capable GPIO pins:

Circuit JSON Output

When rendered, each covered pad produces a pcb_smtpad element with is_covered_with_solder_mask: true:

{
"type": "pcb_smtpad",
"shape": "polygon",
"layer": "top",
"is_covered_with_solder_mask": true,
"points": [
{ "x": -6, "y": 2.5 },
{ "x": -4.8, "y": 0 },
{ "x": -6, "y": -2.5 },
{ "x": -7.2, "y": 0 }
]
}

Note: No pcb_solder_paste elements are generated for covered pads — this is correct since you don't want solder paste on touch sensor pads.

Summary

  • Use <smtpad shape="polygon" coveredWithSolderMask={true} /> for capacitive touch electrodes
  • The points array defines the electrode shape in mm (relative to footprint origin)
  • Diamond/rhombus shapes improve sensitivity and reduce inter-electrode crosstalk
  • Multiple pads in a linear arrangement form a slider; firmware reads capacitance per pad