Introduction: Arduino Touch Switch

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: Components Required

For this Project, you will need :

  • Arduino Uno
  • Piezoelectric Disc
  • Wires
  • LED

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.

  • Connect one wire to the any one of the analog port of the Arduino.
  • Connect a resistor from the Analog port to which the disc is connected to the Gnd pin.
  • Connect the other end of the disc to the 5V Pin on the Arduino.
  • Connect an LED across the Pin 13 and Gnd of the Arduino.

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

Step 4: Code

This is the code which 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.

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

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

Step 5: Ready...Set....Test !!

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 Folks !!! Stay Tuned For More !!!

Comments

About This Instructable

123views

8favorites

License:

Bio: My team has developed a new product. PLEASE CHECK IT OUT ON INDIEGOGO AND SHOW YOUR SUPPORT. CAMPAIGN LINK: https://igg.me/p/2165733/x ... More »
More by goks_lf:Ultrasonic Distance Measurement TapeGardening Temperature and Humidity LoggerDIY Kali Linux Bootable USB Drive
Add instructable to: