Introduction: Arduino Based Touch Switch

About: Just a new guy

Hey, Guys.

This is my first Instructable, and I'm gonna kick it off with How to interface Touch Switch with Arduino. Arduino is an open source platform for DIY Electronics.

Touch switches are a basic form of upgrading your home to a better home. You can have multiple touch switches for different purposes or a single switch for multiple purposes. Also, touch switches are fun to experiment around with.

In this Instructable, I'll show you how to make an Arduino based touch switch which turns ON an LED with the tap or touch on the switch.

Step 1: You Need Things to Get Started

For this Project, you will need :

  1. Arduino Uno
  2. Piezoelectric Disc
  3. Connecting Wires
  4. LED
  5. Arduino UNO

Step 2: How It Works

Piezoelectric discs have the capacity to detect or generate vibrations. These are the same discs used inside a piezoelectric buzzer. Here in the case of the touch switch, we are programming the Arduino to turn ON and turn OFF an LED when the disc detects a vibration.

We can also program the Arduino to perform a different task when it detects multiple vibrations or taps. This way, a single switch can be used to operate multiple things.

Step 3: Connections

Solder two wires on the piezoelectric disc. These will act as ground and the signal pin.

  1. Connect one wire to any one of the analog port of the Arduino.
  2. Connect a resistor from the Analog port to which the disc is connected to the GND pin.
  3. Connect the other end of the disc to the 5V Pin on the Arduino.
  4. Connect an LED to the Pin 13 and GND of the Arduino.

With these connections, let's get into the coding part.

Step 4: CODE

Basically, the code reads the values from the piezoelectric sensor and changes the state of a variable to true or false. This variable is used to turn ON and OFF an LED across pin 13.

You can also download the code attached here and open it in Arduino IDE.

CODE:

boolean tap = false;
void setup() {<br>  Serial.begin(9600);
  pinMode(13,OUTPUT);
}
void loop() {

  int sensorValue = analogRead(A0);
  if(sensorValue > 10){
    tap = !tap;
    }
  digitalWrite(13,tap);
  delay(10);
}

Step 5: Arduino Setup

After you done with code. You need to choose the right board and COM port.

To know more about the setup and Arduino projects you can follow the link below.

"Arduino UNO projects"

After you complete your set-up

Save the code CTRL+S

Compile the code CTRL+R

Upload the code CTRL+U

Step 6: Ready..For..Testing

Now after uploading the code, when you tap the disc, the LED will turn ON. When you tap again, it'll turn OFF.

You can use the same concept to operate higher rated appliances, like a coffee maker. But for high voltage appliances, you'll need to use a relay circuit.

I'll show you how to make and use a relay circuit with the Arduino in another Instructable.

That's All Buddies!! I hope you liked my Instructable.

Makerspace Contest 2017

Participated in the
Makerspace Contest 2017