Instructables
Picture of MP3 Interface for Arduino: Cheap and Easy
mp3_2.jpg
MP3_hookup_2.jpg
I have added a follow-on to this Instructable:
http://www.instructables.com/id/Cheap-and-Easy-MP3-Shield-for-Arduino/
The follow-on shows you how to design, etch and build a PCB shield to connect the MP3 to the Arduino. Replaces the analog switches with a 74HC244. SIngle layer board with large surface mount component design. Only 5 thru holes. Take a look.

Ebay abounds with sales for REALLY inexpensive MP3 "Clip" players. These players support MicroSD cards up to 8G, have a built in headphone amp, have built in volume control and Next and Previous control for stepping thru MP3 files. The Clip Players have their own battery and a mini USB port for battery charging and file exchange with the MicroSD card. (You have to supply your own MicroSD card.) And considering the low price, the sound quality is quite good.

For instance:
http://www.ebay.com/itm/ws/eBayISAPI.dll?ViewItem&item=330654403698&ssPageName=ADME:L:OU:US:1123
I had originally bought mine for $5, now up to $6.75! Better buy a few now...

If you need to add a little music or voice to your next Arduino project, this simple hack will get you there. So here is how this works. We remove the guts to one of these inexpensive little MP3 players, solder on a couple of wires to the MP3 circuit board and attach then two an Arduino protoshield (if you are using a full size Arduino, I will show wiring to an Arduino Mini also.) The circuit also requires two analog switches to completely control all the front panel buttons. The Arduino code to control the MP3 player is really simple and an example is provided. You load your sound files on to a MicroSd card and name them in a way so that they can be sequenced in the way you want. When you are done, your Arduino will be able to step to and play specific sound files, adjust volume up or down, pause, etc.

I plan on following up with an EagleCad shield design. But for right now, its wires and solder and a little programming, so Arduinites can get going.

And of course, after I wrote this, I found this one also:
http://www.instructables.com/id/Adding-MP3-to-your-project-for-300/
Hopefully whatever I have left out, you can find in the above.
 
Remove these adsRemove these ads by Signing Up
SurajL3 days ago
cheezyguy57 days ago

Now you can get these clip-on-better-than-an-ipod-shuffle-ipod-shuffle-clone for $1.50 on ebay!

Please help me suggesting that if mp3 player works by either applying to a constant 5v supply to the play/pause button or an impulse will work for the play button??

djsamm882 months ago

Awesome...

But.. is it possible to simultaneously read the contents of the sd card?

goldenshuttle4 months ago

you Saved us from the greedy sound shield online suppliers (we all know them)...they sell MP3 shield with so little capability; flimzy sampling rate; many require file conversion...and as high as 30$..just to rip us...many thanks dresch..great hack indeed.

lukeD2 years ago
I have an Ipod Shuffle, one like on this link: http://img2.topproduct.nl/img/443467/483660-600-600-max-max/fellowes-powershred-ps-77cs-ipod-shuffle-1gb.jpg

how do you take one like that apart?
dresch (author)  lukeD2 years ago
I have never touched an iPod shuffle (10X the value of these little MP3 players) but there is a YouTube video that might help you:
http://www.youtube.com/watch?v=67j1OebOsRI
was wondering if anyone had had any success doing the same thing with an actual iPod shuffle (I'm using the 3rd gen). Would love to hear!
the_ether1 year ago
Thank you. Another nicely detailed article.

Perhaps the schematic relating to the LC2093-B isn't accurate because one side of each button is connected to 3.3V and the other goes through a resistor and then Gnd, so if you shorted one side to ground you'd either bypass the resistor or just have both sides connected to Gnd. I guess that the resistors are in a different position relative to the switches in real life.

How did you work out which buttons needed to be shorted to Gnd and which needed to be connected via the analogue switches? On my MP3 player the buttons are connected differently to yours but I assume that the logic is the same. I just need to work out which ones I have to connect to ground and which to switch.
dresch (author)  the_ether1 year ago
I have not looked at this in some time, but I thought the resistors were pull-ups and that the mechanical switches just shorted the pull-ups to ground when pressed. If you use the tri-state switch, then you don't need to use analog switches.
The tri-state uses only two output modes: 1) high-Z (impedance) like the mechanical switch is open and 2) zero or ground, like the mechanical switch is pressed, producing a short to ground.
Let me know if this is not right, but that is how I remember it.
The 2nd design does not use the analog switches at all.
the_ether1 year ago
Thank you for posting details of your project.

I'm considering replicating it using my Arduino Due but am wondering whether I need the analogue or tri-state switches. The Due uses 3.3V instead of 5V. Looking at the circuit diagram that you kindly attached in your follow-on article, it seems that the buttons on the MP3 player are part of a resistive touch input system; pressing different buttons connects different resistors which causes different voltage drops. I therefore do not understand your use of pin 8 on your Arduino board as surely that would mean bypassing the resistors and therefore the player not seeing different voltages for the different buttons.

BTW, I bought a similar player to yours. On opening it up it looks exactly the same at first and then I noticed small differences in the track layout. Checking the resistances between the butons I see that they are connected differently to yours. The main chip has a different number on it though I'd be very surprised if it had a different pin outlay.
dresch (author)  the_ether1 year ago
You might want to look at the follow up article:
http://www.instructables.com/id/Cheap-and-Easy-MP3-Shield-for-Arduino/

Note that I use 3.3V for the circuit in that article which should be directly compatible with the Due. Note that I am shorting the switches on the MP3 player to ground, or leaving them floating, so I am not bypassing the pull up resistors. Good luck on your project!
meanbean1 year ago
I have an almost identical mp3 player, save for the sd card slot. I'd really like to try this project, but I'm having trouble finding exactly what TS5A3159 you bought on digikey. Also, a minor complaint, but none of the ic's listed were through-board. I suck at surface mount soldering, is there any version of this chip that isn't surface mount?

Help is greatly appreciated!
dresch (author)  meanbean1 year ago
Hi,
I did a follow up using more standard logic (not the TS5a3159):

http://www.instructables.com/id/Cheap-and-Easy-MP3-Shield-for-Arduino/

The circuit in the above Instructable could be implemented using a standard Arduino proto shield with thru-hole logic. (I like surface mount because when I etch PCBs, then I don't have to drill holes. I can usually get away with single sided PCBs that way.)

Good Luck! Bill
phaggood11 year ago
I funded some really tiny arduino-compatibles thru Kickstarter; I have a few of those mp3 players and would like to put together a small package using the two together to upgrade the audio capabilites in my Wrangler.
RogerClark2 years ago
I bought one of these from eBay before seeing this posting.

FYI.
The version that I received seems to use a different IC and operates from a 4.5V battery, instead of 3.3,

I've successfully run my version on 5V from an Arduino.

The Play / Pause, FWD and Back buttons seem to short the center pad of the button to GND (0V). The center's are all pulled high to about 3V (on a 5V supply)

To interface these buttons to the Arduino, the simplest solution seemed to connect a diode to each of these center connection, so that the Arduino could not drive 5V into the MP3 player, but when the Arduino output was LOW, it pulls the connection down to approx 0.5V (it can't get lower because the voltage drop across the diode).

I've tested this and it works fine, as long as the "button" is only pulsed low and not held low for a long time.
The low pulse needed to be more than 100 milli seconds. I tried 50 milli seconds and it didn't work. Higher values e.g. 250 milli seconds may work, but 100 milli seconds seemed to work reliably for me.

The Volume UP and Volume down however are more difficult to control.
These connections are directly linked to the FWD and BACK button (center connections)
And the outer connection on these buttons is not to GND (0V) and appears as 1.8k to GND, but when power is applied this connection has about 3V on it.

Looking at this on an oscilloscope, the voltage is not constant, but is pulses low for about 30 micro seconds every 15 milliseconds.

It would be possible to use some additional components to interface this to the Arduino. Possibly something as simple as a transistor may work.

It may also be possible to control the volume by connecting the outer connection of these buttons to an input on the Arduino.

Then in the Arduino code, when the connection goes low, the output would need to go low at the same time.
But this would probably need to be handled by an ISR, as the Arduino would need to send the output LOW very quickly for it to be registered by the MP3 player, and it may not be possible to do it this way at all, depending on the logic and timing inside the MP3 player.
Since my last posting, I've managed to get the volume controls to work as well.

I used a transistor BC109 with emitter to the outer of the button connection and collector to the inner connection. The base of the transistor was connected to the Arduino via a 1K resistor.

This seems to work and doesn't seem to effect the NEXT / BACK functionality which is on the shared connection with the Volume Up and Volume Down (2 pairs).

Also. BTW. The MP3 player was not bought from the same eBay store, and though it appears identical, the IC is different to the one in this article, and the connections are definitely not the same. However the ability to run on 5V is definitely a benefit.

However, one I have noticed a ticking noise on the audio output. I've tried adding extra capacitors to the supply and various other places on the board, but its not made any difference.
I'm not sure if this ticking is something to do with the specific audio tracks that I'm trying to play, as they may be too quiet, so I'll need to experiment with some louder track and also try different data rates etc, to see if this removes the problem


I forgot to mention. The IC on this MP3 player appears to be a GPD2101, however I've not found a data sheet for it yet.
waterlubber2 years ago
Cool. But wouldn't it be easier just to use the blain old MP3 player?
A: Yes, but it wouldn't be as nearly as fun! (Those look like iPod Nanos...)
they actually look like copies of the old ipod shuffle. but not nano's
EttoreL2 years ago
Still no datasheet? Could be a read dvance in using this so cheap IC. Bye. Ettore
Robot Lover2 years ago
This is really interesting! I would suggest though to use transistors instead of the chips to make it more simple. Transistors are much more common components then the TS5A3159.
dresch (author)  Robot Lover2 years ago
Yes, that is probably possible. You might want to try a FET first. A couple of things to keep in mind if you are going this route. There is a 2.5us long square pulse every 10ms on the common bulls-eye of NEXT, PLAY, PREV. There is another 3.5us long pulse every 10ms on the bulls-eye of VOL-. VOL+ bulls-eye is always pulled high. Somehow the MP3 chip uses these three signals to tell which key is pressed... These signals must be left at a high impedance until the switching is to take place. Even several kohms to ground on these signals will cause odd effects. These signals don't like a lot of capacitance to ground either.

My next version is going to use a single 74HC244 kept in high impedance mode until the switching takes place. I will post it if it works. Should be simple and cheap. And easier to find than the wonderful TS5A3159.

(If someone can find the data sheet for the LC2093-B, that would really help.)
That is very unusual to here about the pulses. Well, I will keep my eye out for the datasheet you need!
dresch (author)  Robot Lover2 years ago
There are a couple of things I would like to see in that datasheet! The chip seems to assume that if the system voltage is 5V then it is plugged into the USB and if its around 3.3V, then it is running on battery and should be playing music. There are probably some neat tricks you could do with it, if you had the data.
Ugifer dresch2 years ago
This is just an idea, but I think some of the features of this system may be linked:

You say that you can't press the buttons at "microprocessor speeds" and from the code it looks like you use 100ms presses. My guess is that you could reduce this to 20-30ms, or maybe nearly down to 10 but no lower. I think it's waiting to see if it gets one of your short high pulses.

What I think happens is that when you ground red or purple, the chip waits for at least 10ms to see if it gets one of the short pulses that would indicate connection to the common orange line. If it gets no high pulse in that time then it assumes connection to ground. If it gets a 2.5 us high pulse in the first 10ms then it assumes next or prev is pressed. Not too sure how that squares with 3.5 us pulse on red, but of course there is a connection that can't be made with that keypad - red to purple - so it could be for detecting that (I wonder what that would do).

Have you tried applying a 2.5 us pulse to vol up or vol down during the first 10 ms of holding it low? I would try a repeat of LOW for 5ms, HIGH for 2.5um, LOW for 5Ms etc for a few reps and see what happens. If you are lucky, you will be able to dispense with the switch chip and with those two control lines and just use vol + & - to control track step also. The issue might be whether you could easily generate a 3.3V "high" without messing up the signals. A level converter might be easier to source than the analogue switch chip thou'.

Anyway, just an idea - I will watch this project with interest as I wait for my shipment from HK!
Ugifer Ugifer2 years ago
PS I may not have a datasheet, but this looks like the pinout:

http://www.sztgmic.com/res/sztgmic/pdres/201107/20110721172252817.pdf
Ugifer Ugifer2 years ago
Not sure that it's right, although it is numbered LC2093 in the fig and it has the right sort of functions. If it is then all switches are accessible through one pin - pin 22 on the the 2093. Pulling this to ground through an appropriate resistor seems to give any function you might require - and then some.

I guess you would connect this pin to several Ardu' pins through appropriate resistors and set all but one to INPUT. Then set the pin you need to OUTPUT and pull down though the appropriate resistor. It seems to be working as a voltage divider against the 24K to 3V3 so whether you could fool it with one PWM pin and a capacitor I don't know!
kentso Ugifer2 years ago
I googled lc2093 +mp3 +iic and came to a russian repair site that claims to have a datasheet for it. unfortunately you have to sign up at the site and pass a small electronics test. remont-aud.net
Ugifer kentso2 years ago
I registered but what you get is the same schematic we already have. Ho Hum. Keep looking.
dresch (author)  Ugifer2 years ago
Awesome. Thanks for the link. What is really exciting about that schematic is that the chip seems to have an I2C interface built in. If we could get a data sheet, then we can probably control every function thru I2C and life as we know it would just be shiny and new. Data sheet, data sheet, data sheet. Please appear.

I did do some control of the NEXT and PREV using the pins on the Arduino. What I did was watch the 2.5us signal on the one side and then relay it to the other pin. Actually made a pretty good imitation. That did work, but because the Arduino was running at 5V and the MP3 was running at 3.3V, I did a two resistor voltage divider to knock the Arduino voltage down and that resistor to ground made the MP3 automatically change the volume. I gave up after a while, each time increasing the resistance of the divider.

Man if we could use the I2C, that would be just so cool.
Ugifer dresch2 years ago
Yeah. Looking at that diagram, it's using I2C to control the FM radio chip. So it must be acting at I2C master in that case. However, it has a RTC embedded and what's the point of that if you can't read it? So somehow it must be possible to read that RTC. Only sensible way would be through I2C - that's what many RTCs seem to use. And if you can do that you can almost certainly control all the funcitons through that little two-wire bus.

Even if we just knew it's 7-bit address we could mess about with the interface & might work out some functions, but without that I don't see any way in. I e-mailed them and asked for an English datasheet. Probably won't hear anything, but you never know - they might. I'll let you know if I get anything.
Ugifer2 years ago
Great idea!

These MP3 players are incredible value! £2.40 delivered from e-bay if you are prepared to wait for it to come from HK (I have plenty of projects on so no hurry here). I'd pay that just for the battery, and you get a free mp3 player & ear-buds thrown in!

In about 6-weeks when it arrives, I will be trying this!
dresch (author)  Ugifer2 years ago
Yes, its one of those "build a big screen TV from parts found in your toaster" kind of things. I hope to have a simple shield design posted in a few days... or at least by the time your MP3 players arrive. :-)
Do you think I can use this in my current project (a music glove)? I'm using pressure sensitive resistors in each finger that will trigger a programmed sound within my arduino code. I don't know if this will work well with my glove or do I even need this to do what I'm planning. Great instructable btw.
dresch (author)  midknight50002 years ago
Well it depends on the speed in which you need the sound to follow the actuation of the glove. So if it needs to be in a couple of milliseconds, this won't work. If it can be in 100s of milliseconds that would be fine. The individual files are stepped to, not accessed directly. If you had ten files (one for each finger) you would have to step up or down a mximum of five files to get to the one you wanted.
Having the arduino generate tones using the internal pwm or a timer interrupt would be orders of magnitude faster. Thanks and good luck with your project.
diy_bloke2 years ago
Cool!