The World's Simplest Open Source DIY MP3 player Sakura
For around $30 in parts and a good amount of patience, you can have a completely open source and hackable mp3 player ready to go. It can be modified to accept serial commands, be embedded in an art project, used as the voice of your next smart talking robo-sidekick, or filled with music and used as is. Put in whatever size card you want, up to the theoretical limit of the MMC format! All the source and schematics are here for free as part of the Creative Commons. I have kits available if you don’t feel like scavenging for the parts yourself.
This player features a shuffle mode, basic track navigation, volume control, FAT32 support, fragmented file support, an unlimited number of files on the root directory, and high quality playback. Files at 256Kbps can be played without a hitch. Variable bitrate files are supported with peaks up to 320Kbps.
WAV files are also supported, but they have to be less than CD quality unless you put a faster oscillator in the pic. It works on my test device, but running the pic at over ~8MHz with only a 3.3 volt supply can be problematic. So I hear. I’m still working on the WAV stuff, so if you have some funny results playing WAV files, let me know.
To load the memory card, you will need some sort of card reader/writer. Many computers have them built in. External USB models are available for ~$10. Make sure to format the card FAT32, not FAT16.
For normal playback, load a card up with MP3 files (make sure they all have a “.mp3” file extension) and insert it into the player. Turn on the power and it should immediately start playing the first track. Tracks are played in the order that they are put onto the memory card.
To get into shuffle mode, hold the “next track” button down while you power on the device. It will remain in shufle mode until the next power cycle. Once all the songs have played once (and only once) it will go to sleep until the next power cycle.
BEGINNERS BEWARE! This is an intermediate level project. You will need things like a PIC programming device and some working knowlege of C programming, as well as a decent but not huge amount of electronics experience. An oscilloscope doesn’t hurt either. Be warned! And the parts are tiny!
If you are a beginner, give these books and websites a look:
www.parallaxinc.com www.sparkfun.com www.microchip.com www.microchipc.com www.dontronics.com www.jameco.com ccsinfo.com (the midrange compiler is the one I used for this project)
all the Forrest Mims III books, available at radio shack
Practical Electronics for Inventors, by Paul Scherz and Nuts and Volts Magazine (tower books has it most of the time)
Why is it called Sakura? It’s spring here and the cherry blossoms are blooming everywhere. Sakura means cherry blossom in japanese. And the first prototype was housed in a pink plastic box.
Below is the schematic diagram. Click here for a larger version in .bmp format
The source code is in C. The compiler I use is the PCM midrange compiler from CCS. It’s about $100 and compiles very tight code and has a reasonably full set of built in functions and datatypes. I’m very happy with it. Their website is here: ccsinfo.com.
For people without any need to modify the code, there is a HEX file ready to be burned directly into a pic. Be sure to clear the BROWNOUT and WATCHDOG fuses. That means disabling them. If you don’t, the whole thing will fail to run. This is the most common mistake.
Currently, all 4K of program space is nearly used up. The 256 byte EEPROM is completely used up for a lookup table for the shuffle function. There are a few non critical functions that can be removed to make some space, like the button interface and the shuffle routines. If microchip ever comes out with an 8k, 18 pin device, I will switch to that one for this project. Also, you might be able to make some of the code more efficient than I can. If so, let me know what you come up with!
News on theme: