Introduction: Touch Sensor With Arduino

Hi guys in this instructables we will learn how to use touch Sensor withith Arduino and in that way we can provide touch inputs to arduino and that can be used For any kind of output. So using this touch sensor can provide the output which can be controlled by touch inputs.

Step 1: Things You Need

These are following things you need for this instructables :

Arduino uno

Touch sensor

Jumper wires

Breadboard

Step 2: Connections

Connect everything According to the shown schmatics and you'll fine.

Step 3: Code

Please copy the following code and upload it to your arduino Board :

// Henry's Bench
// Capacitive Touch Sensor Tutorial

// When Sig Output is high, touch sensor is being pressed

#define ctsPin 2

// Pin for capactitive touch sensor

int ledPin = 13;

// pin for the LED

void setup()

{

Serial.begin(9600);

pinMode(ledPin, OUTPUT);

pinMode(ctsPin, INPUT);

}

void loop()

{

int ctsValue = digitalRead(ctsPin);

if (ctsValue == HIGH)

{

digitalWrite(ledPin, HIGH);

Serial.println("TOUCHED");

}

else{

digitalWrite(ledPin,LOW);

Serial.println("not touched");

}

delay(500);

}

Step 4: Testing the Sensor

After connecting everything together and uploading the code to arduino whenever you will touch the touch sensor the LED on pin 13 will light up and on serial monitor you will get a message as "TOUCHED" and when you are not touching it you will get message "not touched". So have fun using touch Sensor in your arduino Project.