Experimenting IP radio on ESP32-WROOM-32D: not working!

Hi all

After making many devices with Arduino Nano and ATMega328P and a LED NTP clock with ESP8266, now I'm trying to make an IP radio using an ESP32-WROOM-32D. I'm starting from this code:

#include "WiFi.h"         // libreria wifi compresa nel pacchetto arduino-ESP32
#include "Audio.h"        // libreria audio-I2S https://github.com/schreibfaul1/ESP32-audioI2S
#define LED       5       // led sulla board e su gpio 5
char* ssid1 =     "***";  
char* password1 = "***";
#define STAZIONE  "https://icecast.unitedradio.it/Virgin.mp3" // web radio all'accensione 
Audio audio(true, I2S_DAC_CHANNEL_BOTH_EN);                   // usa i due DAC interni a 8 bit su gpio25=L, gpio26=R

void setup() {
  Serial2.begin(38400);                    // baud rate per BT
  pinMode(LED,OUTPUT);            
  WiFi.disconnect();                       // disconnette sessione wifi precedente    
  WiFi.mode(WIFI_STA);                     // imposta il modo stazione
  Serial2.print("Connessione a ");
  Serial2.println(ssid1);
  WiFi.begin(ssid1, password1);            // connette al wifi 
  while (WiFi.status() != WL_CONNECTED){   // aspetta la connessione al wifi
    Serial2.print(".");                    // stampa punti in attesa
    digitalWrite(LED,!digitalRead(LED));   // lampeggia in attesa
    delay(1000);
    }
  digitalWrite(LED,LOW);             // connessione al WIFI OK (led cablato a Vcc fisso)
  Serial2.print("\n CONNESSO con IP: ");
  Serial2.println(WiFi.localIP());
  audio.setVolume(20);              // volume:int8_t=0 ~ 21 (default=21); mode=0 default quadratic, 1= logaritmic 
  // audio.setBalance(0);           // balance:int8_t=-16 ~ +16 default=0
  // audio.setTone(0, 0, 0);        // gain:int8_t=-40 ~ +6 dB: LOW, MIDDLE, HIGH
  audio.connecttohost(STAZIONE);    // <----  connette lo stream 
}
//-------------------

void loop(){
  audio.loop();                         // decodifica lo stream 
 
  if(Serial2.available()){              // verifica la seriale2
    audio.stopSong();                   // ferma la riproduzione corrente
    String r=Serial2.readString();      // carica la stringa da seriale2
    r.trim();                           // elimina <blank>, <CR>, <LF>
    if(r.length()>5){                   // accetta se la stringa è>5 (https:)
       audio.connecttohost(r.c_str());  // <-----  connette lo stream
       }
    }  
 }  
//------------------------------

void audio_info(const char *info1){             
 Serial2.print("->");                   // stampa tutti gli eventi sulla seriale2
 Serial2.println(info1);
}

Upload was OK, but nothing happens... Only resetting after power on, I read on the serial monitor @115200 baud (115200???...) :

21:57:53.030 -> ets Jun  8 2016 00:22:57
21:57:53.030 -> 
21:57:53.030 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
21:57:53.030 -> configsip: 0, SPIWP:0xee
21:57:53.030 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
21:57:53.030 -> mode:DIO, clock div:1
21:57:53.030 -> load:0x3fff0030,len:1184
21:57:53.030 -> load:0x40078000,len:13260
21:57:53.030 -> load:0x40080400,len:3028
21:57:53.063 -> entry 0x400805e4

I selected DOIT ESP32 DEVKIT V1, but I tried two other boards before...
Can you help me?

Thanks!
Gianluca
.-----------------------------------------------------------------------------
Some previous projects of mine:
Magnetometer: https://youtu.be/C1OvPseLLqw
Power Grid Monitor: https://youtu.be/bRFnRWFU8_s
Geiger counter: https://youtu.be/dXWPT-MWtUo

@Datman I have edited your post to remove some security details

1 Like

Those messages are from the bootloader. Your code prints nothing to the serial monitor.

What is connected to Serial2, where all the .prints() in your code go (at 38400 Baud)?

Code comes from:

(you have to register...)
After 9 years, this is like (worse!...) my first time with Arduino... Please help me to understand!
Thank you!

Did you make any modifications to that code or did you run it verbatim (except for changing WiFi credentials)?

Did you use the exact same version of the Arduino IDE and ESP32 Core as was used by the original?

Hi, gfvalvo

Code is exactly as in my post #1, except for WiFi SSID and pwd.

IDE is 1.8.13. I use it for all my Arduino projects without any issue.

ESP32 is a ESP32-WROOM-32D:
https://www.amazon.it/gp/product/B08LL7ZH2W

I'll let you know details about the core. Now here I haven't the download link.

in re. Serial2
The pins to be used must be defined in the Serial2.begin function, yes?
e.g.

Serial2.begin(115200,SERIAL_8N1,14,15);

The author replied I need a 3.3V TTL to USB converter on 16&17 to read messages.

There's an onboard BT transceiver - you could pair it with your smartphone.

Not if you want IP radio. The ESP32 only has one radio transceiver. You can have BT or you can have WiFi, but not both at the same time.

1 Like

Well - that explains a couple of things (not otherwise related).

So buy one. These work well: https://www.adafruit.com/product/954

Why not start with an example from that library and make sure it works?
https://github.com/schreibfaul1/ESP32-audioI2S/tree/master/examples/Simple_WiFi_Radio

1 Like

Hi all
In the last days I haven't had time for this this project, but I noticed that compiling requires several minutes! On Grix, double_wrap wrote I have to temporarily disable antivirus... How can Windows Defender cause it?...

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.