DIY Wifi Audio Notifier for ESP8266: Play MP3, TTS & RTTL (Cloud-free)
Intro: DIY Wifi Audio Notifier for ESP8266: Play MP3, TTS & RTTL (Cloud-free)
In this project, I will show you how you can use NOTHING but an ESP8266 board like the Wemos D1 Mini and a simple audio jack to play MP3, TTS and RTTL .... CLOUD-FREE!
New to ESP8266? Watch my Introduction to ESP8266 video.
This is controlled over MQTT. You will be able to send it an MQTT message with the URL of the MP3 file and it will play it for it. It is also capable to doing basic TTS and playback RTTL (aka Nokia) ringtone.
STEP 1: Watch the Video
The video has step-by-step instructions that will guide you through the process. Feel free to add your questions in the comment section of the YouTube video if you need any futher assistance.
STEP 2: Order the Components
-- LINKS -- (When available, I use affiliate links and may earn a commission)
Amazon.com:
- ESP8266 module - https://amzn.to/3fx28Lq
- Amplifier shown in video - https://amzn.to/32drav2
- Audio jack with bare wires - https://amzn.to/2Zokkkr
AliExpress:
- Wemos d1 mini - https://s.click.aliexpress.com/e/_dXcNTYU
- Audio Jack with Bare Wire - https://s.click.aliexpress.com/e/_dVT9yWy
- Amplifier shown in video - https://s.click.aliexpress.com/e/_Bff4EpdO
Amazon (Canada):
- Wemos d1 mini - https://amzn.to/3fx28Lq
- A good audio amplifier - https://amzn.to/32drav2
- Audio jack with bare wires - https://amzn.to/2Zokkkr
STEP 3: Hardware
The hardware is very simple. You will need a Wemos d1 mini and an audio jack. Connect the left and right channel wires to RX pin on Wemos D1 Mini and the audio ground wire to the D1 mini GND pin.
STEP 4: Software
To load the software, download MrDIY_Notifier.bin
Step 1: Connect the Wemos d1 mini to your computer, open Tasmotizer, load the file you just downloaded, and flash it.
Step 2: When it is finished loading and restarting, connect to the wifi network called "MrDIY Notifier". The password is "mrdiy.ca".
Step 3: You should get a popup. If you don't, go to 192.168.4.1 and fill-in your wifi network name, password, MQTT server IP, and credentials. Click SAVE and connect back to your home wifi.
By using this bin file that I created, you can simply load the file directly to a Wemos D1 Mini. This eliminates the long process of having to download the code, update the wifi & MQTT credentials, download & install the libraries, configure esp8266 for Arduino, change the Arduino settings and then finally upload the code. However, if you wish to access the full source code, it is available on my MrDIY Gitlab page.
** UPDATE **
I added support to custom MQTT topic in the source code, so check my gitlab page. If you are a Pateron, check my page, I posted the updated bin file there as a thank you for your support!
STEP 5: Commands
Here is the full list of commands you can use. You can also subscribe to the /mrdiynotifier/status topic to get status updates.
- Play MP3 MQTT topic: "/mrdiynotifier/play" MQTT load: http://url-to-the-mp3-file/file.mp3 - Play Icecast Stream MQTT topic: "/mrdiynotifier/stream" MQTT load: http://url-to-the-icecast-stream/file.mp3 - Play Ringtone MQTT topic: "/mrdiynotifier/tone" MQTT load: RTTTL formated text, example: Soap:d=8,o=5,b=125:g,a,c6,p,a,4c6,4p,a,g,e,c,4p,4g,a - Say Text MQTT topic: "/mrdiynotifier/say" MQTT load: Text to be read, example: Hello There. How. Are. You? - Change Volume MQTT topic: "/mrdiynotifier/volume" MQTT load: a double between 0.00 and 1.00, example: 0.7 - Stop Playing MQTT topic: "/mrdiynotifier/stop" To get status: - The notifier sends status update on this MQTT topic: "/mrdiynotifier/status" "playing" either paying an mp3, streaming, playing a ringtone or saying a text "idle" waiting for a command "error" error when receiving a command: example: MP3 file URL can't be loaded "connected" device just connected to MQTT server - The notifier plays a 2 second audio clip when it is first booted and connected to Wifi & MQTT
STEP 6: Home Assistant & NodeRED
At this stage, you should have everything setup, loaded, and ready to accept MQTT messages. You can now use your the home automation program of your choice, such as Home Assistant or NodeRED, to send the audio notifier MQTT messages. Check the screenshots above for examples that show you how to do a simple daily alarm at 7AM for both Home Assisant and NodeRED.
STEP 7: Done
You are done! You can now use this notifier to play MP3, TTS & RTTL tones cloud-free and control it locally over MQTT.
If you found this useful, please consider subscribing to my YouTube channel - It helps me a lot.
If you are interested in supporting my work, you can check my Patreon page.
Much of the information contained is based on personal knowledge and experience. It is the responsibility of the viewer to independently verify all information.
47 Comments
skakooli2 4 weeks ago
Hi.
I built your project.
When i'm trying to play mp3 file, i have loud white noise.
The Wemos D1 is connected to Herdio power amplifier which connected to passive speaker.
Actions i tried to do so far:
I'm trying to play the song from HomeAssistant local folder as you did.
any advice?
Housertelmstein 2 months ago
I built the project like you. The say command works perfectly but the play command doesn't. It doesn't matter whether I try http or https. When I enter the URL in the browser it works immediately
accarien1 5 months ago
"/mrdiynotifier/say hello"
works but i'd like to play a mp3
The command :
/mrdiynotifier/play https://lasonotheque.org/UPLOAD/mp3/2093.mp3
doesn't works, i have the following message on /mrdiynotifier/status/ topic :
"https://lasonotheque.org/UPLOAD/mp3/2093.mp3
error
idle"
What am i doing wrong please ?
accarien1 5 months ago
FrankMoss 1 year ago
Thanks for your work! That's amazing
I have same ikea speaker and I'm trying to use another esp8266 to power it on and turn volume up and I'm having some problems. I can power it on but I don't know how to turn volume up (to a value I want). I don't know if you can help me.
Thanks!
SQA 1 year ago
This is a really awesome project!
Is it possible to use a public broker instead of creating a server yourself?
I can't seem to get a connection via the public broker iam using...
kevinedward3746 1 year ago
justnickname 1 year ago
yothatsm3 2 years ago
florisdg 2 years ago
b. I have a WiFi address for it
c. I have downloaded the MrDIY_Notifier.bin and software Tasmotizer to my Windows10 computer.
d. I connect the wemos mini d1 via USB cable to my computer
e. I start Tasmotizer.
f. I see as port COM5, which is the standard com port for "serial connection via bluetooth"?
g. I fill in the Bin file
h. I press button "Tasmotize!
i. I get an the Error "Write Time Out" or "Permiission error, Access denied"
What do I do wrong and what is the solution? Please advise?
MrDIYLab 2 years ago
florisdg 2 years ago
tony_wk 2 years ago
A question: Seems multiple access to the same mp3 on my internet web server causes a lot of breaks of the music on every client. I placed the mp3 in my web server html directory. I connected 1 esp8266 playing the music while I opened a brower to play the same file, break occured. I wonder if there is a way to solve this.
sunset_ita 2 years ago
MrDIYLab 2 years ago
BTW, the boot sound is built-in and is not loaded from a server.
Jack-123 2 years ago
error: 'class iotwebconf::IotWebConf' has no member named 'addParameter'
iotWebConf.addParameter(&mqttTopicParam);
'IotWebConfParameter' does not name a type
MrDIYLab 2 years ago
Schmurtz 2 years ago
- ported to platformio
- can be compiled for ESP8266 and ESP32
- Google Translate TTS added (so a little less "cloudless" but multilingual and better voice than the included ESP8266SAM)
- This code also allows to switch easily between no DAC (version used by mr DIY) , external DAC or internal DAC (for ESP32).
- You'll also find some useful comments for wiring your DAC quickly or to improve the code.
https://github.com/schmurtzm/MrDiy-Audio-Notifier
I still have some bugs related to the compatibility of the ESP32 with of the ESP8266Audio library (these bugs are described in the github's readme, help is welcome ;) )
harishjachak 2 years ago
After some searching and a headache found this solution that worked for me. https://github.com/Hypnos3/node-red-contrib-cast/i...
The idea is to serve an mp3 file directly from Node-Red using an HTTP node. So you need to add a flow of three nodes anywhere in NodeRed and your local mp3 file path will be 'converted' to a HTTP request, which works very well in this project. Attached are screenshots of my nodes config.
MrDIYLab 2 years ago