FMF: Musical Friendship Bracelets

Share cute songs with your best friends, significant other, or children to let them know you're thinking of them. You can even collaborate on songs back and forth!

Made by Stefanie Owens, Alanna Libbrecht, Xi and shianhey

Created: February 3rd, 2015

0

Project Scope

We chose to take a slightly different course and focused on long-distance friendships rather than long-distance romantic relationships. While long-distance romances tend to have logistical problems (“when is my partner free to talk?”), long-distance friendships have issues with staying in touch and sharing special moments together. A special moment with your best friend can be something as simple as a funny face or a goofy coincidence, and these moments are few and far between in a long-distance friendship.

Because of this, we have designed a simple connected friendship bracelet that gives you and your best friend the chance to connect and collaborate over silly little songs. The bracelet records on the cloud every time you push the surface of the band, and allows you to alert your friend whenever their song is ready.  For example, each time I push my band, a random note is sent to the cloud and stored for later.  Whenever I feel like it, I can push the second button on my band and send the prepared song to my friend for them to hear.  My friend's pair bracelet then lights up to alert them that I am thinking of them and they can listen to their song I made.  

They can even decide to mix things up a bit, and send me the same song back in a new arrangement!  We can collaborate back and forth (if we are music lovers), or just be able to send melodies to one another to let each other know we are thinking of one another.  The FMF bracelet also has the capability to store your favorite song so you can always have that to listen to as a default as you run, walk, or commute day-to-day.  

In a short summation, the bracelets work like this: 

FSR Sensor -- changes the melody tones of your friend’s bracelet (for collaboration on a song) 

1st button -- plays the song from your friend that they sent you

2nd button -- sends a light to let them know that I sent a melody to them

3rd button -- plays your favorite song you have saved to the bracelet

Process Documentation:  https://docs.google.com/document/d/1GGxE9m6BlwIiaM91fgVBX9TIKT-V10n4ICxDkCAFy68/edit?usp=sharing

0

We based the sizes of our prototypes in regards to different size configurations and limitations of the sensors we wanted to include on them.  We were unable to receive any of the sensors above with the exception of the pressure sensor, so we modified our design to simply include buttons and a pressure sensor, and included realistic sizes for the bracelets themselves.  

Materials Used

- 2 Spark Microcontrollers

- 4 breadboards

- 6 push buttons

- 2 piezos

- 2 force sensitive resistors (FSRs)

- 4 1kΩ Resistors

- 8 10kΩ Resistors

- 2 RGB LEDs

- Jumper wires

0
/*************button***************/
//button1 is for bell
int speakerPin = D0;
int buttonPin = A3;
int button;

//button2 is for LED
int buttonPin2 = A5;
int button2;

//button3 is for change the melody
int buttonPin3 = A6;
int button3;

/***************melody****************/
int noteDurations[] = { 8,8,4,4,4,2,8,8,4,4,4,2,8,8,4,4,4,4,3,8,8,4,4,4,2 };

int melody[] =
{
  196, 196, 220, 196, 262, 247, 196,
  196, 220,196, 294, 262,
  196, 196, 392,330,262, 247, 220,
  349, 349, 330, 262, 294, 262
};

int melodyDataBase[] = {1661, 1568,196,220,262,247,294,330,392,349};
boolean isPlaying = false;

/***************melody2****************/
int melody2[] = {196 , 131, 156, 175, 196 ,131, 156, 175, 147, 175 , 123, 147, 156, 175, 123, 156, 147,131};
int noteDurations2[] = {6, 9, 3, 3, 6, 6, 3, 3, 27, 9, 9, 3, 3, 6, 6, 3, 3, 27};

/***************LED****************/
int RedPin = A0;
int BluePin = A1;
int GreenPin = D1;

int r = 255;
int g = 255;
int b = 255;

/********save data to google**********/
char saveData[8];
int savePreData[8];
int n = 0;
int data1;
int data2;

/********force sensor**********/
//force sensor is for replacing one of the button
int forcePin = A7;
int forceCellReading = 0;


void setup()
{
  pinMode( buttonPin , INPUT_PULLDOWN);
  pinMode( buttonPin2 , INPUT_PULLDOWN);
  pinMode( buttonPin3 , INPUT_PULLDOWN);

  /***************data on cloud***************/
  //now the event blabla would be for changing melody on another device
  Spark.subscribe( "Mylalallalallalallasound", handleDoorbellPush);
  Spark.subscribe( "MysocutelovelyLED", handleLEDPush );//,MY_DEVICES);

  /***************MY RGB***************/
  pinMode( RedPin , OUTPUT);
  pinMode( BluePin , OUTPUT);
  pinMode( GreenPin , OUTPUT);

  /**********turn the sound and light off******************/
  digitalWriteColor( 255, 255, 255 );
  noTone(speakerPin);

  /***************variable for detect and debug***************/
  Spark.variable("red", &r, INT);
  Spark.variable("green", &g, INT);
  Spark.variable("blue", &b, INT);
  Spark.variable("saveMelody", &saveData, STRING);
  Spark.variable("force", &forceCellReading, INT);
}

void loop()
{
  if (Spark.connected() == false)
  {
    Spark.connect();
  }

  button = digitalRead( buttonPin );
  button2 = digitalRead(buttonPin2);
  button3 = digitalRead(buttonPin3);

  forceCellReading = analogRead(forcePin);

  /**********button 1 for sound, button 2 for RGB******************/
  if( button == HIGH )
  {
      doDingDong();
    //  delay( 500 );
  }

  if( button2 == HIGH )
  {
      announceLED();
  }

  if( button3 == HIGH )
  {
      playThisSong();
  }

  if(forceCellReading > 1000)
  {
    announceDoorbell();
    //changeMelody();
  }

  /********write data on saveData array, send to google spread sheet*******/
  for(int i = 0; i < 3; i++)
  {
    data1 = savePreData[i];
    data2 = savePreData[7-i];
    sprintf(saveData, "{\"data1\":%d,\"data2\":%d}", data1, data2);
  }
}

/**************************Sound **************************/
void announceDoorbell()
{
  Spark.publish( "Mylalallalallalallasound","HIGH");
}

void handleDoorbellPush(const char *event, const char *data)
{
    changeMelody();
}

void doDingDong()
{
  for (int thisNote = 0; thisNote < arraySize(melody); thisNote++)
  {

    int noteDuration = 1000/noteDurations[thisNote];
    tone(speakerPin, melody[thisNote],noteDuration);

    int pauseBetweenNotes = noteDuration * 1.30;
    delay(pauseBetweenNotes);
    noTone(speakerPin);
  }
  isPlaying = true;
}

void playThisSong()
{
  int pace = 1450;
  for (int Note = 0; Note <54; Note++)
  {
    int duration = pace/noteDurations2[Note];
    tone(speakerPin, melody2[Note],duration);

    delay(duration*1.2);
    noTone(speakerPin);
  }
}

/**************************LED **************************/
void announceLED()
{
  Spark.publish( "MysocutelovelyLED","HIGH");
}

void handleLEDPush(const char *event, const char *data)
{
//  if(data == "HIGH")
  ledAllColorRandom();
}

void ledAllColorRandom()
{
  // set all the colors to a random
  digitalWriteColor( random( 0, 128), random( 0, 128), random( 0, 128) );

  delay(800);

  // Set all of the colors to off

  digitalWriteColor( 255, 255, 255 );
  delay( 100 );
}

void digitalWriteColor( int r1, int g1, int b1 )
{
  r = r1;
  g = g1;
  b = b1;

  analogWrite(RedPin,r );
  analogWrite(GreenPin,g );
  analogWrite(BluePin,b );
}

/**************************melody**************************/
void changeMelody()
{
  for(int i = 0; i < arraySize(melody); i++ )
  {
    int j = random(1,100)%10;
    melody[i] = melodyDataBase[j];

    /************save data to predata array**************/
    savePreData[i] = melody[i];
  }
}
Click to Expand
x