How to Use a Touch Sensor

How to Use a Touch Sensor © GPL3+

This guide will show you how to use a touch sensor.

  • 32,372 views
  • 3 comments
  • 12 respects

Components and supplies

About this project

Don't worry if you don't know how to use a touch sensor. It's easy!

Although you can make a touch sensor with Arduino, it's a lot easier to just have a ready-built one. This will also make the code and the circuit easier.

The circuit

Connect VCC Pin to 5V on Arduino.

Connect GND to Arduino's GND.

Connect OUT to D2 on Arduino and you're ready!

The code

Copy and paste this code to the Arduino IDE and upload it.

 void setup() {
 pinMode(2, INPUT);
 Serial.begin(9600);
}
void loop() {
 if (digitalRead(2) == HIGH)Serial.println("Sensor is touched");
 delay(500);
}

Then, open the Serial Monitor and set the baud rate to 9600. When you touch it, you will see a "Sensoristouched" message.

Code

TouchSensor.inoArduino
Upload this code:
void setup() {
  pinMode(2, INPUT);
  Serial.begin(9600);

}

void loop() {
  if (digitalRead(2) == HIGH);
  Serial.println("Sensor is touched");
  delay(500);

}

Schematics

Schematics
touch_mwkPX9Hr0n.fzz
Schematics
Touch aszd5vxmjb

Comments

Similar projects you might like

Touch Sensor and Sound Sensor Controlling AC/DC Lights

Project showcase by Anbumachi

  • 6,143 views
  • 2 comments
  • 8 respects

touch sensor

Project tutorial by tech guy

  • 31,118 views
  • 5 comments
  • 13 respects

Automatic Fan with PIR Sensor and LM35 Sensor

by Jamaluddin

  • 15,385 views
  • 6 comments
  • 20 respects

eNVIRO: 7" Touch Panel Weather Station with Remote Sensor

Project in progress by antiElectron

  • 8,139 views
  • 4 comments
  • 25 respects

Grove Starter Kit for Arduino: Touch sensor

by Grant

  • 1,905 views
  • 1 comment
  • 3 respects
Add projectSign up / Login