From 1ca9bb8133384ef46f2dae52272d70963c03a7fd Mon Sep 17 00:00:00 2001 From: Rahul Nailoo Date: Thu, 25 Sep 2025 10:01:41 +0530 Subject: [PATCH 1/3] Add capacitive touch sensor tutorial --- .../building-capacitive-touch-sensor.mdx | 166 ++++++++++++++++++ .../capacitive-touch-sensor.svg | 1 + 2 files changed, 167 insertions(+) create mode 100644 docs/tutorials/building-capacitive-touch-sensor.mdx create mode 100644 static/img/tutorials/capacitive-touch/capacitive-touch-sensor.svg diff --git a/docs/tutorials/building-capacitive-touch-sensor.mdx b/docs/tutorials/building-capacitive-touch-sensor.mdx new file mode 100644 index 0000000..275d6f3 --- /dev/null +++ b/docs/tutorials/building-capacitive-touch-sensor.mdx @@ -0,0 +1,166 @@ +--- +title: Building a Capacitive Touch Sensor with tscircuit +description: Learn how to design, route, and test a single-button capacitive touch sensor that uses polygon pads and a touch controller. +--- + +import TscircuitIframe from "@site/src/components/TscircuitIframe" + +## Overview + +Capacitive touch sensors replace mechanical buttons with copper shapes that detect when a finger changes their electric field. In this tutorial you will: + +- Draw a capacitive electrode using `polygon` surface-mount pads. +- Connect the electrode to a capacitive touch controller. +- Route the traces, ground reference, and LED indicator for feedback. +- Simulate the PCB stackup with `tscircuit` before ordering the board. + +The finished design exposes a responsive touch pad that lights an LED when it is activated. + +## Bill of Materials + +| Quantity | Component | Notes | +| --- | --- | --- | +| 1 | AT42QT1010 single-channel touch controller | Any capacitive-touch controller with a single key works. | +| 1 | 3.3 V regulator (or 5 V source if available) | Provides a clean supply for the controller. | +| 1 | 0603 LED + series resistor | Indicates when the sensor fires. | +| 1 | Polygon copper electrode | Created directly on the PCB. | +| Misc | Programming header, decoupling capacitors, optional guard ring | Follow the controller datasheet. | + +## Step 1 – Define the Electrode Footprint + +We can create a smooth, finger-sized electrode by combining polygon pads inside a reusable footprint. The code below mirrors the three overlapping electrodes used in the board preview image. + +```tsx +const PolygonSmtpads = (props: { name: string }) => { + return ( + + + + + + + + } + /> + ) +} +``` + +## Step 2 – Place the Board Elements + +Use the custom electrode on a board and add a dedicated touch controller. The snippet below lays out the electrode, an AT42QT1010 controller, and an LED with minimal routing. + + ( + + + + + + } + /> +) + +export default () => ( + + + + + + + + + + + + + + +) +`}/> + +## Step 3 – Route Guard and Reference Copper + +Capacitive sensors are sensitive to noise. Surround the electrode with a grounded copper pour on the bottom layer and keep the sensor trace short. If your controller supports it, add a driven shield trace between the sensor and noisy signals. + +## Step 4 – Tune the Sensor + +After fabricating the PCB: + +1. Power the circuit and measure the idle capacitance reported by the controller. +2. Adjust sensitivity or debounce registers until a light finger touch reliably toggles the LED. +3. Test with different enclosures or overlays (e.g., acrylic, wood). Increase electrode size if the overlay is thick. + +## Visualizing the Electrode Layout + +The board rendering below shows how the three polygon pads create a wide, tapered sensor that guides the user toward the center. + +![Capacitive touch polygon pads](../../static/img/tutorials/capacitive-touch/capacitive-touch-sensor.svg) + +## Next Steps + +- Add multiple electrodes by duplicating `PolygonSmtpads` and using a multi-channel controller. +- Experiment with interdigitated shapes for slider widgets. +- Integrate the sensor into a custom enclosure for touch-based user interfaces. diff --git a/static/img/tutorials/capacitive-touch/capacitive-touch-sensor.svg b/static/img/tutorials/capacitive-touch/capacitive-touch-sensor.svg new file mode 100644 index 0000000..7179136 --- /dev/null +++ b/static/img/tutorials/capacitive-touch/capacitive-touch-sensor.svg @@ -0,0 +1 @@ + From c901b9494b52ede5c8dac179b58f1183edd12425 Mon Sep 17 00:00:00 2001 From: nailoo Date: Thu, 25 Sep 2025 10:07:56 +0530 Subject: [PATCH 2/3] lint --- .../building-capacitive-touch-sensor.mdx | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/docs/tutorials/building-capacitive-touch-sensor.mdx b/docs/tutorials/building-capacitive-touch-sensor.mdx index 275d6f3..553910b 100644 --- a/docs/tutorials/building-capacitive-touch-sensor.mdx +++ b/docs/tutorials/building-capacitive-touch-sensor.mdx @@ -88,8 +88,7 @@ const PolygonSmtpads = (props: { name: string }) => { Use the custom electrode on a board and add a dedicated touch controller. The snippet below lays out the electrode, an AT42QT1010 controller, and an LED with minimal routing. ( ( export default () => ( - - - - - - - - - - - - + ) `}/> From ff7f7db2c647ad06cb5bf1548ff5a092a9f14259 Mon Sep 17 00:00:00 2001 From: nailoo Date: Thu, 25 Sep 2025 21:33:06 +0530 Subject: [PATCH 3/3] update --- .../building-capacitive-touch-sensor.mdx | 98 +------------------ 1 file changed, 1 insertion(+), 97 deletions(-) diff --git a/docs/tutorials/building-capacitive-touch-sensor.mdx b/docs/tutorials/building-capacitive-touch-sensor.mdx index 553910b..2ca51da 100644 --- a/docs/tutorials/building-capacitive-touch-sensor.mdx +++ b/docs/tutorials/building-capacitive-touch-sensor.mdx @@ -1,5 +1,5 @@ --- -title: Building a Capacitive Touch Sensor with tscircuit +title: Building a Capacitive Touch Sensor description: Learn how to design, route, and test a single-button capacitive touch sensor that uses polygon pads and a touch controller. --- @@ -16,80 +16,8 @@ Capacitive touch sensors replace mechanical buttons with copper shapes that dete The finished design exposes a responsive touch pad that lights an LED when it is activated. -## Bill of Materials - -| Quantity | Component | Notes | -| --- | --- | --- | -| 1 | AT42QT1010 single-channel touch controller | Any capacitive-touch controller with a single key works. | -| 1 | 3.3 V regulator (or 5 V source if available) | Provides a clean supply for the controller. | -| 1 | 0603 LED + series resistor | Indicates when the sensor fires. | -| 1 | Polygon copper electrode | Created directly on the PCB. | -| Misc | Programming header, decoupling capacitors, optional guard ring | Follow the controller datasheet. | - -## Step 1 – Define the Electrode Footprint - -We can create a smooth, finger-sized electrode by combining polygon pads inside a reusable footprint. The code below mirrors the three overlapping electrodes used in the board preview image. - -```tsx -const PolygonSmtpads = (props: { name: string }) => { - return ( - - - - - - - - } - /> - ) -} -``` - -## Step 2 – Place the Board Elements - -Use the custom electrode on a board and add a dedicated touch controller. The snippet below lays out the electrode, an AT42QT1010 controller, and an LED with minimal routing. - ( ( ) `}/> - -## Step 3 – Route Guard and Reference Copper - -Capacitive sensors are sensitive to noise. Surround the electrode with a grounded copper pour on the bottom layer and keep the sensor trace short. If your controller supports it, add a driven shield trace between the sensor and noisy signals. - -## Step 4 – Tune the Sensor - -After fabricating the PCB: - -1. Power the circuit and measure the idle capacitance reported by the controller. -2. Adjust sensitivity or debounce registers until a light finger touch reliably toggles the LED. -3. Test with different enclosures or overlays (e.g., acrylic, wood). Increase electrode size if the overlay is thick. - -## Visualizing the Electrode Layout - -The board rendering below shows how the three polygon pads create a wide, tapered sensor that guides the user toward the center. - -![Capacitive touch polygon pads](../../static/img/tutorials/capacitive-touch/capacitive-touch-sensor.svg) - -## Next Steps - -- Add multiple electrodes by duplicating `PolygonSmtpads` and using a multi-channel controller. -- Experiment with interdigitated shapes for slider widgets. -- Integrate the sensor into a custom enclosure for touch-based user interfaces.