Power Pants!

Power Pants are the pants that make you proud of getting dressed in the morning! They’re not your average pants. They provide you with a nice sense of accomplishment every time you put them on!

Coming soon to a store near you!


What’s in a Power Pant?!

The tech:

Power Pants are built on Arduino, using a simple piezo and pulse width modulation to create audio from chosen frequencies. What you see above is one of two functions coded into the Arduino. The second function is the longer musical bit you hear in the video at the top. It uses the contact in the same way to trigger the sound.

Here’s the code:

[code]
int ledPin = 13;
int inputPin1 = 2;
int inputPin2 = 5;
int val1 = 0;
int val2 = 0;
int counter1 = 0;
int counter2 = 0;
int speakerPin = 9;
char notesA[] = "azbC"; // a space represents a rest
int lengthA = sizeof(notesA);
int beatsA[] = {2,3,3,12};
int tempoA = 80;
char notesB[] = "Cbza"; // a space represents a rest
int beatsB[] = { 2,3,3,4};
int tempoB = 80;
char notesC[] = "gabygabyxzCDxzCDabywabywzCDEzCDEbywFCDEqywFGDEqi";
int lengthC = sizeof(notesC);
int beatsC[] = { 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1};
int tempoC = 150;

void setup() {
pinMode(speakerPin, OUTPUT);
pinMode(inputPin1, INPUT);
pinMode(inputPin2, INPUT);
Serial.begin(9600);
}

void loop(){
val1 = digitalRead(inputPin1);
val2 = digitalRead(inputPin2);
if(val1 == LOW && counter1 == 0) {
counter1++;
for (int i = 0; i < lengthA; i++) {
playNote(notesA[i], beatsA[i] * tempoA);
}
}

if(val1 == HIGH && counter1 == 1) {
counter1 –;
for (int j = 0; j < lengthA; j++) {
playNote(notesB[j], beatsB[j] * tempoB);
}}
if(val2 == LOW && counter2 == 0) {
counter2++;
for (int k = 0; k < lengthC; k++) {
playNote(notesC[k], beatsC[k] * tempoC);
}
}
if(val2==HIGH && counter2 == 1){
counter2=0;
}

else{ digitalWrite(speakerPin, LOW);

}
Serial.print(counter2);
}

void playTone(int tone, int duration) {
for (long i = 0; i < duration * 1000L; i += tone * 2) {
digitalWrite(speakerPin, HIGH);
delayMicroseconds(tone);
digitalWrite(speakerPin, LOW);
delayMicroseconds(tone);
}
}

void playNote(char note, int duration) {
char names[] = {‘c’, ‘d’, ‘e’, ‘f’, ‘g’, ‘x’, ‘a’, ‘z’, ‘b’, ‘C’, ‘y’, ‘D’, ‘w’, ‘E’, ‘F’, ‘q’, ‘G’, ‘i’ };
int tones[] = { 1898, 1690, 1500, 1420, 1265, 1194, 1126, 1063, 1001, 947, 893, 843, 795, 749, 710, 668, 630, 594 };

// play the tone corresponding to the note name
for (int i = 0; i < 20; i++) {
if (names[i] == note) {
playTone(tones[i], duration);
}
}
}

[/code]

IMG_0744IMG_0746 IMG_0745

The simple wire contact activation was converted to a switch using conductive thread stitched into the button holes and around the button. This way, the button itself acts as the switch.

IMG_0747

For the demonstration, extensions were added out the legs where the audio would normally be wired directly into the Power Pants themselves.

This is the future of pants!

%d bloggers like this: