what is fatCatZero?

fatCatZero is an interactive wearable realized with the Arduino Lilypad. This hoodie is using the Lilypad mainboard and battery module as well as 6 LED-modules, a piezo-speaker and conductive fabric/thread.

To control the sound and light modules, fatCatZero uses a soft circuit leading to two patches of conductive fabric sewn to the insides of its front pouches. With placing your hands onto both of them, the circuit gets completed and the data of how conductive you are can be used to influence the emitted sound and/or light.

"nyan-nyan-mode"

Based on the nyan- (or poptart-) cat-meme, it plays the nyan-cat-melody and blinks in tune as long as the circuit is completed. The melody always starts at the point where it last broke off and is programmed to repeat nyan-stop.

"fatCatKaraoke"

This behavior uses the analogue input of your conductivity to change the pitch of the tone emitted by the piezo as well as the amount of LEDs turned on. You can now sing and dance with and/or for fatCat.

  • The LEDs are sown in pairs to the outputs 3, 5 and 6 (supporting PWM) and connected serially to the – Pole of the mainboard.
  • The speaker is sown to output 12 and the – Pole.
  • One patch of fabric is sown to the – Pole of the mainboard, the other one connects with analogue input a1.
  • The mainboard is connected to the battery module, which is sown down on top of the backside of the hoodie. There, it is near enough to provide enough energy and also it gets covered by the hood when it's not up.

tipps

  • Be sure your power supply isn't too far away from the main board to get enough power.
  • Try not to plan too much overlappings of the trails. If it is unavoidable, stitch one trail on the outside and one on the inside. Make the stitches long to be sure that they won't connect and cause a short.
  • If you need your connected LEDs to fade, be sure to connect them to the first 6 outputs, as the others do not support PWM (analogue output).

/*********************************************
 **************** nyanNyanMode ****************
 *****------------------------------------*****
 ******** the PopTartCat-behavior for ********* 
 ***************** fatCatZero *****************
 *****------------------------------------*****
 ****-- melanie.massinger * feloidea.com --****
 *********************************************/

/* globals */
int LEDpin1 = 3;
int LEDpin2 = 6;
int LEDpin3 = 5;
int speakerPin = 12;

int sensorValue;
int LEDcount;
int songCount = 0;
int threshold = 1000;

int length = 106; // the number of notes
int tempo = 120;

// array containing the consecutive notes to play = the melody
String notes[] = { 
  "fs5", "gs5", "d5", "ds5", "cs5", "d5", "cs5", "b4", "b4", "cs5", "d5", "d5", "cs5", "b4", "cs5", "ds5", "fs5", "gs5", "ds5", "fs5", "cs5", "ds5", "b4", "cs5", "b4", "ds5", "fs5", "gs5", "ds5", "fs5", "cs5", "ds5", "b4", "d5", "ds5", "d5", "cs5", "b4", "cs5", "d5", "b4", "cs5", "ds5", "fs5", "cs5", "d5", "cs5", "b4", "cs5", "b4", "cs5", "b4", "fs4", "gs4", "b4", "fs4", "gs4", "b4", "cs5", "ds5", "cs5", "e5", "ds5", "e5", "fs5", "b4", "b4", "fs4", "gs4", "b4", "fs4", "e5", "ds5", "cs5", "b4", "e4", "ds4", "e4", "fs4", "b4", "fs4", "gs4", "b4", "fs4", "gs4", "b4", "b4", "cs5", "ds5", "b4", "fs4", "gs4", "fs4", "b4", "b4", "b4", "fs4", "gs4", "b4", "e5", "ds5", "e5", "fs5", "b4", "as4" };

// array containing the number of beats every tone has to be hold
int beats[] = {
  2, 2, 1, 2, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 };



/**** setup ****
 ***** declaring the speaker- and LEDpins as output, initialize serial connection
 ****/
void setup() {
  Serial.begin(9600);
  digitalWrite(A1, HIGH);
  pinMode(LEDpin1, OUTPUT);
  pinMode(LEDpin2, OUTPUT);
  pinMode(LEDpin3, OUTPUT);
  pinMode(speakerPin, OUTPUT);
}



/**** loop ****
 ***** play the tones contained in the beforehand declared array if the received value rises above threshold
 ***** let the LEDs blink in tune
 ****/
void loop() {
  sensorValue = analogRead(A1);

  if(sensorValue < 1000) {
    Serial.println("sensorIf");

    // using songCount as counter variable to pick up the tune where it last broke off
    for(int i=songCount; i < length; i++) {
      sensorValue = analogRead(A1);
      songCount++;
      Serial.println(i);

      if(songCount >= length) {
        songCount = 0;
      } 

      // break function if the value falls below threshold
      if (sensorValue >= threshold) {
        digitalWrite(LEDpin1, LOW);
        digitalWrite(LEDpin2, LOW);
        digitalWrite(LEDpin3, LOW);
        songCount--;
        break;
      } 
      else {
        // if there is an empty beat = pause
        if(notes[i] == ' ') {
          delay(beats[i] * tempo);
        } 
        // blink LEDs alternatingly
        else {
          if(LEDcount == 0) {
            digitalWrite(LEDpin1, HIGH);
            digitalWrite(LEDpin2, LOW);
            digitalWrite(LEDpin3, LOW);
            LEDcount++;
          } 
          else if (LEDcount == 1) {
            digitalWrite(LEDpin1, LOW);
            digitalWrite(LEDpin2, HIGH);
            digitalWrite(LEDpin3, LOW); 
            Serial.println("counter1");
            LEDcount++;
          } 
          else if (LEDcount == 2) {
            digitalWrite(LEDpin1, LOW);
            digitalWrite(LEDpin2, LOW);
            digitalWrite(LEDpin3, HIGH); 
            LEDcount=0;
          }
          // play the current note
          playMelody(notes[i], beats[i] * tempo);
        } 
      }
    }
  } 
  // to make shure all LEDs are switched off if the value < threshold
  else if(sensorValue >= threshold) {
    digitalWrite(LEDpin1, LOW);
    digitalWrite(LEDpin2, LOW);
    digitalWrite(LEDpin3, LOW);
  }

}



/**** playTone ****
 ***** play the required tone by using the periodic time as delay
 ****/
void playTone(int timeHigh, int duration) {
  // as long as i < duration in microsesonds, increase by period duration * 2 (to start "next wave")
  for (long i=0; i < duration*1000L; i += timeHigh*2) {
    digitalWrite(speakerPin, HIGH);
    delayMicroseconds(timeHigh);
    digitalWrite(speakerPin, LOW);
    delayMicroseconds(timeHigh);
  }
}



/**** playMelody ****
 ***** declare arrays with note- and frequency(delay) definitions
 ***** search by noteName, which tone should be played
 ***** give the frequency-value to the playTone function
 ****/
void playMelody(String note, int duration) {
  // array containing the note names used in the melody you want to be played
  String noteNames[] = { 
    "ds4", "e4", "fs4", "gs4", "as4", "b4", "cs5", "d5", "ds5", "e5", "fs5", "gs5"     };
  // array defining the according period durations for each of the above notes
  // timeHigh  =  period/2  =  1/(2*frequency)
  int timeHigh[] = { 
    1608, 1517, 1353, 1205, 1073, 1013, 903, 852, 804, 759, 676, 602     };

  // if one of the noteNames matches with the current note-String, play this tone
  for(int j=0; j < 12; j++) {
    if(note == noteNames[j]) {
      playTone(timeHigh[j], duration);
    } 
  }
}


    
    
/*********************************************
**************** fatCatKaraoke ***************
*****------------------------------------*****
******** the sing-a-song behavior for ******** 
***************** fatCatZero *****************
*****------------------------------------*****
****-- melanie.massinger * feloidea.com --****
*********************************************/

/* globals */
int LEDpin1 = 3;
int LEDpin2 = 6;
int LEDpin3 = 5;
int speakerPin = 12;

int sensorValue;


/**** setup ****
 ***** declaring the speaker- and LEDpins as output, initialize serial connection
 ****/
void setup() {
  Serial.begin(9600);
  digitalWrite(A1, HIGH);
  pinMode(LEDpin1, OUTPUT);
  pinMode(LEDpin2, OUTPUT);
  pinMode(LEDpin3, OUTPUT);
  pinMode(speakerPin, OUTPUT);
}



/**** loop ****
 ***** read the conductivity value from sensor and let LEDs blink and the speaker buzz accordingly
 ****/
void loop() {
  sensorValue = analogRead(A1);
    if(sensorValue >= 1000) {
      digitalWrite(LEDpin1, LOW);
      digitalWrite(LEDpin2, LOW);
      digitalWrite(LEDpin3, LOW);
    }
    else if(sensorValue < 1000 && sensorValue >= 900) {
      digitalWrite(LEDpin1, HIGH);
      digitalWrite(LEDpin2, LOW);
      digitalWrite(LEDpin3, LOW);
      playTone(speakerPin, 2093, 100); // C
    }
    else if(sensorValue < 900 && sensorValue >= 800) {
      digitalWrite(LEDpin1, HIGH);
      digitalWrite(LEDpin2, LOW);
      digitalWrite(LEDpin3, LOW);
      playTone(speakerPin,2349,100); // D
    }
    else if(sensorValue < 800 && sensorValue >= 700) {
      digitalWrite(LEDpin1, HIGH);
      digitalWrite(LEDpin2, HIGH);
      digitalWrite(LEDpin3, LOW);
      playTone(speakerPin,2637,100); // E
    }
    else if(sensorValue < 700 && sensorValue >= 600) {
      digitalWrite(LEDpin1, HIGH);
      digitalWrite(LEDpin2, HIGH);
      digitalWrite(LEDpin3, LOW);
      playTone(speakerPin, 2793, 100); // F
    }
    else if(sensorValue < 600 && sensorValue >= 300) {
      digitalWrite(LEDpin1, HIGH);
      digitalWrite(LEDpin2, HIGH);
      digitalWrite(LEDpin3, HIGH);
      playTone(speakerPin, 3136, 100); // G
    }
   else if(sensorValue < 600 && sensorValue >= 300) {
      digitalWrite(LEDpin1, HIGH);
      digitalWrite(LEDpin2, HIGH);
      digitalWrite(LEDpin3, HIGH);
      playTone(speakerPin, 3520, 100); // H
    }
}


/**** playTone ****
 ***** play the required tone by using the periodic time as delay
 ****/
void playTone (char speakerPin, int frequencyInHertz, long timeInMilliseconds) {
  int x;
  // delay in Microseconds
  long delayAmount = (long)(1000000/frequencyInHertz);
  long loopTime = (long)((timeInMilliseconds*1000)/(delayAmount*2));
  
  for (x=0; x < loopTime; x++) {
    digitalWrite(speakerPin, HIGH);
    delayMicroseconds(delayAmount);
    digitalWrite(speakerPin, LOW);
    delayMicroseconds(delayAmount);
  }
} 


{