I am working on a project where I want to be able to play a few short and low-quality mono sound clips. I did some research and came across a couple of options:
PCM library to play directly from the microcontroller. It looks like it only supports Uno and I'm hoping to use Pro Micro (ATMega32u4 based, more or less equivalent to Leonardo, I guess). And it uses a timer on the microcontroller, which might have conflicts with other libraries or causing timing issues with servo and motor logic. An async mechanism would be ideal.
YX5300. It looks like it'll be sufficient. But it's definitely an overkill for me. I'm hoping to find something even smaller and less powerful. I don't really need mp3 decoding. I can store wav files. I also don't need it to be able to drive a speaker. My speaker is powered and has an NPN transistor connected.
leave the speaker off the card and just use the 1/8" (3.5mm) jack to drive your speaker. The type of file isn't going to impact the card size, power, or programing, you might not have a choice between mp3/wav.
I'm not familiar with what's been suggested so far, so this may be overkill or underkill. Have you looked at DFPlayer ? I've used this a number of times and is really easy to use.
How do you mount the DFplayer? Its got to be mechanically sound to withstand repeated sd insert/removals. With no mounting holes you either have to design a PCB or have it floating at the end of a clump of duponts. Perhaps epoxy it down?
Electrically and software wise it might be simple, but if I can't build without a PCB its not really suitable for a low to medium volume product. I'm trying to plug & chug with COTS parts, as few manual assemblies (soldering specifically) and custom parts as possible. I suppose for an embedded product that never needs to change the sd its ok, but how do you put that module into a user accessable device?
This module has the sd card inserted in the side. You wind up having cables from two directions and need access from a third with the mounting holes only 2mm. 3D printed holder was (failed) attempt at easy access.
I solder it to a PCB that can be mounted soundly. The miniSD card is easy to insert / remove.
Maybe I missed something, but the OP was just looking for ideas and didn't ask anything about creating a medium volume product. In that case, it may not be the best option.
No you're right. But I'm STILL looking for a solve for MY product and I was hoping to hijack the thread if there was a better part than the DF one for the reasons mentioned.
Thanks for the suggestion. I came across it from my Google searches but there wasn't too much mentioning. Now you've suggested, I went ahead and read reviews on Amazon and it seems to be a solid product. It looks small enough that I can solder it on a perf board next to the microcontroller. I just ordered one from Amazon and will play with it a little. Thanks!
It doesn't build out of box if I choose Leonardo. I did some searching and came across this: Playing sound on Arduino Leonardo which provided some general directions instead of working code. I understand the gist but don't have enough knowledge about these two MCUs or firmware in general to come up with a fix. Have you managed to make it build? Thanks!