Debugging the LilyPads

by ellann

The concept for this project was to use a microcontroller with two outputs and two inputs to create a fun little game. We have a frog that is trying to catch the LED lit dragonfly. Each time the tongue of the frog is moved (by the user) to touch the lily pad right in front of the LED lit dragonfly that LED turns off and the other LED turns on. It is fun little game we call “Debugging the LilyPads.”

How did we make this project? The details are laid out below.


Firstly,  inspiration for all the pattern pieces were collected. The images were then traced  in Adobe Illustator as a means of producing templates for laser cutting.


Every piece of felt (except the black background and the tongue) was cut out using a laser cutter. The lilypads turned out especially nicely; We were able to use the laser cutter at very low power and a high speed setting to produce etched lines as a means of describing leaf veins.


We sewed the various pieces together – first, off the base mat and then onto the base mat. This is one of the flowers done. It is three layers of different colors and diminishing size that are sewn together in the middle. The flower was then folded in half and the middle sewed again and then folded in half the other way and sewed again for the 3D effect.


Then, the various pieces were sewn to the mat – a flower example is shown above.


We also sewed a stuff frog. The dots on its back are also etched on. We cut to identical frog shapes, sewed them right sides together, and then flipped him inside and stuffed him. Here we are sewing him to the mat.


Here is a close up of one of the dragonflies with and LED on it’s back. We used tiny LEDs that have the positive and negative leads soldered to little beads which are used to attached the LED to the fabric.


The lilypads were special. Each of them had heat sensitive glue on the back and they were each ironed onto the mat. The two lilypads that were going to be part of our buttons/sensors were embroidered along the veins with conductive thread. The tongue was also embroidered along the underside.


The finished product looks like so.


All of the circuitry is done on the underside of the mat.


Everything attaches to the microprocessor.

Arduino Code:

// constants won’t change. They’re used here to
// set pin numbers:
const int buttonPin_LilyPad1 = 1; // Lily Pad 1′s button goes to pin 1
const int buttonPin_LilyPad2 = 2; // Lily Pad 2′s button goes to pin 1
const int ledPin_LilyPad1 = 3; // Lily Pad 1′s led goes to pin 3
const int ledPin_LilyPad2 = 4; // Lily Pad 2′s led goes to pin 4

// variables will change:
int buttonState_LilyPad1 = 0; // variable for reading the pushbutton status
int buttonState_LilyPad2 = 0; // variable for reading the pushbutton status
int lastButtonState_LilyPad1 = 0; // previous state of the button
int lastButtonState_LilyPad2 = 0; // previous state of the button

void setup() {
// initialize the LED pin as an output:
pinMode(ledPin_LilyPad1, OUTPUT);
pinMode(ledPin_LilyPad2, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin_LilyPad1, INPUT);
pinMode(buttonPin_LilyPad2, INPUT);

digitalWrite(buttonPin_LilyPad1, HIGH);
digitalWrite(buttonPin_LilyPad2, HIGH);
}

void loop(){
// read the state of the pushbutton value:
buttonState_LilyPad1 = digitalRead(buttonPin_LilyPad1);
buttonState_LilyPad2 = digitalRead(buttonPin_LilyPad2);

// compare the buttonState to its previous state
if (buttonState_LilyPad1 != lastButtonState_LilyPad1) {
// if the state has changed, change the lights
digitalWrite(ledPin_LilyPad1, LOW);
digitalWrite(ledPin_LilyPad2, HIGH);
}
else {
}
if (buttonState_LilyPad2 != lastButtonState_LilyPad2) {
// if the state has changed, change the lights
digitalWrite(ledPin_LilyPad1, HIGH);
digitalWrite(ledPin_LilyPad2, LOW);
}
else {
}

lastButtonState_LilyPad1 = buttonState_LilyPad1;
lastButtonState_LilyPad2 = buttonState_LilyPad2;
}