Arduino - TTP223B - CAPACITIVE TOUCH SENSOR SWITCH
Intro: Arduino - TTP223B - CAPACITIVE TOUCH SENSOR SWITCH
Hello world! Today i made a code for the ttp223b capacitive touch sensor. A sensor that i am testing for my webshop, and it does its job! So soon i will add it to my webshop at arduinosensors.nl. The code is really easy and can be used with normal buttons to. Follow the next step for the schematic, code & parts list.
STEP 1: Schematic Code & Parts List.
It is very easy, Just wire it up like the schematic and upload the code.
Parts list:
- Arduino uno, I used the RobotDyn Uno.
- KY-019 Relay
- TTP223B Capacitive touch sensor.
- Jumper wire set MM/FF/MF
- Lamp socket + power cable & light bulb (optional)
Good luck!
Follow me for more!
Check out my website arduinosensors.nl
6 Comments
VladA22 5 years ago
Madhukesh 6 years ago
Hello vandenbrande !!!!! i made it , thanks to you for the codes and schematic. Now am trying to make a 4 channel touch relay control. Can you help me with the code ?
MeorF1 7 years ago
can the touch sensor work by not installing relay ?
MarvM 7 years ago
Forgot to push reply button ;D
MarvM 7 years ago
Works without relay as well.
#define TouchSensor 10 // Pin for capactitive touch sensor
boolean currentState = LOW;
boolean lastState = LOW;
int counter = 0;
void setup() {
Serial.begin(9600);
pinMode(TouchSensor, INPUT);
}
void loop() {
currentState = digitalRead(TouchSensor);
if (currentState == HIGH && lastState == LOW){
counter++;
Serial.print("Button pressed: ");
Serial.print(counter);
Serial.print(" times!");
Serial.println("||");
//delay(1);
}
lastState = currentState;
}
vandenbrande 7 years ago
Follow me for more!