Introduction: Interactive Quilt

This project is a hanging, interactive quilt for my 8 year-old daughter.  Each section of the quilt requires her to do something to activate either the lights or the sounds.  

Materials Needed

For Quilt:

-5 colors for background
-Backing & binding (about 1 yard)
-fairy dress & wings (hair)

Matching thread

Crib size cotton batting

Iron-on interfacing

Iron-on adhesive

Curtain rod to hang

Electronics can be purchased at Sparkfun

For Flower Circuit:
-Conductive thread
-Conductive fabric 4”x4”
-8 LEDs
-Lily Tiny
-Battery Holder

For Star Circuit:
-Conductive Thread
-Aluminum Duct Tape
-Sound buzzer
-Arduino Lily Pad

For Butterflies Circuit:
-Sound Sensor Kit from Aniomagic includes: sound sensor, sparkle, battery holder & five LEDs
-Conductive thread
-Butterflies (I found these at the craft store.)
-Copper tape to reinforce connection

For Fairy Circuit:
-10 white LEDs
-Conductive thread
-Lily Twinkle
-Lily Twinkle
-Battery and battery holder

Step 1: Quilt Base

• Cut 30 6”x 6” squares of fabric in colors of your choice
• Sew squares into rows 
• Sew rows together

Step 2: Step 2: Appliques

• Iron-on adhesive interfacing onto the wrong side of the fabric you’re using for the flowers, leaves, clouds & fairy dress.  This helps prevent fraying around the edges of your fabric as you work with it.  Do not use interfacing on the centers of your flowers or you won’t be able to see the lights as well.
• Cut out flowers, centers, leaves, & clouds out of fabric of your choice.  (See templates)
• Layout your pattern and zigzag around each one with your sewing machine.

Step 3: Step 3: Stars

• Cut out various sizes of stars from aluminum duct tape (see templates)
• Arrange on quilt
• Peel off backing and stick to fabric

Step 4: Step 4: Backing and Binding the Quilt

• Layer batting and backing fabric
• Use a quilting hoop to secure the fabric layers and tack down each corner
• Trim the batting to about 1” around the edges
• Trim the backing fabric so that you can fold it over the batting and turn under the edge to make a clean edge on the front of your quilt.
• Pin to secure and zigzag around the edge of the quilt, folding the corners in and securing them.  That’s your binding. 

Step 5: Step 5: Fairy

• Cut a rectangle of dress fabric and gather the top edge to create a dress-like appearance. 
• Tuck the edges under and attach to quilt by zigzagging around the edges
• I layered white and sheer, glittery fabric for the wings.  Gather the middle to give it some dimension.  Zigzag the middle of the wings to secure them to the quilt. (The switch will sit in the middle of the wings, as pictured.)

Step 6: Step 6: Make the Pressure Sensor

• Cut one leaf out of fabric, one leaf (a little smaller) out of conductive fabric, and one leaf shaped piece of foam.
• With conductive thread, sew a vein pattern onto the fabric leaf.
• Using tweezers, rip small pieces of foam from the middle.
• Using iron on adhesive, secure the conductive fabric leaf to the quilt.
• Layer the foam and fabric leaf on top of the conductive fabric and zigzag around using your sewing machine.

Step 7: Step 7: Sewing the Flower Circuit

Interactivity:  Press the leaf and watch the center of the flowers twinkle.

Place one LED in the center of each flower.
Using conductive thread:
• Connect the positive side of the Lily Tiny to the positive side of the battery.
• Connect the negative side of the Lily Tiny to the negative side of the battery.
• Connect the negative side of the battery to the conductive thread on the pressure sensor (make sure it does not make contact with the fabric).
• Connect the conductive fabric (making sure it doesn’t touch the thread) to the negative side of the LEDs, which you can sew all together.  (When you press the sensor, the thread will touch the fabric and you will complete the negative line, therefore, completing the circuit.)
• Connect the positive side of each LED to a pin on the Lily Tiny.
Once the lights are working, sew centers on flowers.

Step 8: Step 8: Sewing the Stars Circuit

Interactivity:  Play the notes to “Twinkle Twinkle Little Star”

I programmed the stars on my quilt to play the notes to Twinkle Twinkle Little Star so that my daughter could learn to play it with her friends.  There are six notes in the song, so only six of the stars on the quilt are programmed.  The others are for decoration.

Using conductive thread:
• Connect the positive side of the sound buzzer to a numbered pin on the LilyPad.  I used 5.
• Connect the negative side of the sound buzzer to the negative pin on the LilyPad.
• Connect one point of each star to a numbered pin of the LilyPad.  I used 6, 9, 10, A2, A3 & A5.  I simply wrapped the thread around one corner of each star so I didn’t have to poke holes through the foil.  (pic)

• Program the Arduino.

Here's my CODE, which was remixed from code written by Kanjun Qiu: . 

//input the number of piano keys. Is it 5, 6, 7, 8?
const int numberOfKeys = 6;
//list the keys here in order that you want.
int keys[numberOfKeys] = { 6, 9, 10, A3, A2, A5 };
//list the tones of the keys here. Remember, the tone you list will be related
//to the key in the order you say (here key6 == 1046).
int notes[numberOfKeys] = {392, 349.23, 293.66, 440, 329.63, 261.63};
int speaker = 5;
int sensorValue;

void setup() {
  pinMode(speaker, OUTPUT);
  int i = 0;
  while (i < numberOfKeys)              //set the piano keys to be inputs
    pinMode(keys[i], INPUT);
    i = i+1;
  Serial.begin(9600);                       // initialize the communication

void loop() {
  int i = 0;
  while (i < numberOfKeys)
    checkPianoKey(keys[i], notes[i]);
    i = i+1;

void checkPianoKey(int key, int note) {
  sensorValue = readCapacitivePin(key);   //read touch sensor value
  Serial.print(sensorValue);              //send value to the computer
  Serial.print (" ");                     //send a space char to the computer
   if (sensorValue > 1)                   //if the key is pressed
    tone(speaker, note, 100);             //play a note for 100ms

// 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;
  // 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 9: Step 9: Sewing the Fairy Circuit

Interactivity:  Flip the switch and watch the wings twinkle

• Arrange LEDs in random pattern underneath the fairy wings

Using conductive thread:
• Connect the positive node of the Lily Twinkle to the positive side of the battery.
• Connect the negative node of the Lily Twinkle to one side of the switch.
• Connect the other side of the switch to the negative side of the battery.
• Attach the positive side of each LED to a node on the Lily Twinkle.
• Sew one continuous line around the negative side of each of the LEDs ending by connecting to the negative side of the battery.

• Once the circuit is done, tack the edges of the wings down by hand and add hair (doll hair can be found at Hobby Lobby).

Step 10: Step 10: Attaching the Butterflies

I found these butterflies at Hobby Lobby attached to picture frames.  (As an alternative, you could appliqué fabric butterflies to the quilt.) I removed the plastic crystal bodies and attached the wings to the quilt using clear thread.  I then attached one LED on each butterfly with conductive thread, and reattached the bodies with clear thread.

Step 11: Step 11: Sewing the Butterfly Circuit

Interactivity:  Blow on the sound sensor and watch the light patterns on the butterfly change.

Using the Anio sound sensor kit, I sewed the battery holder, sound sensor, sparkle according to the diagram provided with the kit.   

I then sewed all the LEDs in parallel.

Because the length of thread was so long, I used copper tape to increase the conductivity of the thread.
Using the Aniomagic website, program lights.

Step 12: Step 12: Hanging Tabs

Sew three strips of fabric and attach them to the top of the quilt to hang from curtain rod.

Step 13: Problems & Tips

1. With my limited understanding of switches, I tried to attach the switch in the middle of the circuit, which made the switch only activate half of the lights.  Make sure your switches are sewn directly off of the battery or Arduino.
2. I tried to attach too many lights to the Lily Tiny and ended up with only 5 of the 8 working how I intended.  If I were to do it again, I would do two separate circuits with pressure sensors and Lily Tinys.
3. I intentionally sewed all of the circuits on the back side of the quilt to maintain the design on the front, but it was very difficult to orient my circuit lines flipping the quilt from back to front over and over again.  Make sure you have very clear diagrams of your circuits before you begin sewing.
4. The Sparkle Sound Sensor Kit was not programmable when I received it, so up to this point, I haven’t been able to program the butterflies how I designed.  I will be returning the sparkle kit and trying again very soon.