logo elektroda
logo elektroda
X
logo elektroda

Internet radio and audio file player on ESP32-S3

MAJSTER XXL 294570 2811

TL;DR LABEL_AI_GENERATED

  • Built an ESP32-S3 internet radio with an audio file player and OLED desk display, evolving through v1, v2, and v3.
  • Uses an ESP32-S3-WROOM-1, PCM5102A DAC, rotary encoders, and GitHub-hosted station lists split into banks of up to 100 stations.
  • The prototype uses a 2.42" 128x64px white OLED display, with a PCB made in Poland costing 130zl.
  • v3 adds a colour screen, weather, a calendar, RSS news from Polsat News Polska, and full remote control.
  • The first PCB had a pad-spacing mistake for the ESP32-S3-WROOM-1, so the module pins had to be bent slightly to fit.
AI summary based on the discussion. May contain errors.
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
Listen:
  • #1201 21561006
    nouki
    Level 25  
    Posts: 1222
    Help: 28
    Rate: 98
    Welcome.

    Finally the parts have arrived and after assembling so to test lcd + esp only I have this loopy effect.


    Starts up connects to the network appears Loading bank1 station from github and reset and so on and so forth.
  • ADVERTISEMENT
  • #1202 21561037
    robgold
    Level 23  
    Posts: 726
    Help: 10
    Rate: 290
    ESP board configuration correct in Arduino ? PSRAM correctly enabled ? What kind of ESP do you have ? How much memory ? Reset appears if you do not enable PSRAM. For large 16/8 modules it is supposed to be OPI for those with small RAM QSPI. Check the documentation.
  • #1203 21561038
    DJCheester
    Level 28  
    Posts: 2089
    Help: 75
    Rate: 958
    And did you use the libraries from my colleague Robgold ?
    Well, and Arduino IDE with substituted me files in ESP libraries we recommend to upload this version at most 3.0.7 I use 3.0.5 and it also works. Greetings ...
  • #1204 21561064
    nouki
    Level 25  
    Posts: 1222
    Help: 28
    Rate: 98
    Set up like this is ok. A couple of pages earlier you inserted a picture.
    Esp32-s3-wroom-1 I am using.
    I uploaded the older version and it works but I have no sound. I'm using this larger board with the called PCM5102MK but it's not likely to matter.
  • #1205 21561082
    robgold
    Level 23  
    Posts: 726
    Help: 10
    Rate: 290
    Audio library to download from the author's site and swap manually, or upload an older version via Arduino.
    I assume you have the PCM board configured correctly.
  • #1206 21561252
    nouki
    Level 25  
    Posts: 1222
    Help: 28
    Rate: 98
    The problem was quite trivial I was powering via usb-c so the voltage was too low to get the PCM going.

    Is it possible to add a function so that the radio can be switched off (interrupt the connection) but leave the clock on full screen.
  • #1207 21561257
    robgold
    Level 23  
    Posts: 726
    Help: 10
    Rate: 290
    It is possible to switch on the "MUTE" function then you cannot hear the radio but the clock remains. Stopping would trigger the information that the stream is not connected and this is visible on the clock.
  • #1208 21561267
    nouki
    Level 25  
    Posts: 1222
    Help: 28
    Rate: 98
    I was thinking of a switch something like stanby meaning it goes to sleep and the clock stays and only the clock.
  • Standby mode via external switch and remote control

    #1209 21561374
    DJCheester
    Level 28  
    Posts: 2089
    Help: 75
    Rate: 958
    Hi, I support the idea of my colleague nouki standby would be useful from an external switch connected to the ESP pin and from the remote control. I would suggest displaying some kind of graphics like notes or other declared in the sketch in standby mode and in play mode these options as they are unchanged and it would be beautiful.

    I am planning to install my radio in an old Schneider audio set, and there, when the radio is active, it will play and the standard operation will be maintained, and when, for example, the AUX input is selected, then the radio goes into standby with graphics on OLED like WebRadio ESP32 etc. The whole set is switched off and on using the mains switch.

    Regards ...
  • ADVERTISEMENT
  • Low USB-C current caused PCM startup failure

    #1210 21561451
    marek003
    Level 40  
    Posts: 4607
    Help: 801
    Rate: 488
    nouki wrote:
    The problem was fairly trivial-I was powering through usb-c so the voltage was too low to get the PCM going.


    Voltage too low? After all, this board (PCM5102MK) is at 5-10V and in fact at 3.3V because that's what the three stabilisers are on it (each with a max of 0.8A) so don't blame it on the too-small voltage "USB-C" connector. Ultimately on the current capacity of the power supply.
    Buy a decent 2A minimum and it will hulk.

    nouki wrote:
    .
    Is it possible to add a function so that you can switch off the radio (interrupt the connection) but leave the clock on full screen.


    If the clock is to "walk" and be displayed on the LCD then, as the author mentioned - there remains the "mute" and that only to sleep and not to listen, because ultimately "saving" on electricity can (in my opinion) only on the operation of the PCM board because the ESP and the display have to walk anyway. And this saving will also be negligible, as there is still noise generation, so I don't know if it will make much difference to you (using the power supply and not running on batteries) and if it is worth playing around with it.

    I can't remember but wasn't "mute" programmed into the remote control?
  • PCM5102 module needs at least 3.7V supply

    #1211 21561706
    nouki
    Level 25  
    Posts: 1222
    Help: 28
    Rate: 98
    marek003 wrote:
    Voltage too low? After all, this board (PCM5102MK) is at 5-10V and in fact at 3.3V because that's what the three stabilisers are on it (each with a max of 0.8A) so don't blame it on the too-small voltage connector "USB-C". Finally on the current capacity of the power supply.
    Buy a decent 2A minimum and it will hulk.
    .

    Well, apparently not, because at 3.3V there is already no sound. In addition, powering from usb the Esp board has 3.2V on the 5V pins (the same as on 3.3v) and is not related to the current capacity. The pcm only starts working at 3.7v on the power pins of this module. At 3.7V the stabilisers on the Pcm give 2.8V and the note indicates a minimum supply of 3V. At 2.76V the sound starts to rip.

    So maybe in you it works powering from usb in me it doesn't work.

    It wasn't about saving money, it was about aesthetics. When you mute the display, unnecessary lettering remains. And I meant clearing everything unnecessary and leaving the clock on the whole screen. Additionally, in display mode 3 there is no Mute text on the display.

    `
  • OLED burn-in risk and missing 5V jumper issue

    #1212 21562217
    robgold
    Level 23  
    Posts: 726
    Help: 10
    Rate: 290
    @nouki The clock mode has one fundamental flaw. The display is of the OLED type. Displaying a static image for long hours will affect its lifespan. As for the power supply, have you connected a jumper on the ESP board to make the 5V from the USB appear on the VCC 5V pin ? If you don't do this then there won't be those say 5 or 4.9V there and then indeed the PCM won't start. For the whole circuit including the OLED there is enough current from the USB port (the radio circuit does not draw more than 500mA).
  • ADVERTISEMENT
  • Screen blanking as a workaround for display burn-in

    #1213 21562250
    nouki
    Level 25  
    Posts: 1222
    Help: 28
    Rate: 98
    For this we make the clock the width of say 3 pix and move it left right from time to time. When listening to, say, a station named xxx, there is also a field which stays in one place all the time. As well as the mode with the larger clock it also stays in the same place. Unless it's moving and I can't see it. Partly screen blanking solves the problem as long as it is enabled.

    The power supply is irrelevant because on a quick usb start up and ultimately it is taken from the bottom board so this is my oversight . My bottom board needs over 6v to work properly.

    I added the RGB knob and clock as a quick fix.

    Any hints from someone with a more advanced ...Unfortunately the last time I wrote something was a couple of years ago when esp was coming in and I was playing with atmega and the smaller brothers.

    I made a change like this
    Code: Arduino
    Log in, to see the code
    .

    And now the radio resets itself every so often, or goes into a continuous reset loop when I type configArray[32].

    In addition, the variables at %d1-%d8 read normally and the rest is written to the card correctly (sending from the page) but inserts the numbers 101,102...or some 24xx .

    It seems to me that this could be related to addressing but I am too weak :) .

    Thanks
    Attachments:
    • Internet radio and audio file player on ESP32-S3 IMG_20250529_210709.jpg (2.32 MB) You must be logged in to download this attachment.
    • Internet radio and audio file player on ESP32-S3 17485454890526689082067986543400.jpg (3.2 MB) You must be logged in to download this attachment.
  • Config array order and UTF-8 formatting fixes

    #1214 21572312
    robgold
    Level 23  
    Posts: 726
    Help: 10
    Rate: 290
    @nouki
    If you have variables above %d9 e.g.: 10, 11 then they have to go at the beginning of the code i.e. you first assign e.g.: 18, 19 etc. and only then %8, %9. See for yourself how it is in my code. This order is not accidental. In your code you have debug commented to read the config on the terminal. See if you are reading the config arrays correctly. If at least one variable is not written then everything will rearrange and rubbish will fly into the last one. Take a peek in the SD/SPIFFS editor on the web radio at what you have in the config.txt file

    As you are already changing something it would be nice if you shared with the rest of the community the code and technical solution how you did the backlighting, knob. We would all be happy to benefit :) .

    Added after 19 [minutes]:

    I uploaded the 3.18.04 version to GitHub - Link

    What's new.
    - New formatter for the scroller, this prevents the clock from flashing when listening to stations with autoDJ and a counter in the station string (e.g.: RMF Classic)
    - Correct formatting of station string from cp1250 to UTF8 (e.g. radio Baobab) for web interface so web sockets do not disconnect and website works stably
    - Added auto-creation of the configuration file
    - I cleaned up the code from unnecessary functions (although I still keep a lot of "stuff" in there ;) )

    If you catch any errors, please write. It's very hard to test such extensive code and all functions every time.
  • #1215 21572466
    Lechuuu
    Level 13  
    Posts: 104
    Rate: 25
    @robgold now web sockets work great, super job :-) Will be tested, thanks for the new softs
  • Improved encoder debounce for recovery menu

    #1216 21572561
    hevet
    Level 18  
    Posts: 347
    Rate: 47
    @robgold I don't know about you, but with me the encoder switching in the recovery menu works very poorly, switching happens at random, you can spin the encoder left and right and nothing will change. Below I paste the corrected whole recoveryModeCheck function, now it works much better.

    void recoveryModeCheck()
    {
      if (digitalRead(SW_PIN2) == 0)
      {
        int8_t recoveryMode = 0;
        u8g2.clearBuffer();
        u8g2.setFont(spleen6x12PL);
        u8g2.drawStr(1, 14, "RECOVERY / RESET MODE - release encoder");
        u8g2.sendBuffer();
        delay(2000);
    
        while (digitalRead(SW_PIN2) == 0) {;} // Czekamy na zwolnienie przycisku
        u8g2.clearBuffer();
        u8g2.drawStr(1, 14, "Please Wait...");
        u8g2.sendBuffer();
        delay(1000);
        u8g2.clearBuffer();
    
        int prev_CLK_state2 = digitalRead(CLK_PIN2);
        unsigned long lastTurnTime = 0;
    
        while (true)
        {
          // Prosty debounce
          if (millis() - lastTurnTime > 100)
          {
            int CLK_state2 = digitalRead(CLK_PIN2);
            if (CLK_state2 != prev_CLK_state2 && CLK_state2 == LOW)
            {
              if (digitalRead(DT_PIN2) != CLK_state2)
              {
                recoveryMode++;
              }
              else
              {
                recoveryMode--;
              }
    
              if (recoveryMode > 1) recoveryMode = 0;
              if (recoveryMode < 0) recoveryMode = 1;
    
              lastTurnTime = millis();
            }
            prev_CLK_state2 = CLK_state2;
          }
    
          // Wyświetlanie menu
          u8g2.clearBuffer();
          u8g2.drawStr(1, 14, "[ -- Rotate Enckoder -- ]");
    
          if (recoveryMode == 0)
          {
            u8g2.drawStr(1, 28, ">> RESET BANK=1, STATION=1 <<");
            u8g2.drawStr(1, 42, "   RESET WIFI SSID, PASSWD   ");
          }
          else if (recoveryMode == 1)
          {
            u8g2.drawStr(1, 28, "   RESET BANK=1, STATION=1   ");
            u8g2.drawStr(1, 42, ">> RESET WIFI SSID, PASSWD <<");
          }
    
          u8g2.sendBuffer();
    
          // Akcja po naciśnięciu przycisku
          if (digitalRead(SW_PIN2) == 0)
          {
            if (recoveryMode == 0)
            {
              bank_nr = 1;
              station_nr = 1;
              saveStationOnSPIFFS();
              u8g2.clearBuffer();
              u8g2.drawStr(1, 14, "SET BANK=1, STATION=1");
              u8g2.drawStr(1, 28, "ESP will RESET in 3sec.");
              u8g2.sendBuffer();
              delay(3000);
              ESP.restart();
            }
            else if (recoveryMode == 1)
            {
              u8g2.clearBuffer();
              u8g2.drawStr(1, 14, "WIFI SSID, PASSWD CLEARED");
              u8g2.drawStr(1, 28, "ESP will RESET in 3sec.");
              u8g2.sendBuffer();
              wifiManager.resetSettings();
              delay(3000);
              ESP.restart();
            }
          }
    
          delay(10);  // Lekki delay by zmniejszyć obciążenie CPU
        }
      }
    }
    .
  • #1217 21572598
    robgold
    Level 23  
    Posts: 726
    Help: 10
    Rate: 290
    @hevet What do you use this function for ? :) To tell you the truth I haven't looked there for ages since OTA via web interface works.
  • #1218 21572601
    hevet
    Level 18  
    Posts: 347
    Rate: 47
    It's not used too often, or at all, but sometimes I had to reset the station and the bank.

    Added after 1 [hour] 8 [minutes]: .

    @robgold there is a problem with Polish characters on the WEB site on Radio 357 and Radio New World stations, on the radio it is ok, on the site it then does not display the information.
  • #1219 21572672
    robgold
    Level 23  
    Posts: 726
    Help: 10
    Rate: 290
    That's interesting, because I was listening to the 357 and the RNS and here today such a zonk....no nothing I will have to take a look at it
  • ADVERTISEMENT
  • #1220 21572673
    hevet
    Level 18  
    Posts: 347
    Rate: 47
    @robgold I think I already know what to do, you need for example in displayMode = 0 to do so

    stationStringWeb = stationString;
    stationStringScroll = stationString + " "; // we add a separator to the scrolling text if it doesn't fit on screen
    processText(stationStringScroll); // process Polish characters
  • #1221 21572680
    robgold
    Level 23  
    Posts: 726
    Help: 10
    Rate: 290
    Enter two "kejs" into the win1250ToUtf8 function:

    case 0x8C: output += "¶"; break;
    case 0x9C: output += "¶"; break;

    and it will be OK.
  • #1223 21572722
    robgold
    Level 23  
    Posts: 726
    Help: 10
    Rate: 290
    I've uploaded the patch to Github, gratis a feature I was only planning to implement but is already in 3.18.05 ;) .
  • #1224 21573193
    robgold
    Level 23  
    Posts: 726
    Help: 10
    Rate: 290
    I envied a bit the guys who have yoRadio that their VUmeter always works by 1px and not by a whole segment of 8px, and I also made such a VUmeter in our radio. Additionally there is a Peak&Hold dash. Do you want such a version ? :) .
  • #1226 21573305
    robgold
    Level 23  
    Posts: 726
    Help: 10
    Rate: 290
    I have uploaded 3.18.06 on GitHub with the new VUMeter with peak & hold function.

    Audio device display showing radio station, song title, VU meter, and audio file parameters. .
  • #1227 21573324
    Lechuuu
    Level 13  
    Posts: 104
    Rate: 25
    Very good evolution, I like the effect of the floating pixels 🙂
  • Serial monitor shows no IR codes from remote

    #1229 21579427
    dariuszj
    Level 20  
    Posts: 441
    Help: 33
    Rate: 68
    Gentlemen
    I have run my radio on the latest version v3.18.06 with one encoder. Everything works great, but I can't get through the remote control configuration. The remote this small Chinese, the standard codes from the remote.txt file don't match because the remote doesn't work. i don't know how to read the codes my remote sends. I found info that you can view this information in the serial monitor. Unfortunately at my place after pressing any button on the remote nothing happens. The remote control and IR receiver work because in a competing Yoradio project it works.
  • #1230 21579442
    Szaryczlowiek83
    Level 7  
    Posts: 69
    Rate: 2
    >>21579427 .
    Maybe a stupid question but are you sure you have the correct pins entered? I was wqur... and it turned out I got the wrong pin number and it didn't work.
Listen:

Topic summary

LABEL_AI_GENERATED
Discussion of a DIY internet radio and SD-card audio player built on an ESP32-S3 with an OLED display, rotary encoders, buttons, and a front-panel interface. The project uses Wi‑Fi to download station lists from GitHub/public stream databases, supports MP3 and later AAC/FLAC playback, displays metadata including Polish characters via a modified font table, and stores settings such as station/bank selection and volume. The thread covers PCB design in EasyEDA, ESP32-S3 module pin spacing issues, PSRAM and Arduino IDE setup, library compatibility problems, SPI/I2S wiring, SD card reader boot issues, encoder behavior, WiFiManager-based network setup, and troubleshooting of crashes, HTTP download failures, and audio initialization errors. Several improvements were added over time, including station selection by encoder, time sync, browser update support, and saving settings to card memory.
AI summary based on the discussion. May contain errors.
ADVERTISEMENT