The DF Mini Player IC can be used to play mp3 audio files when triggered by the Microbit.
Using audio editing software such as Audacity, or online alternatives such as Twisted Wave, sound snippets can be stored as mp3 files on a micro SD card, which is then inserted into the DF Mini Player.
Using audio editing software such as Audacity, or online alternatives such as Twisted Wave, sound snippets can be stored as mp3 files on a micro SD card, which is then inserted into the DF Mini Player.
Files should be named 0001.mp3, 0002.mp3, etc.p3, 0003.mp3, et
Files should be named 0001.mp3, 0002.mp3, etc.p3, 0003.mp3, et
https://www.dfrobot.com/product-1121.html?search=navigation&description=true
Product Wiki:
https://wiki.dfrobot.com/DFPlayer_Mini_SKU_DFR0299#target_0
INTRODUCTION
Sing for the moment! The DFPlayer Mini is a small and low-cost MP3 module player with a simplified output directly to the speaker.
The DFPlayer mini standalone can be used as a stand-alone module with an attached battery, speaker, and push buttons or used in combination with an Arduino UNO or any other with RX/TX capabilities.
This dfrobot mp3 player perfectly integrates the hard decoding module, which supports common audio formats such as MP3, WAV, and WMA. Besides, the dfplayer mini mp3 player module also supports TF card with FAT16, FAT32 file system. Through a simple serial port, you can play the designated music without any other tedious underlying operation
Connections:
Vcc----->3.3V
Vcc----->3.3V
GND------>GND
GND------>GND
SPK_1, SPK_2-------> 3 watt mini speaker
SPK_1, SPK_2-------> 3 watt mini speaker
TX------>Microbit Pin 0
TX------>Microbit Pin 0
RX------>Microbit Pin 1
RX------>Microbit Pin 1
Microbit Extension: DF Mini
NOTE: The folder name needs to be mp3,
placed under the SD card root directory, and the mp3 file name
needs to be 4 digits, for example, "0001.mp3",
placed under the mp3 folder.
---------------------------------------------------------
Arduino:
Include Libary: DFRobotDFPlayerMini
#include "Arduino.h"
#include "DFRobotDFPlayerMini.h"
#if (defined(ARDUINO_AVR_UNO) || defined(ESP8266)) // Using a soft serial port
#include <SoftwareSerial.h>
SoftwareSerial softSerial(/*rx =*/4, /*tx =*/5);
#define FPSerial softSerial
#else
#define FPSerial Serial1
#endif
DFRobotDFPlayerMini myDFPlayer;
void printDetail(uint8_t type, int value);
void setup()
{
#if (defined ESP32)
FPSerial.begin(9600, SERIAL_8N1, /*rx =*/D3, /*tx =*/D2);
#else
FPSerial.begin(9600);
#endif
Serial.begin(115200);
Serial.println();
Serial.println(F("DFRobot DFPlayer Mini Demo"));
Serial.println(F("Initializing DFPlayer ... (May take 3~5 seconds)"));
if (!myDFPlayer.begin(FPSerial, /*isACK = */true, /*doReset = */true)) { //Use serial to communicate with mp3.
Serial.println(F("Unable to begin:"));
Serial.println(F("1.Please recheck the connection!"));
Serial.println(F("2.Please insert the SD card!"));
while(true){
delay(0); // Code to compatible with ESP8266 watch dog.
}
}
Serial.println(F("DFPlayer Mini online."));
myDFPlayer.volume(10); //Set volume value. From 0 to 30
myDFPlayer.play(1); //Play the first mp3
}
No comments:
Post a Comment