Adding shuffle feature to low-cost MP3 player module
I had a few friends over during
Christmas, and to provide background
music, I had my stereo amplifier connected to a CD player. After a while, I
got sick and tired of getting up to put
on a new CD. I decided that I wanted
a way to play at least 10 CDs worth of
music with reasonable quality so that
each track was randomly played.
I came across the Jaycar XC3748
MP3 audio module at $14.95, which
plays audio files on a TF/SD card. It
also has a serial communication interface (UART) that can be used to control which music tracks are played and
in what order, plus six pushbuttons to
control the basic functions like play,
pause, previous, next track and level
adjustment.
There is also a USB interface to
enable you to add music files from your
computer. Its headphone jack provides a stereo output at the right level
to directly connect it to an amplifier.
It uses the YX5200-24SS processor, which provides reasonable music
playback quality and, at 77 x 33 x
8mm, it can be mounted in a small
utility box.
Looking at the data sheet, I found
that if you sent the serial code “7E FF
62
Silicon Chip
06 18 00 00 00 FE E3 EF” (hexadecimal) at 9600 baud, the module would
play the tracks in a random order, as
I wanted. All I needed was a simple
microcontroller circuit to generate
the code. The accompanying circuit
diagram shows what I came up with.
The unit is powered from a standard 12V or 9V DC power pack. This
feeds linear regulator REG1 to produce
5V DC for the Jaycar module and the
microcontroller.
To start playing music in a random
order, the Random start button must
be pressed, taking input pin 5 (GP2) of
the PIC12F617 micro high. The 100nF
capacitor across the switch eliminates
contact bounce. This positive level
causes the random playback code
listed above to be sent to the Jaycar
module’s RX input.
If you look at the data sheet for the
module, you will see many other commands that can be sent. For example,
you could ask it to play a particular
track. If you are into coding, this would
be a simple modification.
After converting my CDs to MP3 format and copying them onto a FAT32
card, which I inserted into the module’s socket, I mounted the playback
Australia’s electronics magazine
module and my circuit in a small plastic utility box. I fitted three pushbuttons to the top of the box: random start,
next track and previous track, plus an
on/off toggle switch and a power indicator LED.
On the side, I added a socket for the
12V power input and a hole for the
jack plug lead connecting it to the stereo amplifier. On the side next to the
USB socket, I cut a rectangular hole
so that a USB cable can be plugged
into the Jaycar board. This enables
you to add or erase music files from
the micro SD card without having to
open up the box.
The next track and previous track
switches on the utility box are wired
in parallel with the associated switch
on the Jaycar board. These switches
can also be used to adjust the volume. Holding down the previous
button reduces the volume, while
holding down the next track button
increases it.
Note that the random play button always cases the first track to be
played. If that annoys you, jump to the
next track by pressing the next button.
Les Kerr,
Ashby, NSW. ($80)
siliconchip.com.au