🛑 This project is no longer in use. You may check its successor: yet-another-internet-radio-ESP32 🛑
Another semi-decent internet radio, based on VS1053 decoder and ESP8266 MCU, made from scratch solely for my midnight engineering sessions.
It plays anything that VS1053 may decode.
See it live here:
- a streaming media player built with ESP8266 MCU, VS1053 for mp3 decoding and 1 Mbit buffer;
- time update from
pool.ntp.org
(no RTC); - current time shown with big fonts during stand-by;
- clock, stream title, current song, bitrate, wifi level, buffer level shown during playback
- up to 196kbps bitrate streams;
- configurable via wifi using WiFiManager by Tzapu;
- current radio station saved into EEPROM;
- auto-reconnect to stream if connection is lost
- voice feedback (or any other mp3 played at certain moments)
The station list is stored into a remote hosted JSON file: irconfig.dat.
Please note there are some Romanian comments left into the source. I'll try to clean it up.
Where it all started: Arduino WebPlayer by Vassilis Serasidis done with an Arduino Pro Mini.
Could not be easier: Everything works at 3.3V, except the 20x4 lcd (5V power & data) that needs the level shifter.
- WeMos NodeMcu with ESP8266: $10 ; you will need access to all ESP8216 pins. The LCD is very small and not really useful.
- VS1053 breakout: $15 - it was buggy;
- 23LC1024 breakout: $15 - unexplainable expensive since you may find a $2 SO8 package
- 2x3W PAM8403 amplifier: $1.5 - noisy, not recommended;
- 12V power source: $14
- step down converter: $1
- 20 x 4 alpha lcd with i2c expander - $10
- level shifters and switches (less than $5)
So practically the player is made-in-China.
Note about the VS1053 breakout: The mp3 shield was intended to work with Arduino Uno (5V). Wiring it directly to ESP8266 (3.3V) could damage it. The mp3 shield did not work properly via a level shifter, due to faster data transfers, so it had to be modified to work directly at 3V.
There are many approaches on internet, but none worked for me, so I had to build it from scratch.
- minimum working program: a media player with no interface. The wifi user/pass and station are hardcoded. Just to understand the working principle.
- full app -- big and not really convenient to understand
- some tools you may need for hardware check
It plays fine up to 196 kbps streams; the screen update is blocking the MCU for a few ms, so it won't play higher bitrate streams. With all lcd and serial commented out, it may play up to 320 kbps streams.
The web radio uses WifiManager by Tzapu'. In case it cannot connect to the last known hotspot, it enters config mode. You can force entering config mode by holding Button1 during startup.
The station list is held into a JSON file, stored remote: irconfig.dat. The config file URL is entered in config mode. If you're using cPanel to host the configuration file, it should not be named with .json extension, since cPanel is caching it weirdly.
Do not leave Enter/New line
chars in your json, or ArduinoJson library may crash.
- How to parse MP3 Streams
- the VS1053 board I was using
- Adafruit VS1053 library
- VS1053 datasheet
- What is the circular buffer
- working with 23LC1024 from ESP8266
- 23LC1024 datasheet
- how to use PROGMEM
- one AnalogIn, multiple buttons
- computing multiple voltage dividers
- how to make SD class coexist with SPIFFS and (esp8266/Arduino#2281 (comment))
- custom character generator
- online json editor
- to fix some ESP8266 crashes after connection to stream
- add bass/treble control by VS1053
- add MIDI playback
- add mp3 playback from LAN