Introduction: DIY Wifi Audio Notifier for ESP8266: Play MP3, TTS & RTTL (Cloud-free)

About: I am a techie DIYer who loves tinkering with electronics. Twitter @MrDIYca. For more info and my full contacts, please visit www.MrDIY.ca

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.

Audio Challenge 2020

Participated in the
Audio Challenge 2020