Site icon Circuit Ideas for You

Arduino Touch Sensor Relay Circuit

Want to control appliances by touch? then this circuit makes it possible, as this Arduino Touch Sensor Relay Circuit uses Arduino and touch sensor.

The Arduino reads the touch signal and uses the relay as a toggle switch.

When we touch the sensor once, the relay turns ON and when we touch the sensor again, the relay turns OFF; also each touch changes the relays state.

ON becomes OFF and OFF becomes ON.

Furthermore, this project is useful for home automation where we can control light, fan or other load devices.

Arduino Code:

int touchPin = 2;
int relayPin = 8;

int lastTouchState = LOW;
int relayState = LOW;

void setup()
{
pinMode(touchPin, INPUT);
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, relayState);
}

void loop()
{
int touchState = digitalRead(touchPin);

if (touchState == HIGH && lastTouchState == LOW)
{
relayState = !relayState;
digitalWrite(relayPin, relayState);
delay(300);
}

lastTouchState = touchState;
}

Circuit Working:

Arduino Touch Sensor Relay Circuit Diagram

Parts List:

ComponentsQuantity
Arduino UNO1
Touch Sensor Module TTP2231
Relay Sensor Module1

The TTP223 touch sensor works like a switch, it detects finger touch and it gives digital output when output is HIGH or LOW.

Then Arduino reads this signal and it toggles the relay output and relay changes contact position and connected load turns ON or OFF; further, each touch changes the state.

How to Build:

To build a Arduino Touch Sensor Relay Circuit follow below steps for connections:

Conclusion:

To conclude, this is a simple Arduino Touch Sensor Relay Circuit which uses few components, easily available in market.

Arduino coding is easy and relay works as toggle switch and also this project is good for beginners and it is useful in real life automation.

Exit mobile version