DIY Projects
Published © CC BY

Using TTP223B touch module and relay to control AC/DC load w

Hello Friends, In this video to how to make touch sensor with relay switch

BeginnerShowcase (no instructions)1 hour3,133
Using TTP223B touch module and relay to control AC/DC load w

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
TTP223 Touch Sensor
×1
AC Blub
×1
Relay module
×1
Solderless Breadboard Half Size
Solderless Breadboard Half Size
×1
Jumper wires (generic)
Jumper wires (generic)
×7

Story

Read more

Code

Arduino code

C/C++
#include <Arduino.h>
 
//#define ON 1
//#define OFF 0
 
/*
 * Pin Description
 */
int Touch_Sensor = A5;
int LED = 13;
int Relay = A4;
 
/*
 * Programme flow Description
 */
int condition = 0;
int state = 0; //To hold the switch state.
 
/*
 * Pin mode setup
 */
void setup() {
pinMode(Touch_Sensor, INPUT);
pinMode(LED, OUTPUT);
pinMode(Relay, OUTPUT);
}
 
void loop() {
condition = digitalRead(A5); // Reading digital data from the A5 Pin of the Arduino.
 
if(condition == 1){
delay(250); // de-bounce delay.
if(condition == 1){
state = ~state; // Changing the state of the switch.
digitalWrite(LED, state);
digitalWrite(Relay, state);
}
}
}

Credits

DIY Projects
11 projects • 21 followers
Student
Contact

Comments

Please log in or sign up to comment.