M5Stack/ESP32 Internet Radio with ANNEX32-RDS
An internet radio based on M5Stack-Hardware programmed with an ANNEX32-RDS BASIC-script
The ESP32-based M5Stack is equipped with an LCD screen, three hardware buttons and a speaker connected to pin 25 of the digital/analog output of the ESP32. I played a little with the MP3 streaming capabilities of ANNEX32-RDS on this M5Stack hardware.
It works well, although the internal sound of the M5 is a bit scratchy and prone to WLAN interference. This seems to be due to the lack of sufficient filtering and decoupling of the 3V3 supply, as my experiment with a separate ESP32 nodeMCU has shown.
With an external I2S digital-to-analog converter the sound works fine.
But for the small amount of hardware and a simple ANNEX32 BASIC script it works fine.
In version 1 you can select one of three internet radio stations with the three M5Stack hardware buttons or via the web interface.
The links for the MP3 streams may have expired. At the moment the PLAY.NETWORKS command from ANNEX32 cannot follow a forwarding URL - but the developer has announced a solution for this in the upcoming beta version. (UPDATE: New ANNEX32-Version available at https://cicciocb.com/forum/viewforum.php?f=5 9
The script will work on M5Stack with ANNEX32-firmware but also on other ESP32-boards e.g. ESP32-NodeMCU. or the M5Stack ATOM ECHO.
ANNEX32 can use the internal DAC or any external I2S-DAC, which will produce a much better audio quality.
For own experiments: The buttons at pin 37,38,39 of the M5 do a pulldown when pressed.
It works well, although the internal sound of the M5 is a bit scratchy and prone to WLAN interference. This seems to be due to the lack of sufficient filtering and decoupling of the 3V3 supply, as my experiment with a separate ESP32 nodeMCU has shown.
With an external I2S digital-to-analog converter the sound works fine.
But for the small amount of hardware and a simple ANNEX32 BASIC script it works fine.
In version 1 you can select one of three internet radio stations with the three M5Stack hardware buttons or via the web interface.
The links for the MP3 streams may have expired. At the moment the PLAY.NETWORKS command from ANNEX32 cannot follow a forwarding URL - but the developer has announced a solution for this in the upcoming beta version. (UPDATE: New ANNEX32-Version available at https://cicciocb.com/forum/viewforum.php?f=5 9
The script will work on M5Stack with ANNEX32-firmware but also on other ESP32-boards e.g. ESP32-NodeMCU. or the M5Stack ATOM ECHO.
ANNEX32 can use the internal DAC or any external I2S-DAC, which will produce a much better audio quality.
For own experiments: The buttons at pin 37,38,39 of the M5 do a pulldown when pressed.
Updates van de auteur
PeterN 5 jaar geleden
and show the IP-adress of the M5 on the display
Stepdes 5 jaar geleden
I have tried this with a a ESP32S board, i also have a PCM5102 board.
When i listen on pin 22 and gnd with a headphone i hear music, so the script is working.
How do i connect the PCM5102 board and do i need to change the script?
Thnx
PeterN 5 jaar geleden
you see theese lines in the beginning of the code:
play.setup 0,64
'play.setup 1,64 ' external DAC, max Buffer
Second line is for external DAC and commented out at the moment with '
Change that to
' play.setup 0,64
play.setup 1,64 ' external DAC, max Buffer
And after a powerdown of the module the next start should be with digital output.
Look at he help file of annex32 with F2-Key while you are in the script.
There you will find a description of wiring PCM5102. But i found there is a twist of to pins there!
I found a different connection scheme than in the ANNEX help file. The LCK/LRC- and BCK/BCLK- pins at the ESP32 appear to be reversed.
This works here on my board for ESP32 and PCM5102A:
Lck <--> ESP32 GPIO26 (helpfile says wrongly IO05 is LRCK)
BCK <--> ESP32 GPIO05 (helpfile says wrongly GPIO26 is BCLK)
Din <--> ESP32 GPIO02 (OK)
VCC <--> ESP32 V5 (5Volt)
FLT, DMP, SCL, FMT <--> ESP32 GND
XMT <--> 3V3
I append a foto that shows my ESP32Board and a PCM5102A
I hope that will help you.
Good luck and stay save!
PETER