Matt Welch
Published © MIT

An RFID card based jukebox, using Sonos

Using a Sonos and a Spark Core to build a cool RFID-based jukebox.

Full instructions provided4,164
An RFID card based jukebox, using Sonos

Things used in this project

Hardware components

RC522 Card
×1
Sonos speakers
Sonos speakers
×1
Spark Core
Particle Spark Core
×1

Story

Read more

Code

code.txt

Plain text
    RC522.readCardSerial();


    char a[11];
    /* Output the serial number to the UART */
    for(byte i = 0; i < sizeof(RC522.serNum); i++)
    {
      char aa[3];
      itoa(RC522.serNum[i],aa,16);
      if (RC522.serNum[i]<0x10) {
        strcat(a,"0");
      }
      strcat(a,aa);
    }
    strcpy(uid,a);
    uint8_t g = client.GET(a);
    if (g == 1) {
      uint16_t resultSize = client.resultBulk(buffer, 100);
      if (resultSize < 5) {
        return;
      }
      char finalPath[128];
      sprintf(finalPath,"/%s%s",sonosRoom,buffer);
      request.path = finalPath;

      http.get(request, response,headers);
      Serial.print("Application>\tResponse status: ");
      Serial.println(response.status);

      Serial.print("Application>\tHTTP Response Body: ");
      Serial.println(response.body);

    }
  }

Github

https://github.com/jishi/node-sonos-http-api

Github

https://github.com/pkourany/RC522_RFID

Github

https://github.com/mattwelch/tunecards

Credits

Matt Welch
1 project • 3 followers
CTO at Wired Triangle. Salesforce1, Mac, and iOS developer. Dad. Music and ocean lover. Hokie.
Contact

Comments

Please log in or sign up to comment.