Introduction: How to Create Your Own Capacitive Touch Airplane With Electro Dough!

About: Technology Will Save Us is a haberdashery for making technology in everyday life. We design, manufacture and sell DIY technology Kits and run workshops to help people become makers and creators of technology, …

Getting Started

The goal of this Instructable is to turn your electro dough into a touch capacitive button with Arduino using the CapSense arduino library.

You will need:

Start Arduino Kit

Inside your Start Arduino Kit you will find:

Jumper Wires

8 x LED

1 x 1M resistor

Also, download CapSense Arduino Library http://playground.arduino.cc/Main/CapacitiveSenso...

Make some 'Electro Dough' - you can find the recipe on our website http://tinyurl.com/muy8uxf

Step 1:

Setting up: Once you download the CapSense library, unzip the file and put it into the Arduino > Libraries folder.

Open Arduino and you should see the library if you go to Sketch > Import Library. Click on the CapacitiveSensor library to import it into your sketch.

Step 2:

Mix up your electro dough and create your doughy scene. The electro dough recipe can be found here http://tinyurl.com/muy8uxf. We’ve used a plane and a landing strip for our scene and you will need both conductive and insulating dough to complete the look.

The electro dough works like the breadboard that came with your arduino but the dough has some resistance in it already so you wont need any resistors with your LED.

Step 3:

Connect your LED to arduino pins 5,6,7,8,9,10,11, and 12 (remember we don’t need resistors with the dough)

Your touch sensitive dough will be one solid shape so once you have your shape find your two longest jumper wires and place them in the dough. Connect one end to Pin 4 and your other end will need to run through a 1M resistor that came with your DIY Arduino Kit.

Step 4:

Start coding!

Open your Arduino Software and start a new sketch. The first thing we need to include is the CapSense Library. Go to Sketch > Import Library > CapacitiveSensor, this should add a line to the top of your sketch that says #include

Copy the following code into the sketch:

#include

#define NUM_OF_SAMPLES 1 #define CAP_THRESHOLD 20

int ledPins[] = { 5,6,7,8,9,10,11,12};

CapacitiveSensor cs_2_4 = CapacitiveSensor(2,4); // 1M resistor between pins 4 & 2, pin 2 is sensor pin, place in dough.

void setup() { for(int i = 0; i < 8; i++){ pinMode(ledPins[i],OUTPUT); } cs_2_4.set_CS_AutocaL_Millis(0xFFFFFFFF);

}

void loop(){ if(cs_2_4.capacitiveSensor(NUM_OF_SAMPLES) < CAP_THRESHOLD) { // check if the input is LOW //waits delayTime milliseconds }

else { int timer = 150; //the time (in milliseconds) to pause between LEDs //make smaller for quicker switching and larger for slower for (int ledPins = 5; ledPins < 13; ledPins++) { // turn the pin on: digitalWrite(ledPins, HIGH); delay(timer);

} // loop from the highest pin to the lowest: for (int ledPins = 12; ledPins >= 5; ledPins--) { // turn the pin off: digitalWrite(ledPins, LOW); delay(timer);

} } }

Upload your sketch and get playing! When you pick up the capacitive aeroplane your runway should light up to guide you in to land.

You can then begin to play with the pattern of LEDs and come up with your own capacitive touch scenario!