This project is my first attempt at making a simple MP3 player that could shuffle tunes instead of just using a “random play” function.
This means that regardless of how many tunes are on the SDCard (up to 64K), they are shuffled to make sure the same tune is not repeated.
I decided to use a BY8001-16p MP3 player module controlled by a PIC18F14K50 microcontroller.
The module consists of a BY8001-24SS mp3 controller chip with a 2.5W MIX2002 class-AB mono amplifier chip.
The third chip on the module is a 24C02 2K bit serial EEprom that can store a few settings through a power cycle such as playback volume.
My design didn’t use the built-in amp. Instead I went for a PAM8610 Class D 10W per channel stereo amp module.
Here is my schematic: (click for full size view or download the PDF below).
How it works
A good 12V regulated supply (rated for at least 2 Amps) is needed to power it.
Module “A1” is a D-SUN 3Amp regulator (adjusted using the small potentiometer to output 5V)
The BY8001 module is rated for a 5V supply (maximum) but typically runs at about 4.3V . Diode D1 drops the voltage just enough for this.
The TX/RX serial interface uses 3V logic and resistor R6 (1K) protects the BY8001 from being damaged by the PIC 5V logic.
The module has an interface for a USB memory stick instead of an SD Card. Two 22 Ohm resistors are needed in series with the USB data connections (D- and D+).
Stereo output is provided by the DAC_R and DAC_L (digital to analogue converter outputs) and goes to the PAM8610 amplifier module.
The PAM8610 class D amplifier module is a type XH-M181, available very cheaply from Ebay etc.
This module is basic, no output filters or smoothing capacitor, it is best to just use 8 Ohm speakers and keep the output below 5W per channel to avoid distortion.
I found it produced plenty of volume but a very harsh sound. I later replaced it with better alternatives (see my next MP3 project).
The heart of the player is a PIC18F14K50 microcontroller. This was chosen as it has just enough RAM for the shuffle algorithm.
It communicates with the BY8001 serially at 9600 baud, sending command sequences, waiting either for replies or by checking the BUSY line status.
A rotary encoder with push button controls the main functions: turning the knob adjusts volume. A short press selects a new tune. A long press stops playing.
A separate push button sequentially selects the equalisation mode. There are 6 options: None \ Pop \ Rock \ Jazz \ Classic \ Bass
These modes don’t really correspond with their names. Best to keep pressing the button until it sounds okay!
Mood lighting is provided by up to three PL9823 or WS2812 addressable RGB leds (connected in parallel).
These are used for slowly, randomly changing colour while playing.
Here is the HEX file for programming the PIC18F14K50 chip.
(I am not providing any technical support for this project or any firmware updates.)
Preparing the files
Either a micro SDCard or a USB stick can be used.
The BY8001 supports up to 32Gb and it needs to be formatted in either FAT or FAT32 (depending on the card capacity).
Just copy your MP3 files to the sdcard (no need to rename them or create any folders).
Using the player
As this was just a prototype, it was assembled on breadboard. This did cause some noise problems due to poor earthing etc.
I used it for a while without ever making a proper board.
It worked okay apart from there being a longer delay between tunes playing if a lot (over about 3000 files) were present on the SDCard. This appears to be a limitation of the BY8001 file system.
My next MP3 project will replace the BY8001 with a XY-V17B mp3 module and upgrade the amplifier module to see if it performs any better.