Week 8: On Painting with Input Devices

The assignment for this week was to measure something—add a sensor to a microcontroller board that I had designed and read it.

I reused my custom Week 6 ESP32-S3 board and turned it into an input device by using its copper pads as capacitive touch sensors.

Starting from the Week 6 Board

Week 6 XIAO ESP32S3 schematic
The XIAO ESP32S3 schematic showing the two capacitive pads connected to D9 and D10.

The pads TOUCH_PLAY and TOUCH_VOL are connected to pins D9 and D10 of the XIAO ESP32S3, which map to GPIO 8 (TOUCH8) and GPIO 9 (TOUCH9)—both capacitive-sensing capable pins.

Getting the Toolchain to Talk to the Board

The process began with cleaning and reinstalling the Arduino IDE, adding the ESP32 board support package from Espressif, and selecting the correct board configuration:

After initially using the wrong board definition (“ESP32 Family Device”), I reinstalled the correct Espressif Systems ESP32 core. That unlocked the missing “USB CDC On Boot” option and fixed the upload and Serial Monitor issues.

Selecting ESP32S3 Dev Module and correct port in Arduino
Proper board and port selection in the Arduino IDE.

First Contact: “Still alive…”

I verified communication with the board using a simple Serial “heartbeat” sketch:


void setup() {
  Serial.begin(115200);
  delay(1000);
  while (!Serial) { delay(10); }
  Serial.println("Hello Carlotta ✨ The ESP32S3 is alive!");
}

void loop() {
  Serial.println("Still alive...");
  delay(1000);
}
  

After enabling USB CDC on boot, the Serial Monitor displayed the message successfully.

Serial Monitor showing Still alive output
Serial Monitor confirming board–IDE communication.

Adding Capacitive Sensing

With serial communication working, I programmed the board to measure capacitance on the two copper pads. The first attempt using GPIO 4 and 5 failed—touchRead() returned 4194303 (2²²−1), meaning invalid pins.

After checking the schematic and Seeed’s pinout, I corrected the mapping:


// XIAO ESP32S3 touch pads
const int touchPlayPin = 8;   // D9 on XIAO, TOUCH8
const int touchVolPin  = 9;   // D10 on XIAO, TOUCH9

void setup() {
  Serial.begin(115200);
  delay(1000);
  while (!Serial) { delay(10); }
  Serial.println("Capacitive sensing on XIAO ESP32S3 🎨");
}

void loop() {
  int valPlay = touchRead(touchPlayPin);
  int valVol  = touchRead(touchVolPin);

  Serial.print("Play pad: ");
  Serial.print(valPlay);
  Serial.print("\tVolume pad: ");
  Serial.println(valVol);
  delay(200);
}
  
Capacitive sensing readings in Serial Monitor
Correct capacitive readings after remapping to GPIO 8 and 9. Touching a pad causes its value to drop.

When untouched, values sit around 70–90. When a finger touches a pad, the reading drops to around 30–40.

Capacitive Sensing Debugging Notes

What I Learned

Final working capacitive sensing setup
Final working setup with functional capacitive sensing on both pads.
ß