Interfacing of Touch Sensor with Arduino Uno.
What is a Touch Sensor?
This device uses your body as part of the circuit. When you touch the sensor pad, the capacitance of the circuit is changed and is detected. That detected change in capacitance results in the output changing states.
Material Required:
Material Quantity
Arduino Uno 1
Touch Sensor 1
Jumper cables 4
Pinout Diagram:
Pin of Touch sensor:
1. GND.
2. VCC.
3. SIG
Circuit Diagram:
Connect the Touch Sensor with Arduino as follows:
GND pin of Touch sensor to GND of Arduino
VCC pin of Touch Sensor to 5V of Arduino
SIG pin of Touch Sensor to digital pin 2 of Arduino.
Tested Programming Code:
#define ctsPin 2
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);
}
Precautions:
Double check the connections before powering on the circuit.
Don’t use loose jumper cables.
Check whether proper board is selected from Arduino IDE.
Ensure proper placement of Touch Sensor for correct working.
Conclusion:
Once your sketch is running, you have to see the Touch Sensor working by seeing the Serial monitor whenever it is being touched.