Cartridge Based MP3 Player - CartridgeMP3
5210 Views, 59 Favorites, 0 Comments
Cartridge Based MP3 Player - CartridgeMP3
The CartridgeMP3 bridges the gap between physical and digital music. It plays back the highest quality digital audio through a user interface that has the simplistic charm of a CD or Cassette Tape player. It has a 3D printed body and features an Atmega 32u4 along with an MP3 decoder for audio playback. Audio is stored on a MicroSD card, and the track is selected through a unique 8 bit cartridge with a 12 pin interface. Volume adjustment is offered through a power switch, and programming and power are implemented through a USB-C port.
Why does one need this? Well, it has many practical uses. You could digitize your vinyl collection and play it back through the CartridgeMP3, or you could simply use it as a simple MP3 player, free of the distractions of your phone or iPod. I personally just use it as a bedside MP3 player. Happy making!
Supplies
I did my best to keep the project as low-cost and accessible as possible. Additionally, all the parts are from Adafruit.com, so that is the only store you need to buy from. No aliexpress!
TOOLS:
- Soldering Iron
- 3D Printer
- Wire Strippers
- Hot Glue Gun
- Adjustable Wrench
MATERIALS:
- Adafruit Feather 32u4 Basic Proto
- Adafruit Music Maker FeatherWing
- Adafruit Perma-Proto Quarter-sized Breadboard PCB
- USB Type C Breakout Board* This specifically wasn't used in the project, but I recommend it if you do it yourself* see number 12
- Panel Mount 10K Dual Log Potentiometer w/ On-Off Switch
- 8x 10K ohm resistors
- Mechanical Key Switch
- 3 mm LED
- Headphone Jack
- Pin Header* You will need this female header as well as the male header included with the microcontroller
- Wire* You will need these jumper wires as well as a lot of thin flexible wire from a hook-up kit
- Sacrificial Micro USB cable or micro-b to USB C adapter* Or you can just use micro-b
Get Printing!
Get Printing! You should start the prints right away so that it finishes once you finish the electronics. There are three parts for the player itself - the enclosure, the faceplate, and the pin holder. They were designed using Fusion 360 and printed on an Ender 3. Any filament will work.
SETTTINGS:
Layer Height: ≤.2 mm
Infill: 20%
I recommend printing in this order in order to prevent waiting:
- Pin Holder
- Front Plate
- Enclosure
Wiring
Use the attached wiring diagram as a guide.
Start by wiring together the pins for the MP3 decoder and microcontroller using the jumper cables. Then, you can test to see if both are working properly. Following this, you will want to wire the pull-up resistors for the cartridge interface. These will be wired on the perfboard. Solder the cartridge pins as well, coating the connections with hot glue once finished. Once you have finished wiring, you should mount all the components onto the faceplate, and solder their connections. This includes the pin 13 status LED, the potentiometer with the switch and both audio channel control, the reset button which ties to ground, the audio port, which takes the output of the potentiometer, and the cartridge pins. Take special care with the cartridge pins - these need to be hot glued directly in the middle of the pin holder, which gets carefully hot glued onto the slot in the face plate. Next, take the USB cable and isolate each of the small wires inside. Solder each one to the corresponding pad on the USB C connector, except for the 5V line, which goes through the switch.
Coding
Next up is coding.
To start, you will need to get support for the 32u4 Feather in Arduino IDE. Follow these instructions here. Next, you'll want to install the Adafruit VS1053 so that we can get the MP3 decoder up and running right away. In Arduino IDE, Hover over "Sketch", then click "Include Library", then click "Manage Library". Search for "Adafruit VS1053" in the dialog box, and click install.
After you have it installed, you can copy and paste this code, or download the sketch.
Note the filenames for the MP3 tracks on the Micro SD card. They need to be 8 letters long with a .mp3 extension for the library to be able to handle it. I recommend this... track001.mp3 etc.. In order to put music on the player, you just need to format the SD so that it is empty, then drag and drop the properly named files on with no extra formatting.
// CartridgeMP3 V1 - code // Library and base code from Adafruit, everything else from Justinas Petkauskas // Please modify this and share it on instructables. My code sucks cause I don't really know how to... // Enjoy your CartridgeMP3! #include <SPI.h> #include <SD.h> #include <Adafruit_VS1053.h> #define VS1053_RESET -1 // VS1053 reset pin (not used!) #define VS1053_CS 6 // VS1053 chip select pin (output) #define VS1053_DCS 10 // VS1053 Data/command select pin (output) #define CARDCS 5 // Card chip select pin #define VS1053_DREQ 9 // VS1053 Data request, ideally an Interrupt pin Adafruit_VS1053_FilePlayer musicPlayer = Adafruit_VS1053_FilePlayer(VS1053_RESET, VS1053_CS, VS1053_DCS, VS1053_DREQ, CARDCS); void setup() { pinMode(0, INPUT); // setting up all the cartridge interface inputs pinMode(1, INPUT); pinMode(2, INPUT); pinMode(3, INPUT); pinMode(A0, INPUT); pinMode(A1, INPUT); pinMode(A2, INPUT); pinMode(A3, INPUT); pinMode(A4, INPUT); pinMode(A5, INPUT); pinMode(11, INPUT); pinMode(12, INPUT); pinMode(13, OUTPUT); if (! musicPlayer.begin()) { // initializing the music player while (1); } if (!SD.begin(CARDCS)) { // initializing the SD card while (1); } musicPlayer.setVolume(0,0); // sets volume...LOWER IS HIGHER musicPlayer.useInterrupt(VS1053_FILEPLAYER_TIMER0_INT); // Has something to do with file playback...not sure exactly what } void loop() { // First Track. Choose the cartridge pins that are pulled to ground and define them here, and then assign this to the track that is a few lines down. Tracknames can only be 8 letters long with a 3 letter extension!!!!! while (digitalRead(0) == LOW && digitalRead(1) == LOW && digitalRead(2) == HIGH) { analogWrite(13, 1); // Notification LED, PWM at minimum brightness delay(871); // random delay for dramatic effect musicPlayer.startPlayingFile("/track001.mp3"); // plays music! } while (digitalRead(A2) == HIGH && digitalRead(A3) == LOW && digitalRead(12) == LOW) // read the first one { analogWrite(13, 1); delay(692); musicPlayer.startPlayingFile("/track002.mp3"); } while (digitalRead(0) == LOW && digitalRead(1) == LOW && digitalRead(2) == LOW) { analogWrite(13, 1); delay(748); musicPlayer.startPlayingFile("/track003.mp3"); } while (digitalRead(A2) == LOW && digitalRead(A3) == LOW && digitalRead(12) == LOW) { analogWrite(13, 1); delay(419); musicPlayer.startPlayingFile("/track004.mp3"); } }
Upload the sketch to the microcontroller, and you are off to the races!
Downloads
Assembly
Once the enclosure has finished printing, you are ready to put things together. Thread all the loose parts of the faceplate assembly through the front of the enclosure. Make sure that your USB C connector and micro SD slot are accessible from the back! Glue down all of the loose parts that are inside, again making sure the micro SD slot and USB connector are reachable. Next, smother the edges of the faceplate with hot glue and press the faceplate flush with the body. Your CartridgeMP3 is complete!
Cartridges
Make some cartridges! Use the outside pins as ground, and tie some of the inside 8 to ground using cut-off resistor legs and solder. This will give it its 8 bit code. For example, if you tie the first and last pins to ground, then it will be read as 01111110 by the microcontroller (it has pull up resistors.) In code, the microcontroller pins that read the cartridge input that is pulled low must be part of the conditional statement.
In order to make a cartridge, you will need some 12 long female pin header, the 3D printed parts, and some super glue. Print two copies of the "cartridge" file as it is symmetrical. Solder the pin header to give it its code, and then super glue the three pieces together. You may want to label it. You can use inkscape to create a custom sized label for each cartridge which is 36*44 mm large. Otherwise, you can cut, glue, and hand draw labels from regular printer paper.