Ibrahima DIALLOJean Noël
Published © CC BY-SA

Slot-In Record Player with Arduino, Bluetooth, RFID & MP3

Turn an old "Slot-In Record Player" into a party staple with Bluetooth, an MP3 player and RFID tags.

BeginnerWork in progress660
Slot-In Record Player with Arduino, Bluetooth, RFID & MP3

Things used in this project

Hardware components

Micro-SD Memory Card Extension
×1
SD Memory Card
×1
Adafruit Music Maker MP3 Shield for Arduino
×1
Arduino Uno Rev3
Seeed Studio Arduino Uno Rev3
×1
Audio amplifier 7W mono Kit Velleman WSAH4001
×1
Seeed Studio Grove - LCD RGB Backlight
×1
× Micro Switch
×1
Seeed Studio × Grove - 125KHz RFID Reader
×1
Loud Speaker 8 Ω - 5 W 77 mm LS01-5
×1
× Rotary Potentiometer 10K
×1
Potentiometer Knob
×1
DC Socket 2.1mm
×1
× RFID Tag (Adhesive Paper Label) - 125kHz
×6
Power supply 12 Vcc - 2 A
×1
Resistor 1k ohm
Resistor 1k ohm
×1
Resistor 10k ohm
Resistor 10k ohm
×1
× Step Down regulator LM2596 (9V
×1
KAB-215v2 2 x 15W Class D Audio Amplifier Board with Bluetooth 5.0
×1

Story

Read more

Schematics

Schematic.jpg

Wiring Sheet.xlsx

Boards wiring.jpg

Code

MangeDiskV3.ino

Arduino
#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;



 
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, 0,255);
  int ColorR= map (VolumePot, 0, 1023, 255,0);

 
  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, 0,100);
   if (DiskIn)
   {
    lcd.setRGB(ColorR, ColorG, 0);
  
   
    
   }
   
   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.print("Playing track:");
  lcd.setCursor(0, 1);
  lcd.print(Ctrack);
  
  if((CurrentTrack!=Track)&&(DiskIn)) musicPlayer.startPlayingFile(Ctrack);
  CurrentTrack=Track;
}

Credits

Ibrahima DIALLO
2 projects • 4 followers
I have always been passionate about the world of computers and I am currently a 2nd year Bachelor student at the LDLC School in France.
Contact
Jean Noël
13 projects • 36 followers
pedagogical director at L'école LDLC https://www.linkedin.com/in/jnlootsidebox/
Contact

Comments

Please log in or sign up to comment.