Git Product home page Git Product logo

esp-idf-dfplayermini's Introduction

esp-idf-DFPlayerMini

DFPlayer - A Mini MP3 Player For ESP-IDF.

ESP32 has I2S output function.
By using ESP-ADF and I2S amplifier, MP3 files can be played.
However, ESP-ADF is esoteric and also depends on a specific version of ESP-IDF.
Also, for ESP32C2, I can't find any mention of I2S.

I made this for the purpose of playing MP3 files more easily.

I ported from here and used this component.

Software requirements

ESP-IDF V4.4/V5.x.
ESP-IDF V5.0 is required when using ESP32C2.
ESP-IDF V5.1 is required when using ESP32C6 and ESP32H2.

Hardware requirements

DFPlayer - A Mini MP3 Player For Arduino.
https://www.dfrobot.com/index.php?route=product/product&product_id=1121

Installation

Copy all the contents of mp3Data to the SD card.
Insert the SD card into the player.

git clone https://github.com/nopnop2002/esp-idf-DFPlayerMini
# mount your SD card
cp esp-idf-DFPlayerMini/mp3Data/* your_SD_card
# unmount your SD card and insert the SD card into the player
cd esp-idf-DFPlayerMini/GetStarted
idf.py menuconfig
idf.py flash

Configuration

config-top

config-DFPlayerMini

Wiring with built-in amplifier

ESP32 DFPlayerMini Speker
3.3V -- VCC
GPIO4(*) -- RX
GPIO5(*) -- TX
SPK+ -- Speaker+
GND -- GND
SPK- -- Speaker-

(*) You can change it using menuconfig.

The built-in amplifier of this module is very sensitive to noise.

Typical circuit
ESP32-DFRobot-DFPlayer-Mini-1

Wiring with an external amplifier

ESP32 DFPlayerMini AMP
3.3V -- VCC -- VCC
GPIO4(*) -- RX
GPIO5(*) -- TX
DAC_R -- Right Channl Input
DAC_I -- Left Channl Input
GND -- GND -- GND

Typical circuit
ESP32-DFRobot-DFPlayer-Mini-2

Micro SD Card

I've tried several different brands of SD cards and some don't work.
I get this error.
I fixed it by replacing the SD card with another brand.
It's probably related to the power consumption of the SD card.

received:7e ff 6 3b 0 0 2 fe be ef
Card Removed!

About sample mp3 data

I borrowed from here.(Japanese site)
This is a typical alarm used in elementary and junior high schools in Japan to announce the start and end of classes.
https://otologic.jp/free/se/school_bell01.html#google_vignette

API

//----Mp3 play----
DF_next();  //Play next mp3
DF_previous();  //Play previous mp3
DF_play(1);  //Play the first mp3
DF_loop(1);  //Loop the first mp3
DF_pause();  //pause the mp3
DF_start();  //start the mp3 from the pause
DF_playFolder(15, 4);  //play specific mp3 in SD:/15/004.mp3; Folder Name(1~99); File Name(1~255)
DF_enableLoopAll(); //loop all mp3 files.
DF_disableLoopAll(); //stop loop all mp3 files.
DF_playMp3Folder(4); //play specific mp3 in SD:/MP3/0004.mp3; File Name(0~65535)
DF_advertise(3); //advertise specific mp3 in SD:/ADVERT/0003.mp3; File Name(0~65535)
DF_stopAdvertise(); //stop advertise
DF_playLargeFolder(2, 999); //play specific mp3 in SD:/02/004.mp3; Folder Name(1~10); File Name(1~1000)
DF_loopFolder(5); //loop all mp3 files in folder SD:/05.
DF_randomAll(); //Random play all the mp3.
DF_enableLoop(); //enable loop.
DF_disableLoop(); //disable loop.

//----Read imformation----
printf("%d",DF_readState()); //read mp3 state
printf("%d",DF_readVolume()); //read current volume
printf("%d",DF_readEQ()); //read EQ setting
printf("%d",DF_readFileCounts()); //read all file counts in SD card
printf("%d",DF_readCurrentFileNumber()); //read current play file number
printf("%d",DF_readFileCountsInFolder(3)); //read fill counts in folder SD:/03

For more info

https://www.dfrobot.com/wiki/index.php/DFPlayer_Mini_SKU:DFR0299

esp-idf-dfplayermini's People

Contributors

nopnop2002 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

esp-idf-dfplayermini's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.