Introduction: Fabric Pond

When you touch the numbers, the flowers can blink and make patterns!

Step 1: Materials Needed

- 4ft of blue cotton fabric (for base of pond)  PRICE: $4 (Walmart)
- 4 pieces of green felt (for lily pads) and 4 pieces of assorted colors (for flowers) PRICE: 4 for $1 (Hobby Lobby)
- LilyPad Arduino and battery PRICE: $29.95 (Sparkfun.com)
- 4 different LEDs PRICE: package of 5 for $5 (Sparkfun.com)
- Spool of conductive thread PRICE: $39.95 (Sparkfun.com)
- (optional) Green embroidery thread
- Regular thread (preferably blue in color)
- Scissors
- Pencil
- Sewing pins
- Hot glue gun with glue sticks
- Iron-On (aka Wunder-Under paper) (Walmart)
- Iron
- Computer equipped with Arduino software (for programming)

Step 2: SKETCH

I wanted to create a soft, fabric frog pond that could be an interactive “playtime” for younger children. I wanted to use conductive properties in order to use lights and to make the pond as fun and exciting as possible. So I started with a sketch on how I wanted my pond to look like in the end.

This is important! Draw out where you want to put everything, including all the circuits. Nothing is worse than getting everything sewn together and it not working due to a shortage or other preventable problem. So sketch sketch sketch!

Step 3: CUT THE BASE

First you will need a base. This is a pond, so I choose a pretty blue/plain cotton material. I laid the fabric out on my floor and sketched with pencil, on the fabric, my intended shape. I chose to go with a “bean-shaped” pond. It seemed the most practical with everything I wanted. After drawing it out I brought out the scissors and started cutting!  I tried keeping as much of the original 4ft as possible, I feel like the more room to work with, the better.

Step 4: FELT FLOWERS

Now that the boring stuff was done, I got to begin the fun little details! I started with my felt flowers. Thank you Pinterest. I found a lovely little tutorial on how to create these gems here --> (http://www.positivelysplendid.com/2013/03/diy-felt-flower-tutorial.html)  The blog shows multiple felt flower options, I chose the easiest and went to town! I thought they turned out great and I thought it was really simple and fast to accomplish. I did all of my 4 flowers in 45min.

Step 5:

After the flowers were completed I started on my Lily pads. I made these out of felt also. I drew one, cut it and then used that as a guide for my other 3. I wanted them to look as similar as possible.  I did not follow an original pattern, just made it up as I went.

Next, I “numbered” my lily pads. I used plain old heavy-duty tin foil and Iron on (Wunder Under). Iron-on can be purchased at Walmart in the fabric department (and probably any other crafting store).  It’s really easy to use. With just these two materials and an iron, you can have iron-on aluminum foil! Which is a perfect conductive material for this project. I cut my foil in the shape of numbers and then ironed them onto each lily pad.  I liked the look of having my lily pad “nooks” facing different ways. So I just randomly ironed the foil on.

I used green embroidery thread to fasten the lily pads to my blue fabric.

Step 6: ATTACH LILY PAD ARDUINO

I used a small dot of glue from my hot glue gun in the middle of my Arduino Lily Pad to stick it in the spot that I thought was best - at the top, mostly in the center. The part of the lily pad that is permanently fastened to the fabric is the simpler looking one. It has the hole by each number- that is where the thread goes to connect to each number. The other half of the Arduino is the one that will later be programmed and snapped on top of this original. Follow the sketch we made earlier! Make sure the numbers that are lining the edges of the Arduino are in the correct places.

Step 7: SEW

Now we are at the point where everything matters and we need to really follow the sketch we created at the beginning. Using the conductive thread and a running stitch, I created a live image of my sketch with my pond. Be prepared to have to unpick and re-do something at some point. Don’t get discouraged that you made a mistake—I made plenty!!

Step 8: FELT BRIDGES

REMEMBER, conductive thread lines cannot cross or it will short the circuit! Because of how I chose to sew my pond, my lines had to cross at some point, so I came up with felt bridges.

To recap: Cut small rectangles out of felt, any color will do since they are on the BACK of the pond. Fold the rectangles in half and sew edges together so you have a little loop. Place the bridge over the threaded lines that you would like to cross. (I chose to do this under the felt flowers, that way no threads could be seen from above.) With non-conductive thread, sew the bottom half of the bridge over the threads that need to be passed. Then with the conductive thread, only sew on the top of the bridge! Once crossed, return to the blue fabric and connect the line where it needs to go! This was the simplest way I could think of to get over the threads that couldn’t be touched! This is kind of a delicate process, those conductive threads cannot touch or they will short each other.

Step 9: SOFTWARE

http://arduino.cc/en/Main/Software

use the link above to download the correct software on your computer.

Step 10: CODE

Once your computer is up to speed and has all of it’s software, copy and paste my code that I used for my project. If you are code-savvy, go ahead and create your own patterns for your LEDs. My project is pretty simple and straightforward. This does not mean that what I have is all it can do. With a little research, a lot of different things can be programmed onto your LilyPad Arduino. The possibilities really are endless.

MY CODE: 
int led1 = 5;
int led2 = 6;    // Which LED connects to what numbers on lilypad
int led3 = 10;
int led4 = 9;

int sensor1 = A5;
int sensor2 = A4;  // when conductive numbers are connected to what A's on lilypad
int sensor3 = A2;
int sensor4 = A3;

int sensorValue1;
int sensorValue2;
int sensorValue3;
int sensorValue4;

// the setup routine runs once when you press reset:
void setup() {
    pinMode(led1, OUTPUT);
     pinMode(led2, OUTPUT);
     pinMode(led3, OUTPUT);
      pinMode(led4, OUTPUT);
    pinMode(sensor1, INPUT);
    pinMode(sensor2, INPUT);
    pinMode(sensor3, INPUT);
    pinMode(sensor4, INPUT);
    Serial.begin(9600); // initialize the communication
}



// the loop routine runs over and over again forever:
void loop() {
    sensorValue1 = readCapacitivePin(sensor1); //read the touch sensor value
    Serial.println(sensorValue1); //send value to the computer
    delay(100); //delay for 1/10 of a second

    if (sensorValue1 > 1) // if the "1" is touched
       {
           digitalWrite(led1, HIGH);  // turns light on
       }else
       {
         digitalWrite (led1, LOW); // if not touched, turn off
       }



    sensorValue2 = readCapacitivePin(sensor2); //read the touch sensor value
    Serial.println(sensorValue2); //send value to the computer
    delay(100); //delay for 1/10 of a second

    if (sensorValue2 > 1) // if the "2" is touched
       {
           digitalWrite (led2, HIGH);
       }

       else
       {
         digitalWrite (led2,LOW);
       }

    sensorValue3 = readCapacitivePin(sensor3); //read the touch sensor value
    Serial.println(sensorValue3); //send value to the computer
    delay(100); //delay for 1/10 of a second

    if (sensorValue3 > 1) // if the "3" is touched
       {
          digitalWrite (led3, HIGH);
       }
    else
      {
        digitalWrite (led3, LOW);
      }

    sensorValue4 = readCapacitivePin(sensor4); //read the touch sensor value
    Serial.println(sensorValue4); //send value to the computer
    delay(100); //delay for 1/10 of a second

    if (sensorValue4 > 1) // if the "4" is touched
       {
           digitalWrite (led4, HIGH);
       }
    else
   {
      digitalWrite (led4, LOW);  
   }
}


// readCapacitivePin
//  Input: Arduino pin number
//  Output: A number, from 0 to 17 expressing
//  how much capacitance is on the pin
//  When you touch the pin, or whatever you have
//  attached to it, the number will get higher
//  #include "pins_arduino.h" // Arduino pre-1.0 needs this
uint8_t readCapacitivePin(int pinToMeasure) {
  // Variables used to translate from Arduino to AVR pin naming
  volatile uint8_t* port;
  volatile uint8_t* ddr;
  volatile uint8_t* pin;
  // Here we translate the input pin number from
  //  Arduino pin number to the AVR PORT, PIN, DDR,
  //  and which bit of those registers we care about.
  byte bitmask;
  port = portOutputRegister(digitalPinToPort(pinToMeasure));
  ddr = portModeRegister(digitalPinToPort(pinToMeasure));
  bitmask = digitalPinToBitMask(pinToMeasure);
  pin = portInputRegister(digitalPinToPort(pinToMeasure));
  // Discharge the pin first by setting it low and output
  *port &= ~(bitmask);
  *ddr  |= bitmask;
  delay(1);
  // Make the pin an input with the internal pull-up on
  *ddr &= ~(bitmask);
  *port |= bitmask;

  // Now see how long the pin to get pulled up. This manual unrolling of the loop
  // decreases the number of hardware cycles between each read of the pin,
  // thus increasing sensitivity.
  uint8_t cycles = 17;
       if (*pin & bitmask) { cycles =  0;}
  else if (*pin & bitmask) { cycles =  1;}
  else if (*pin & bitmask) { cycles =  2;}
  else if (*pin & bitmask) { cycles =  3;}
  else if (*pin & bitmask) { cycles =  4;}
  else if (*pin & bitmask) { cycles =  5;}
  else if (*pin & bitmask) { cycles =  6;}
  else if (*pin & bitmask) { cycles =  7;}
  else if (*pin & bitmask) { cycles =  8;}
  else if (*pin & bitmask) { cycles =  9;}
  else if (*pin & bitmask) { cycles = 10;}
  else if (*pin & bitmask) { cycles = 11;}
  else if (*pin & bitmask) { cycles = 12;}
  else if (*pin & bitmask) { cycles = 13;}
  else if (*pin & bitmask) { cycles = 14;}
  else if (*pin & bitmask) { cycles = 15;}
  else if (*pin & bitmask) { cycles = 16;}

  // Discharge the pin again by setting it low and output
  //  It's important to leave the pins low if you want to
  //  be able to touch more than 1 sensor at a time - if
  //  the sensor is left pulled high, when you touch
  //  two sensors, your body will transfer the charge between
  //  sensors.
  *port &= ~(bitmask);
  *ddr  |= bitmask;

  return cycles;
}

Step 11: HOW MINE WORKS

Mine is simple: When the one is touched, that LED turns on, when the two is touched, that LED turns on, ETC.

Once the code is just how you would like it, compile it and upload it onto your Lilypad Arduino. Make sure both ends of the lilypad are snapped together and turned on!

Now it should work!

Step 12: MISTAKES AND ADVICE

Watch for shortages. Before unpicking anything, check the back and make sure no loose ends are touching. This is usually an easy fix!

Lights won’t work or are dim: Check code and make sure all LEDs are set as an Output. It could also be that the Arduino battery needs to be charged more, simply hook the USB to computer.

 Mistakes are bound to happen! I definitely did not go through this entire process with ease. And I definitely had some  “scratching my head” moments! Sometimes all I needed to do was walk a way for a bit. Usually problems are simple fixes. However, other times it may mean that a lot of steps backward need to take place! This is not the best thing to realize, but it does happen!
 The best advice I have is to have patience and to be careful. Being in a hurry creates sloppy mistakes. Be aware of what you are doing so you don’t become a frustrated crafter... if that is at all possible!

Step 13: DONE

GOOD LUCK & HAVE FUN!