logo elektroda
logo elektroda
X
logo elektroda

Internet radio and audio file player on ESP32-S3

MAJSTER XXL 100713 1227
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1201 21561006
    nouki
    Level 25  
    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 20  
    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 26  
    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  
    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 20  
    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  
    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.
  • ADVERTISEMENT
  • #1207 21561257
    robgold
    Level 20  
    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  
    I was thinking of a switch something like stanby meaning it goes to sleep and the clock stays and only the clock.
  • #1209 21561374
    DJCheester
    Level 26  
    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 ...
  • #1210 21561451
    marek003
    Level 40  
    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?
  • #1211 21561706
    nouki
    Level 25  
    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.

    `
  • #1212 21562217
    robgold
    Level 20  
    @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).
  • #1213 21562250
    nouki
    Level 25  
    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
  • ADVERTISEMENT
  • #1214 21572312
    robgold
    Level 20  
    @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  
    @robgold now web sockets work great, super job :-) Will be tested, thanks for the new softs
  • #1216 21572561
    hevet
    Level 16  
    @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 20  
    @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 16  
    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 20  
    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
  • #1220 21572673
    hevet
    Level 16  
    @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 20  
    Enter two "kejs" into the win1250ToUtf8 function:

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

    and it will be OK.
  • #1223 21572722
    robgold
    Level 20  
    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 20  
    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 ? :) .
  • ADVERTISEMENT
  • #1226 21573305
    robgold
    Level 20  
    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  
    Very good evolution, I like the effect of the floating pixels 🙂

Topic summary

The discussion revolves around building an internet radio and audio file player using the ESP32-S3 microcontroller. The project includes features such as an OLED display, Wi-Fi connectivity, and audio playback capabilities. Users share their experiences with hardware setup, including issues with pin configurations, library compatibility, and troubleshooting compilation errors in the Arduino IDE. Suggestions for libraries, such as ESP32-audioI2S and WiFiManager, are provided to enhance functionality. Participants also discuss the importance of proper wiring, capacitor usage for encoders, and the potential for adding features like DLNA support and a web management interface for radio station management. Several users report on their progress, share code snippets, and offer solutions to common problems encountered during development.
Summary generated by the language model.
ADVERTISEMENT