Touch Switch Using the Linkit One

by ImGokul in Circuits > Microcontrollers

851 Views, 13 Favorites, 0 Comments

Touch Switch Using the Linkit One

IMG_20151216_174201.jpg
IMG_20151216_174210.jpg

In this instructables I'm going to show you how to create a touch switch using the Linkit One board. This is a capacitive touch and not a resistive touch, so you could use it for security purposes or design it just to turn on the lights when you touch a touch pad. In this project I will show you how to turn on the on board LED when the touch pad is touched.

Components

IMG_20151216_174316.jpg

Here is a list of all the components required to get started, make sure you collect all the components first before proceeding to other steps-

BC547 Transistor

3.3K Resistor

Wires

Bread Board

Schematics

IMG_20151216_174227.jpg
touch.PNG

The schematics can be found in the picture above, I had to use an arduino to represent the linkit one as Fritzing doesn't have a library for the Linkit one yet. The circuit uses two npn transistors, I used two BC547 transistors which work great with the Linkit One.

Program

IMG_20151216_174231.jpg

To upload the program you need to install the Linkit one plugin along with the arduino IDE. You can find instructions on how to do that in the official website. You can also download the IDE with the Linkit One plugin pre-installed from GitHub.

int ledPin = 13; // choose the pin for the LED
int touchPin = 2; // choose the input pin int touchVal = 0; // variable for reading the pin

void setup() { pinMode(ledPin, OUTPUT); // declare LED as output }

void loop(){ touchVal = analogRead(touchPin); if(touchVal < 5) { digitalWrite(ledPin, HIGH); } else { digitalWrite(ledPin, LOW); } }

Testing

IMG_20151216_174224.jpg

After uploading the code you can touch the plate (I used a metal lid of a box as the plate, but any metal object should work fine) and you should see the onboard LED light up, the on board LED is connected to digital pin 13 so you can also hook it up to a relay and turn your house lights ON and OFF.