Introduction: Touch Switch Using the Linkit One
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.
Step 1: Components
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
Step 2: Schematics
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.
Step 3: Program
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 pinvoid setup() { pinMode(ledPin, OUTPUT); // declare LED as output }
void loop(){ touchVal = analogRead(touchPin); if(touchVal < 5) { digitalWrite(ledPin, HIGH); } else { digitalWrite(ledPin, LOW); } }
Step 4: Testing
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.