I am trying to build a simple box that has a few buttons on it. I would like 2 or 3 of the buttons to trigger a specific sound file stored on a DFPlayer pro module. I would like 2 of the buttons to control the volume. It would be nice to do all of this with just the module but I do have access to an Arduino UNO if necessary.
I have found lots of code examples but most of them seem to be for the original DFPlayer Mini and the official documentation mentions using an ADKey module, but it doesnt mention the functionality of triggering specific files like it does with the original Mini.
So my first questions are:
Can DFPlayer Mini code be used on a DFPlayer pro?
Is an ADKey module the only way to trigger these behaviors or can regular buttons be used with the required resistors? If not directly through the module perhaps through the arduino first?
Are the same ADKey functions available on both boards or at the least is it possible to trigger specific files on the Pro?
What is the difference between the regular speaker output and the DAC outputs? Which situations would you use which?
Thanks in advance! This is my first actual Arduino project so I'm still figuring out basically everything.
Last time I looked, the answers to all that and more were up on the DFRobot site. I have mini’s, went with serial control, response feedback lets the sketch handle error condition.
Nothing I could post can add to the available docs.
If the requirement is “button A plays sound1, button B plays sound2, button C plays sound3”, then a microcontroller such as an Arduino Uno is required to send commands to the module through its serial interface as standalone mode does not allow mapping individual buttons to specific sound files. The buttons only control navigation through the playlist and trigger predefined actions such as play/pause, next track, previous track, or volume change.
So then it's just a matter of using the library @UKHeliBob referred to and you can use Ione of the numerous button library such as Button in easyRun or OneButton or Toggle or EasyButton or Bounce2, ... to handle the user interface without worrying about button bouncing etc.
Spent the day troubleshooting a totally different issue but it does look more limited than I thought. However, Next/Previous are potentially powerful ways to select specific files.
You’ll need quite smart buttons to know if they need to send play or one or two presses in one direction or another with shared memory between the buttons to remember which is the current song.
I’m sure it can be achieved with pure hardware components by smart hardware gurus but I’m a software guy and it really looks like a MCU + software solution will be much simpler to create, debug and maintain.
I agree. Its 'MCU-independent' functions fall well short of those of DFR's mSD player. I'd hoped to find and test my original module on which I based my first music box about five years ago, but so far in vain.
I quickly abandoned it for that project because its 128 MB capacity was too limiting, and ever since have used the mSD-based module. In the last year or two I've been using the atTiny85 with a mere five data pins. Using the module's AD and IO 'keys' has been very handy.
@badabingus
Despite the limitations discussed above, your player requirements sound very modest (two or 3 tracks to be played?) so you might want to experiment a little without an Arduino first.
EDIT Found it and wired up just two buttons: Play/Pause and Next. Reacts in about 1 sec.
My only issue with using the Next/Prev track method is I really would like the sounds to be specifically triggered by specific buttons.
The actual project is a little box that will play recordings of a cat that has passed away. I want each button to play different specific sounds (purring, meowing, howling for wet food) and I'd really prefer to just have a button for each specific recording as opposed to forcing the user to skip through tracks to find the one they want to hear.
The good news is I already designed my enclosure with tons of headroom so there's plenty of space for the arduino uno i have lying around collecting dust to fit and it seems like the code to call specific tracks is pretty easy, that is, once i actually figure out how to call the functions properly. I'm very much a hardware guy.
You can play selected files using Serial, I have done it with DFPlayer Mini’s using DFRobot docs. You might find solution code for it in the forum archives.