MP3 Player

Overview

There are probably many ways to do this - here is one. Please, note that 6510 is not doing the decoding.

The primary requirements I had set for this were:

  • Use SD cards of size at least 8GB
  • Full access to file system in order to browse files and folders
  • Control over audio properties (volume, bass, treble, stereo/mono...)
  • Real time elapsed playing time
  • Access to ID3 data (title, album, artist)

Components used

  • 16MHz/5V ATMEGA328P module. Funduino Pro Mini or similar (~3.5€ including shipping)
  • Note, that there are several makers of these boards with different names.
  • The board needs to be 5V version (16MHz). This is a tiny (size of a small stamp) , cheap yet very capable board.
  • Geeetech VS1053 MP3 board (I paid 10.59$ including shipping)
  • There are actually many VS1053 boards available, others may work as well - I just happened to pick this one. It also has a Line-In connector and a microphone already installed on board for recording or mixing.

Connections

Requires only soldering some wires between C64 userport, ATMEGA328P board and VS1053 board as shown below.

See User port pinout, for example, from here:

Commodore 64 User port pinout

Note 1: The current consumption might get over 100mA so, i recommend getting the +5V somewhere else than user port to be safe. I'm currently powering the module from my C64 Tower's ATX PCU.

Some current measurements including both ATMEGA328P module and VS1053board made with Fluke 189 true RMS multimeter:

Power up peak: 114mA

Idle (after powering up): 61mA

Scanning directory 70mA - 98mA

Playback mp3/ogg: 68mA (start peak 82mA)

After putting VS1053 Board to Power off -state: 43mA

Note 2: The Audio ground (GBUF) in the VS1053 module's 3.5mm stereo speaker connector is not connected to system GND (and should not be directly connected to GND). This is not a problem if you are using a headset or an isolated active speakers - where ground loops cannot arise. This can be a problem, however if you want to connect the audio, for example, to separate amplifier where audio is grounded.

This may require some additional components. See chapter 3 of

http://www.vlsi.fi/fileadmin/app_notes/vs10XXan_output.pdf

and chapter 3.2 there for a simple connection.

Flashing ATMEGA328P Arduino firmware

ATMEGA328P needs to have a proper firmware flashed.

c64mp3p_v1.hex is included in the release zip file.

Here is a link describing different methods on how to flash the firmware:

https://github.com/grbl/grbl/wiki/Flashing-Grbl-to-an-Arduino

In linux I've used avrdude (comes with arduino IDE... obviously you need to check/fix the paths) :

avrdude ~/apps/arduino-1.0.5/hardware/tools/avrdude.conf -pm328p -carduino -b 57600 -P /dev/ttyUSB0 -D -Uflash:w:c64mp3p_v1.hex

You also need a some sort of flashing interface - I've used 3.3V USB FTDI cable.

Running the SW:

  1. First you need to have patch files copied from release zip file's "tosdcard" -directory into the root of your SD card. While this is not absolutely a must - it allows many thing to work correctly. For example, playing uncompressed flac files work only if VS1053 DSP is patched. Also recording & mixing requires these patches (or plugins).
  2. Make sure you have mp3, ogg, fla -files in your SD card ... obviously
  3. Note 1) 8.3 filename length is supported only. Longer filenames wil only show beginning of filename followed by ~1, ~2 etc.
  4. Note 2) One directory can only hold 255 items (sub directories or files)
  5. Switch off your C64
  6. Insert SD card
  7. Switch on your C64
  8. run the mp3player.prg

TODO:

  • Integrate/squeech into the same application with with FM-radio and CD-player (FMCDC64 ... what ever the name for that should be ...) High priority since I'd like to use all three without starting a new SW. MP3 player and FM radio -HW should be able to coexist in the userport at the same time since they have different I2C addresses.
  • Connect VS1053 board directly into user port without ATMEGA328P... Although there are quite a few drawbacks with this approach and SPI throughput probably would be a bottleneck... low priority
  • Recording and mixing from MIC works. However, currently Line-in can only be mixed to right speaker and recording of line in does not work.
  • Try the MIDI of VS1053

Case - including FM radio module - could be something like this, tbd...

Will propably try simple passive mixing of FM-radio audio out and VS1053 audio out (with 10k resistors) and make sure SW will only let one audio out to be active at a time.