Controlling an LED using an Arduino Compatible TTP223B Capacitive Touch Sensor.



This project was developed with the intention of replacing the traditional button key. It can be used along with a microcontroller or an arduino. When a capacitive load (such as a human hand) is in close proximity to the sense-pad or touches it, the sensor detects the change in capacitance and activates the switch.

Code:
#define ctsPin 2  int ledPin = 13; 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(0.9);     }

Connections:
13 of Arduino - Positive terminal of LED
GND - Negative terminal of LED

Video:

Comments

Popular posts from this blog

Internet Of Things: Controlling an LED/Bulb using Facebook Messenger Chatbot via Chatfuel and MQTT!

Interfacing an LED, a buzzer and TTP223 Capacitive Touch Sensor with Arduino Uno

MQTT – A Practical Guide to IOT Protocol