-
1Wiring all the boards together before integration in the case
-
2Put all the wires according to the schematic
-
3Arduino IO mapping:
-
4Upload the Arduino Sketch
#include <Arduino.h> #include <Wire.h> #include "rgb_lcd.h" //https://www.arduinolibraries.info/libraries/grove-lcd-rgb-backlight // include SPI, MP3 and SD libraries #include <SPI.h> #include <Adafruit_VS1053.h> #include <SD.h> //https://wiki.seeedstudio.com/Grove-125KHz_RFID_Reader/ #include <SoftwareSerial.h> // These are the pins used for the music maker shield #define SHIELD_RESET -1 // VS1053 reset pin (unused!) #define SHIELD_CS 7 // VS1053 chip select pin (output) #define SHIELD_DCS 6 // VS1053 Data/command select pin (output) // These are common pins between breakout and shield #define CARDCS 4 // Card chip select pin // DREQ should be an Int pin, see http://arduino.cc/en/Reference/attachInterrupt #define DREQ 3 // VS1053 Data request, ideally an Interrupt pin #define START 0x02 #define END 0x03 #define RFID_SCAN_PIN 9 #define SWITCH 2 SoftwareSerial Rfid(8, 0); rgb_lcd lcd; Adafruit_VS1053_FilePlayer musicPlayer = Adafruit_VS1053_FilePlayer(SHIELD_RESET, SHIELD_CS, SHIELD_DCS, DREQ, CARDCS); bool DiskIn=false; int VolumePot =0; int NOISE =20; String CurrentTrack =""; byte RougeVal = 0; byte VertVal = 0; byte BleuVal = 0; char Ctrack[]="12345678.mp3"; void setup(void) { pinMode(SWITCH, INPUT_PULLUP); Serial.begin(115200); Serial.println("Ready to Play music !"); Rfid.begin(9600); lcd.begin(16, 2); lcd.setRGB(255, 0, 0); lcd.print("Ready to Play"); lcd.setCursor(0, 1); lcd.print("Music"); if (! musicPlayer.begin()) { // initialise the music player Serial.println(F("Couldn't find VS1053, do you have the right pins defined?")); while (1); } Serial.println(F("VS1053 found")); SD.begin(CARDCS); // initialise the SD card // If DREQ is on an interrupt pin (on uno, #2 or #3) we can do background // audio playing musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT); // DREQ int } //****************************************************************** void loop(void) { char RecievedChar; static int OldVolume=-1000; int Volume= map(VolumePot, 0, 1023, 31,0); int ColorG= map (VolumePot, 0, 1023, 255,0); int ColorR= map (VolumePot, 0, 1023, 0,255); if (!digitalRead(SWITCH) && !DiskIn ) { DiskIn=true; Serial.println("Disk IN"); delay(100); } if (digitalRead(SWITCH) && DiskIn ) { DiskIn=false; Serial.println("Disk OUT"); musicPlayer.stopPlaying(); CurrentTrack =""; lcd.clear(); lcd.print("Ready to Play"); lcd.setCursor(0, 1); lcd.print("Music"); } int VolumeAfficher= map(VolumePot, 0, 1023, 1,102); if (DiskIn) { lcd.setRGB(ColorR, ColorG, 0); lcd.clear(); lcd.print("Volume :"); lcd.print(VolumeAfficher); lcd.print("%"); lcd.setCursor(0, 1); lcd.print("Music playing"); delay(100); } else lcd.setRGB(255, 0, 0); VolumePot = analogRead(0); if(abs(OldVolume-VolumePot)>NOISE) { Serial.println(Volume); musicPlayer.setVolume(Volume,Volume); OldVolume=VolumePot; } if (Rfid.available()) { RecievedChar=Rfid.read(); ReadTag(RecievedChar); } } //************************************************************************************** void ReadTag(char RecievedChar) { static int Counter=0; static String ReceivedCode = ""; if(isprint(RecievedChar)) ReceivedCode+=RecievedChar; if(RecievedChar==START) Counter=0; else Counter++; if(RecievedChar==END) { ReceivedCode.remove(10, 2); ReceivedCode.remove(0, 2); ReceivedCode = ReceivedCode + ".mp3"; PlayMusic(ReceivedCode); ReceivedCode=""; } } //************************************************************************************** void PlayMusic(String Track) { char Ctrack[]="12345678.mp3"; Track.toCharArray(Ctrack, 13); Serial.println(Ctrack); lcd.clear(); lcd.setCursor(0, 1); lcd.print(Ctrack); if((CurrentTrack!=Track)&&(DiskIn)) musicPlayer.startPlayingFile(Ctrack); CurrentTrack=Track; }
-
5Create your playlist on the SD card
How to make your playlist in an easy way
You'll need:
- All the former vinyl records with their cover that you want to use in your playlist
- The corresponding mp3 files available on the SD card.
For the mp3 files, you can find the music on youtube and use MediaHuman YouTube to MP3 Converter for instance
Now, for each element of your playlist follow those steps:
- stick the RFID tag at the center of the vinyl record
- put the vinyl record back into his cover
- insert it into the slot-in player
- the tag's ID will be displayed on the LCD screen, take note of this ID (eight characters)
- rename the mp3 file on the SD card with the ID, don't change the .mp3 extension
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.