Arduino controlled DFPlayer mini playing mp3's sequentially
Simple Button that, when pushed, plays the next mp3 on the SD card via a DFPlayer Mini and Arduino. (Based on the button example and examples of DFPlayer mini.)
-
Using the next command from the "DFRobotDFPlayerMini.h" library just resulted in random play.
- Solution: Use
myDFPlayer.playFolder(folder_number, song_number);
- Solution: Use
-
Using a DFPlayer mini purchased on Amazon - Lacking functionality, could not get it to read file counts in the folder and it would just return -1.
- Solution: Buy from a reputable store, such as arduino.cc
-
Not understanding the naming conventions - Resulting in random play.
- Solution: Choose and follow one of these naming conventions:
- In folders numbered 01 – 99. File names with 3 digit prefixes 001 – 255. Command 0x0F
- In a folder named MP3 (or perhaps mp3). File names with 4 digit prefixes 0001 to 3000. Command 0x12
- In the root directory. File names with 4 digit prefixes 0001 to 3000. Command 0x03
- In folders named 01 – 15. File names with 4 digit prefixes 0001 – 3000. Command 0x14
- Solution: Choose and follow one of these naming conventions:
-
Accidentally connecting to PIN3 (instead of PIN2) on the board, would still work 90% of the time but would also activate double with one button push, and also activate if I shook the Arduino.
- Solution: Connect to the correct PIN.
-
Hidden "." files and folders when using Mac, some of them couldn't be deleted.
- Solution: Reformat the SD card each time I added things or deleted them - deleting files was a big no-no.
Note: Be aware that deleting anything on the SD Card might create a .Trashes file, which can only be deleted by reformatting the card.
Open Terminal and run the following commands:
-
sudo diskutil list
- This should display something like the following for the SD card:
/dev/disk4 (internal, physical): #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *31.9 GB disk4 1: DOS_FAT_32 NO_NAME 31.9 GB disk4s1
-
sudo diskutil eraseDisk FAT32 MUSIC MBRFormat /dev/disk4
*Then you need to erase .Spotlight-V100 and .fseventsd:
-
sudo mdutil -d "/Volumes/MUSIC"
-
sudo mdutil -X "/Volumes/MUSIC"
-
rm -rf /Volumes/MUSIC/.fseventsd
*Remove any other .files that have snuck on:
dot_clean -m /Volumes/MUSIC