Play Audio With ESP8266 & Df Mini Player: Electronic Hymn
Control df mini player with esp8266
Things used in this project
Software apps and online services
Hand tools and fabrication machines
Soldering iron (generic)
Solder Wire, Lead Free
PCB Holder, Soldering Iron
Recently I was going through a GitHub repo ESP8266 audio by earliephilehower which allows you to play audio files via I2S, DAC or with just a transistor and speaker. I did not have an I2S DAC or a regular DAC, the only viable option was to use a transistor and speaker, but according to him it is better not to go that route; due to this, I just opted for an easy option, that is to use DF mini mp3 player. Easy ways are sometimes crooked as the quote goes
It is because they took the easy way out that why rivers, and people, go crooked Jill Peterson
But I decided to be crooked for this project.
About the Schematic Diagram
The connections are simple and few, so this shouldn't give any difficulty soldering. There is a design flaw in this circuit that also serves as a security measure. The node MCU gets power via its VIN pin; however, its micro USB port is not connected to the VIN pin, so if you power the board via its micro USB port when trying to upload code the mp3 board will not get power but they share a common ground and the TX pin of Serial1 of the node MCU is connected to the Mp3 module, so when you try to power the board via its micro USB port, the Mp3 module will try to pull power from the TX pin which will render the node MCU unable to enter download mode for code upload. With this feature😁 no one can change or re-upload a new code to your node MCU unless they know if this feature😁. A workaround is to upload the code before adding the node MCU to the circuit or power both the mp3 and the node MCU like this
If the so-called security feature confuses you, you don't have to understand it to build this project; just ignore it.
NOTE: To power the whole circuit you only need to connect the micro USB port on the Vero board to 5v and that is all, but If you want to upload code while the node MCU is part of the circuit you will have to plug in both micro USB ports.
If you want to create a professional PCB rather than do it by hand like me, you can download the Gerber file from here.
Uploading Code and Other Files
Before you upload the codes you would need some libraries. To download the libraries, in your Arduino IDE, navigate to sketch>include library> manage library, then type in DF mini player and download the one by Makuna
, also download ArduinoJSON by Benoit Blanchon
You can find the code for this project in my GitHub repository You will also need LittleFS uploader for Arduino, to get it, go to this repository by earlephihower. hmm, this is the second time his name has been mentioned. The repository contains instruction on how to install and use it. After you have done that open ehymn2 folder, it is part of the items you get when you clone my GitHub repository, after you have opened the folder, open the ehymn2.ino file with Arduino IDE ( make sure you do not use Arduino 2.0 as it doesn't support tools like the LittleFS uploader), navigate to tools and click on ESP8266 LittleFS Data Upload, after the LittleFS data upload is complete upload the code.
Accessing the Audio Files
The audio files would obviously be stored on the SD card, must be in a folder called MP3,
and be named in four figures i.e the number, one should be written as 0001, 10 would be written as 0010, the same applies for all numbers. The file names must be four-digit numbers.
Why Did I Create an Electronic Hymnal?
Before I go on, I want to talk about why I created this e-hymnal. I can be a very lazy person to the extent that I attend church on Sunday in the evening while most people go in the morning, but the downside to this is that the choir comes to church in the morning, so the people present have to sing, and it doesn't end well and kills the vibe in the church, so the engineer in me decided to take up the challenge and build an electronic hymnal. My intention when building this e-hymnal was not to replace the choir but to assist in their absence, as a result, this e-hymn is not sophisticated enough to replace the choir.
You might not be religious or christian in any way, but you could repurpose the knowledge you will gain from this article to build something else, for example from this article you will learn how to play mp3 files with df mini mp3 player module, how to create a webserver with esp8266 etc.
P.S. It was my school choir.
How to Use the Device
If you have successfully created the circuit and uploaded the code and the other files using LittleFS data upload, then the next step is to connect to the device via WiFi.
During the first use, the name of the device is Ehymn and the password is 12345678. Connect to it and then open any browser of your choice and type in ehymn.com and you will be greeted with this webpage.
The four text boxes you see at the bottom of the image above are where you insert the hymn numbers of the hymns you want to play for entrance, offertory, communion and closing period in the church. After you submit the form you will be taken to the controls page.
This page is self-explanatory the buttons tell you what exactly to do. The last page Change password allows you to change the device name and password. Whatever name you chose for the device _E-hymn will be appended to it.
I saw a problem in the church and tried to solve it, so I am challenging you guys👷️ to try to solve everyday problems you find around you no matter how little as far as it is helping someone or some people. That is all for this article, thank you for reading.
Ehymn code and files
The article was first published in hackster, September 30, 2022
author: Pius Onyema Ndukwu