0% found this document useful (0 votes)
49 views1 page

Arduino Code For TTP223

This Arduino code uses a TTP223 capacitive touch sensor module to turn an AC or DC load on and off by connecting or disconnecting the common and power pins of a relay. When the touch pad is touched, the light on the relay will turn on, connecting the pins and powering the load. The touch sensor output is read and if touched, the relay is turned off, disconnecting the load.

Uploaded by

AhmadSuhaimi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views1 page

Arduino Code For TTP223

This Arduino code uses a TTP223 capacitive touch sensor module to turn an AC or DC load on and off by connecting or disconnecting the common and power pins of a relay. When the touch pad is touched, the light on the relay will turn on, connecting the pins and powering the load. The touch sensor output is read and if touched, the relay is turned off, disconnecting the load.

Uploaded by

AhmadSuhaimi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

/*

* This is the Arduino code for TTP223 Capacitive Touch switch with relay to
turn AC or DC load
// December 13, 2017
// Written for Robojax.com video
// Using TTP223 Touch module to turn AC (or DC) load ON or OFF.
// When the touch pad is touched the ligh on the relay will on and the COM
and PO pin will be connected
* watch video for details https://youtu.be/YSI1PdSLbt0
*

*
* Written by Ahmad Nejrabi for Roboja Video
* Date: Dec 04, 2017, in Ajax, Ontario, Canada
* Permission granted to share this code given that this
* note is kept with the code.
* Disclaimer: this code is "AS IS" and for educational purpose only.
*
*/

// December 12, 2017


// Written for Robojax.com video
// Using TTP223 Touch module to turn AC (or DC) load ON or OFF.
// When the touch pad is touched the ligh on the relay will on and the COM
and PO pin will be connected

int touchPin = 2;// connect output from TTP223 to this


int val = 0;
int relayPin = 10;// Connected to relay

void setup() {
Serial.begin(9600);
pinMode(touchPin, INPUT);
pinMode(relayPin, OUTPUT);

void loop() {
digitalWrite(relayPin, HIGH);
val = digitalRead(touchPin);
if(val ==1){
Serial.println("Touched");
digitalWrite(relayPin, LOW);

}
delay(100);
Serial.println();
}

You might also like