Music Player With Esp8266 and DFplayermini Via Serial Monitor .
by abhejitsaha in Circuits > Microcontrollers
39 Views, 0 Favorites, 0 Comments
Music Player With Esp8266 and DFplayermini Via Serial Monitor .
This tutorial demonstrates how to build a basic music player using the ESP8266 and DFPlayer Mini. The main goal is to understand the basics of the DFPlayer Mini and test its functionality via Serial Monitor .
Supplies
- ESP8266
- DFPlayer Mini module
- 0.96-inch OLED display (SSD1306, I2C interface)
- Micro SD card (formatted as FAT32)
- Speaker (3W recommended)
- Connecting wires
- Breadboard
- USB cable for programming the ESP8266
Understanding the DFPlayer Mini
The DFPlayer Mini is a small MP3 player module with the following features:
- Plays MP3 and WAV files from a micro SD card.
- Supports a variety of control methods, including UART (Serial Communication), AD key, and IO control.
- Provides stereo output through DAC.
- Works with a wide range of microcontrollers.
Key pins of the DFPlayer Mini:
- VCC and GND: Power supply pins (3.3V to 5V).
- TX and RX: Serial communication pins.
- SPK_1 and SPK_2: Direct speaker output.
- DAC_R and DAC_L: Line-out for external audio amplifier.
Circuit Connections
Connect the components as follows:
ESP8266 to DFPlayer Mini
- DFPlayer VCC to ESP8266 3V3
- DFPlayer GND to ESP8266 GND
- DFPlayer RX to ESP8266 D4
- DFPlayer TX to ESP8266 D3
ESP8266 to OLED Display
- OLED VCC to ESP8266 3V3
- OLED GND to ESP8266 GND
- OLED SCL to ESP8266 D1 (GPIO5)
- OLED SDA to ESP8266 D2 (GPIO4)
Speaker Connection
- SPK_1 and SPK_2 to the speaker terminals directly.
Micro SD Card Setup
- Format the micro SD card as FAT32.
- Create a folder named MP3 (optional but recommended for better organization).
- Place MP3 files on the SD card and name them as 0001.mp3, 0002.mp3, etc., for sequential playback
Programming the ESP8266
Required Libraries
- DFRobotDFPlayerMini: For interfacing with the DFPlayer Mini.
- Adafruit_SSD1306 and Adafruit_GFX: For controlling the OLED display.
- Wire: For I2C communication.
- SoftwareSerial: For serial communication if needed.
Downloads
Testing the Setup
Upload the code to your ESP8266 using the Arduino IDE.
- Open the Serial Monitor at 115200 baud rate.
- Enter commands like:
- play 1: Plays the first track.
- vol 15: Sets volume to 15.
- pause, resume, next, prev, or stop.
This program provides basic control of the DFPlayer Mini via the Serial Monitor and oled display.
Done
This tutorial provides a hands-on introduction to using the DFPlayer Mini and OLED display with an ESP8266. You’ve learned to set up the hardware, program the microcontroller, and test the functionality of both the DFPlayer Mini and the OLED display for creating a simple music player.