Touch Detector

Z2M Part: EMS-00014-A

Detect touch with capacitive touch sensor.

Circuit Diagram
Circuit diagram for Touch Detector
Wire Connections & Pin Configuration

Wire Color Connections:

Yellow → Digital Pin 3 to Touch sensor OUT (code uses Pin 3)
Red → 5V to Touch sensor VCC
Black → GND to Touch sensor GND

Pin Configuration:

Arduino Digital Pin 2 → Touch sensor OUT
Arduino 5V → Touch sensor VCC
Arduino GND → Touch sensor GND
Arduino Code
Edit
int touch = 3; // Touch sensor connected to digital pin 3

void setup() {
  Serial.begin(9600);     // Initialize Serial Monitor
  pinMode(touch, INPUT);  // Set touch pin as input
}

void loop() {
  int touchval = digitalRead(touch); // Read value from touch sensor

  if (touchval == HIGH) {
    Serial.println(\"TOUCHED\");      // Print message when touched
  } else {
    Serial.println(\"not touched\");  // Print message when not touched
  }

  delay(500); // Wait for 0.5 seconds before reading again
}

Instruction Details

Wiring: Connect touch sensor VCC to 5V, GND to GND, OUT to Digital Pin 3.
Library: Not required (built-in).
Upload Code: Tools → Board → Arduino Uno. Tools → Port → select your COM port. Click Upload button.
View Output: Open Serial Monitor (Tools → Serial Monitor) at 9600 baud. "TOUCHED" or "not touched" displays. Touch metal pad to trigger.

How to Use

  1. Connect the required components as per the Pin Configuration above
  2. Open Arduino IDE and create a new sketch
  3. Copy and paste the code above
  4. Select your Arduino board and COM port from Tools menu
  5. Click the Upload button to upload the code to your Arduino
  6. Open Serial Monitor (if applicable) to see the output

Components Required

  • Arduino Uno
  • Touch Sensor Module
  • Breadboard
  • Jumper Wires

Category: Sensors