LightUp Dress

The inspiration for this project comes from the many Disney films I’ve watched in the past. The main focus of this product is not the dress itself, but the idea of wearing a dress. When you wear a dress, you want it to feel elegant, pretty, and magical. Just as the princesses in Disney films feel as they transform with the dresses, the sparkles that fly out, the fireworks in the background…etc.

maxresdefault

The idea was that I would recreate this using LEDs and accelerometer embedded within the dress.

 

Parts

  • Lilypad
  • ADXL 335 (for lilypad)
  • LED string
  • Dress
  • Conductive Thread
  • Resistor

 

Process

I first tried to design and make a dress of my own but due to my lack of tailoring skills, I quickly gave up on my pile of fabric and went out and bought a dress.

SAM_1246 SAM_1247

SAM_1242 SAM_1243 SAM_1244 SAM_1245 SAM_1248 SAM_1251

Code

/*
LilyPad ADXL335 Dress

Dec 9th, 2014
Kenix Po
*/

//———-Variables———-
//
//—–Constants—–
const int xpin = A5; // x-axis
const int ypin = A3; // y-axis
const int zpin = A4; // z-axis
//
int dressThreshold = 100;
int dressPin = 5;
int dressLight = 0;
//———-[test]———-
//Smoothing
const int numReadings = 10;
//
int xreadings[numReadings];      // the readings from the analog input
int xindex = 0;                  // the index of the current reading
int xtotal = 0;                  // the running total
int xaverage = 0;                // the average
//
int yreadings[numReadings];      // the readings from the analog input
int yindex = 0;                  // the index of the current reading
int ytotal = 0;                  // the running total
int yaverage = 0;                // the average
//
int zreadings[numReadings];      // the readings from the analog input
int zindex = 0;                  // the index of the current reading
int ztotal = 0;                  // the running total
int zaverage = 0;                // the average

void setup(){
//
Serial.begin(9600);
//
//
pinMode(xpin, INPUT);
pinMode(ypin, INPUT);
pinMode(zpin, INPUT);
pinMode(dressPin, OUTPUT);
//
for (int thisReading = 0; thisReading < numReadings; thisReading++)
xreadings[thisReading] = 0;
//
for (int thisReading = 0; thisReading < numReadings; thisReading++)
yreadings[thisReading] = 0;
//
for (int thisReading = 0; thisReading < numReadings; thisReading++)
zreadings[thisReading] = 0;
}//setUp ends

void loop(){
//
//—–Readings[input]—–
//
// subtract the last reading:
xtotal= xtotal – xreadings[xindex];
// read from the sensor:
xreadings[xindex] = analogRead(xpin);
// add the reading to the total:
xtotal= xtotal + xreadings[xindex];
// advance to the next position in the array:
xindex = xindex + 1;

// if we’re at the end of the array…
if (xindex >= numReadings)
// …wrap around to the beginning:
xindex = 0;

// calculate the average:
xaverage = xtotal / numReadings;
//
delay(1);

// subtract the last reading:
ytotal= ytotal – yreadings[yindex];
// read from the sensor:
yreadings[yindex] = analogRead(ypin);
// add the reading to the total:
ytotal= ytotal + yreadings[yindex];
// advance to the next position in the array:
yindex = yindex + 1;

// if we’re at the end of the array…
if (yindex >= numReadings)
// …wrap around to the beginning:
yindex = 0;

// calculate the average:
yaverage = ytotal / numReadings;
//
delay(1);

// subtract the last reading:
ztotal= ztotal – zreadings[zindex];
// read from the sensor:
zreadings[zindex] = analogRead(zpin);
// add the reading to the total:
ztotal= ztotal + zreadings[zindex];
// advance to the next position in the array:
zindex = zindex + 1;

// if we’re at the end of the array…
if (zindex >= numReadings)
// …wrap around to the beginning:
zindex = 0;

// calculate the average:
zaverage = ztotal / numReadings;
//
delay(1);

//—–Dress LightUp—–
if( zaverage <= (dressThreshold – 20) || zaverage >= (dressThreshold + 20)){
//
if (dressLight <= 255){
dressLight = dressLight + 10;
analogWrite(dressPin, dressLight);
//
}
}
else if((zaverage <= dressThreshold + 20) && (zaverage >= dressThreshold – 20)){

dressLight = 0;
/* while(dressLight >= 0){
//
dressLight = dressLight – 10;
}
analogWrite(dressPin, dressLight);
//
*/
}
//
//—–Serial Monitor Display—–
Serial.print(xaverage);
Serial.print(“\t”);
//
Serial.print(yaverage);
Serial.print(“\t”);
//
Serial.print(zaverage);
Serial.print(“\n”);
//
delay(500);// delay before next reading:
}//loop ends

Circuit

Screen Shot 2014-12-09 at 5.13.02 PM