logo elektroda
logo elektroda
X
logo elektroda

Internet radio and audio file player on ESP32-S3

MAJSTER XXL 109593 1253
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1141 21516109
    DJCheester
    Level 26  
    robgold wrote:
    Displaying the values on the OLED from the ADC also works just fine.


    How did you enable the ADC reading on the OLED ?

    robgold wrote:
    The board in the Sony has a rather complicated shape, lots of milling for the mounts and on top of that it is very large. I did a quick count of about $65. Quite a lot, the one that is after desoldering does its job quite well. I think for 1-2pcs it's not worth redrawing it.


    Sometimes at weekends JLCPCB have a promotion and a 10cm x 20cm board was something slightly over $20 for 5pcs and that's an acceptable price in my opinion.

    As for redrawing and sizing it goes quite smoothly for me. So you could give it a try.

    Greetings...
  • ADVERTISEMENT
  • #1142 21516304
    robgold
    Level 20  
    Under the IP/ADC tab you have Debug on/off. As you click, it turns on the ADC reading mode on the display. The idea was to not have to have a computer connected to calibrate the keyboard.
  • #1143 21516453
    Lechuuu
    Level 13  
    @robgold would you add to the config the possibility to put the display into setPowerSave() mode ? E.g. at least <selectem> after 120s, 180s, 240s, off ?
  • #1144 21516454
    gabar5
    Level 12  
    @robgold in the Arduino folder is still bin version 53 ;)

    I soldered everything off the board from Sony, added new switches, resistors. In adc read mode I have the values (two coincide) but after writing them the keyboard does not work properly. Most of the buttons don't trigger at all, some don't trigger what they should.
    Close-up of a circuit board with removed components, added new switches and resistors, and wires. .
  • ADVERTISEMENT
  • #1145 21516503
    robgold
    Level 20  
    When I have a moment, I will add such a PowerSave mode. Especially since this OLED 3.12 is terribly chopping the inverter on the audio channel. Listening quietly at night, you can hear this "hum".

    @gabar5 you must have something badly soldered, because it works very well with me. The ladder was chosen so that just none of the values in the matrix overlap.
  • #1146 21518897
    CodeBoy
    Level 33  
    Based on @DJCheester's graber I made tiles in china, they came out pretty cool.

    White PCB with the label ESP32 Web Radio and markings for electronic components. .
    White printed circuit board with multiple holes and traces on a dark wooden background. .
  • #1147 21518995
    DJCheester
    Level 26  
    Send it I'll run it 😀

    And in the meantime I made a PCB for my keyboard

    The darker one is the unsoldered original one and the lighter one is my creation.

    Two printed circuit boards, one darker and one lighter. .

    When there's a moment again I'll solder the keyboard as needed 😀.

    I also confirm the ADC on the OLED works.
    So now I'm thinking that the key reception could look like that ESP takes three ADC values and averages and then checks with the declaration. I think there would be less false keys. Because sometimes something will pop up a completely different value and then the good values already go.

    Regards...

    Greetings...
  • #1148 21519940
    marek003
    Level 40  
    :) I will only suggest to the author that if he is bored he can also introduce an option in the settings with learning any remote control.
    So, for example, selecting a given function - reading via IR a button from the remote control - and writing it down.
    And then there is no need to "remember" specific numbers of the remote control manufacturer or to enter something "backwards" to the radio. :) .
    If there has already been this suggestion then I apologise - I've only read through the thread once so far. I also noticed that in the audio (radio) library itself there is a letter swap for diacritical letters - unfortunately to German and only with C3. As usual, the Poles must have more options (C3, C4, C5), which translates into a bit more complicated code than the one inside the library. :) .

    For my part, I would like to add that I am building my own radio on the basis of this thread (and the knowledge provided by its two authors) - but I am trying to get to know the libraries used in more detail, and besides, I am doing it on a casual basis, so it takes me a while. Among other things, I found that it is possible, for example, to "extract" directly from the audio library separately the signal strength of the L and P channels even before they are combined, so you don't have to divide and shift the bits later.
    The option (in the examples) to read the time is also interesting. Of course, it is worth correcting from EN to PL in the code. Or the "karaoke" function - but for this, the mp3 peaks need to be adequately "described".

    But back on topic thanks to the authors for sharing their knowledge. I will not fail to draw on it to the full :) .
  • #1149 21519964
    wirbud
    Level 13  
    marek003 wrote:
    The option (in the examples) to read the time is also interesting. Of course, it would be worthwhile to improve from EN to PL in the code. Or a "karaoke" function - but for this there must be appropriately "described" mp3 pips.
    .

    I love this feature - especially on weekend evenings when it's even after midnight.... Then I listen to MiniWebRadio on the Wolle version and those hours read reminds me to go to bed already..... "precisely";-) .

    and learning the remote control - you can probably borrow from YoRadio - it is beautifully solved.
  • #1150 21520317
    robgold
    Level 20  
    @marek003
    - Due to the simplicity of the web server (it's just plain Async without websockets) No plans to add pilot learning functionality at the moment. You enter the codes once and that's it. I don't think anyone orders a new remote control every day ? ;) Besides, I have a lot of other activities and work activities lately. We will slow down a bit for the summer with these updates.

    - Polish diacritical marks are substituted in the program code not in the library and we use both C2, C3, C4 and C5. You have the whole set with Polish "tails".

    - The radio has a function implemented to read the time in Polish. The function with English is left in the program code but is not used. Perhaps I will add it in the radio configuration in the future.

    I have uploaded Evo3.17.60 to GitHub Link .
    - has an added PowerSave function (turning off the display) after a stored time. The display switches off after the declared time, wakes up when the remote is pressed or the encoder is turned. If for some reason the stream stops playing, the display wakes up, starts displaying "no audio stream" and does not enter the Power Save trim.

    - in the SD card explorer, I have added a file EDIT option.

    - I improved the code (mainly comments) in such a way that now, if one really wants to, one only has to search in the ino or main.cpp file for the text "SD." replace with "SPIFFS." and add " #include "SPIFFS.h" " and one can get rid of the SD card. There is one exception where you have to uncomment the SPIFSS memory declarations but by doing a "search and replace" you will notice this feature. This will ensure that the radio will have SPIFSS memory instead of SD card from now on. Of course, you have to upload the icon files and the remote.txt file for yourself via www.

    Code: C / C++
    Log in, to see the code
    .


    Bank Editor Link .
    I have made a simple bank editor. The editor allows you to download a given bank directly from GitHub, change what you need, change the order of stations and if you give it an IP number it will even automatically send us the content of our changes to the SD card of the radio :) There is also an option to play a given link before you load it. Pressing Play will play it on the radio using the radio's integrated playback function from the link provided by the web server.
    The editor is nothing more than a clever html file with a few scripts. It needs to be downloaded to disk because GitHub will not open the HTML like a browser only displays the source.

    NOTE:
    This is a demo version, it has completely no security mechanisms. If you type "Ala has a cat" in the name of the stream this will also be loaded on the SD card. The editor overwrites the current files of the Bank in question on the radio. Once the new content has been uploaded, simply reload the respective Memory Bank on the radio.

    Screenshot of an online radio station bank editor, showing a list of stations with names, links, and management options. .
  • ADVERTISEMENT
  • #1151 21524267
    robgold
    Level 20  
    As part of the Christmas 'bunny', I have uploaded this week's update 3.17.65 to your GitHub.

    - I added one menu where all options are now present
    - there is a new (v1.05) banks editor, it pulls banks from a txt file, github or from the radio and detects the IP or hostname of the radio itself (you have to upload the editor.html file to the SD card via web or external reader)
    - I added mDNS, the radio now reports itself on the network as hostname: esp32radio i.e. http://esp32radio.local This works minimally slower than by IP, but if someone has DHCP, there is no need to check the IP at startup.


    Main menu of the ESP32 Web Radio interface with five green option buttons and a Go Back link at the bottom. .
    Screenshot of the ESP Web Radio bank editor showing a list of radio station names, stream URLs, and management buttons.
  • #1152 21524322
    gabar5
    Level 12  
    The development of this project is commendable. Have any of you tried combining radio management with Home Assistant? It would be nice how the radio would turn on initiated by a trigger e.g. presence in the room.
  • #1153 21524882
    wirbud
    Level 13  
    Robgold - great job! The radio is world league ! Thanks for the hour and turning off the OLED - it gets quiet and audiophile. I'm writing and listening to Radio Paradise Main Mix.... and it just says it's 11 o'clock ;-) Oh and surprise surprise after anon reset and play on.... I still have a spider without coupling cones.... it's probably their fault.

    Merry Christmas to all !

    Added after 2 [minutes]: .

    gabar5 wrote:
    Have any of you tried combining radio management with Home Assistant? It would be nice how the radio would turn on initiated by a trigger e.g. room presence.


    Yoradio has MQTT - have you tried it ? Does it have any practical use ?
  • ADVERTISEMENT
  • #1154 21524887
    gabar5
    Level 12  
    @wirbud E.g. such that the radio turns on when I'm in the studio and off when I leave. Yes I know I can do it myself, walk up and turn it on/off, but if something can do "itself" then even better :) .
    Yoradio I haven't tested yet, I'll have a look.
    I see it even has a custom component for HACS, so it's prepared under HA.
  • #1155 21524900
    wirbud
    Level 13  
    Indeed - great ! And how should your presence be detected - a presence detector ? (because Ikea's PIR probably won't work because how is it supposed to recognise that you went out or you are still there but you don't move.... A bit off topic but I'm playing around with HA now and watering the plants ;-) as they dry of course. Maybe I'll radio them on occasion when I am or when I'm away. Thanks
  • #1156 21524907
    gabar5
    Level 12  
    Yes, an occupancy sensor would be the best solution, you can do it on a pir with a long delay to fade motion detection, but it won't work quite right, I have an auxiliary (night) light in the kitchen done this way, one of the first automations, enough for me, but not crazy.
    Trigger could be e.g. computer on, light, anything connected to HA
  • #1157 21525134
    DJCheester
    Level 26  
    Hello, I am also considering the option of active radio mode, i.e. radio on, and a sleep mode on the screen, some graphics for a while and then blanking, triggered by the state on the selected pin, but I am not as skilled in writing code to do this myself.

    Greetings ...
  • #1158 21525438
    Lechuuu
    Level 13  
    @DJCheester I just tried to do something like this today, I added an extra microswitch pullup to the 2nd GPIO pin, a few lines of code and with this switch I turn the radio on and off. Testing for now. If that's something you wanted I'll add the code....
  • #1159 21525584
    DJCheester
    Level 26  
    Hi the code can you please provide or write the changes as I will be distosing to my project anyway and the switch will not quite work like that. Regards...
  • #1160 21525642
    Lechuuu
    Level 13  
    I don't know if anyone will find it useful to switch on and off using the microswitch, but I missed it and I've put a few lines together in the dirt.

    Where to paste what - in the pictures below

    Screenshot of Arduino IDE showing a source code fragment for ESP32 with the On/Off button pin definition highlighted. .
    Screenshot from Arduino IDE showing a highlighted code line initializing a variable for the ON/OFF button state on ESP32. .
    Screenshot showing a code segment in the Arduino IDE with a highlighted line initializing a button pin with a pull-up resistor. .
    Screenshot of the Arduino IDE editor showing a highlighted code section handling an ON/OFF button for an ESP32 module. .
    Electronic schematic of the ESP32-S3 internet radio project, highlighting a microswitch connected via a 10K resistor to the ESP32 pin. .

    #define ON_OFF_BUTTON_PIN GPIO_NUM_2   // Pin GPIO przycisku On/Off
    .

    unsigned long onOffButtonPress = 0; // Zmienna do przechwytywania stanu przycisku ON/OFF, kiedy został naciśnięty
    .

    At the end of setup()
    pinMode(ON_OFF_BUTTON_PIN, INPUT_PULLUP); // Przycisk z wewnętrznym rezystorem podciągającym


    At the end of loop()
      // Sprawdź, czy przycisk ON/OFF jest wciśnięty
      if (digitalRead(ON_OFF_BUTTON_PIN) == LOW) {
    
        if (onOffButtonPress == 0) {
          onOffButtonPress = millis(); // zmienna czasu naciśnięcia przycisku
        }
    
        if (millis() - onOffButtonPress >= 3000) {
          Serial.println("Wykryto długie naciśnięcie, ESP32 pozostaje w stanie czuwania.");
          onOffButtonPress = 0; // Reset timera
        }
    
      } else if (onOffButtonPress > 0 && millis() - onOffButtonPress < 3000) {
        // Jeśli przycisk zostanie zwolniony przed upływem 3 sekund
        Serial.println("Wykryto krótkie naciśnięcie, przechodzę w głęboki sen.");
        esp_sleep_enable_ext0_wakeup(ON_OFF_BUTTON_PIN, LOW); // Ustawianie pinu budzenia
        u8g2.setPowerSave(1); // wyłącza wyświetlacz
        esp_deep_sleep_start(); // wlącza esp w tryb deep sleep
      } else {
        onOffButtonPress = 0; // Zresetuj timer, jeśli przycisk nie jest naciśnięty
      }


    Ps. I am not a programmer - code to be improved by more experienced people. But it works :) .
  • #1161 21525809
    robgold
    Level 20  
    @wirbud The reset you have on the Paradise radio (presumably FLAC) is due to the Audio library. It most often "rash" when it should switch to an mp3 stream then switch back to a FLAC stream. Although this is not a common occurrence. It happened to me once in the previous month. On mp3 stations it doesn't have this problem.

    As far as automation is concerned, it is enough to control a simple "relay" type module, which will switch on your power supply (USB charger) to the radio. The whole thing, after all, wakes up about 2 seconds after which it plays.

    @Lechuuu the code is OK. However, it's still such a "half dream". ESP is asleep but PCM is powered. Correctly everything should be cut off by a transistor and only then ESP asleep. At the moment it's just an illusory feeling of being switched off but in fact not much is switched off. Additionally the ESP should wake up to the remote control button, check if it was the POWER button if so then "get up" if not then continue to stay in sleep mode. This is how I would see it. We will probably add such full functionality over time. Without remote control operation it's all the same to me if I get up from the couch and have to snap the switch or the ;) button.
  • #1162 21528236
    DJCheester
    Level 26  
    Welcome ;) .

    Today, out of an excess of free time after Christmas, I got the new radio up and running ;)

    You can give it the name UNO (although the first one is not)

    I used the following ESP32 module for it

    A purple ESP32-S3 UNO electronic board with connectors and components, lying on a beige carpet. .

    Adding to this is my second PCB project based on the sandwich.

    ESP32-based radio module assembled on a PCB with electronic components and connected wires. .
    Electronic module on a PCB with connected cables and components, including an ESP32 and an SD card reader. .
    A custom radio module with ESP32 and an LCD display lying on a carpet, connected by a cable. .
    ESP32 module connected to a custom PCB, displaying radio information on a large green screen. .

    I "slimmed down" the radio - missing the connector for the encoder, the connector for the keyboard, and the PAM8403 power amplifier (2x3W).

    I hooked it up to my tube radio and it plays nicely.

    Note at the beginning my SD card didn't work - it turned out that on the Chinese module the GPIO47 and 48 pins are swapped, physically they are reversed, I suggested the description when designing the board and now I have to swap in the code to make it work ;) But this is not a problem.

    I would add that this larger display doesn't chop as much on the audio lines ;) .

    Regards ....
  • #1163 21544703
    hetm4n
    Level 20  
    Hi. I have also put together a yoradio project but have noticed a problem with the stream frequently trimming. I have a esp32 wroom 30 pin dac pcm5102 board, 2 x encoder and ssd1322 display. Power supply from a 33w charger. Wifi perfect, shows 22dBm rssi. Anyone have any ideas on this?
  • #1165 21544896
    Damian_Max
    Level 19  
    @hetm4n In this thread, there is a slight scrolling topic of parceling a library related to packet buffer size, or something similar. To my eye, that's the problem with you, so you'd have to go through that thread page by page, because the reference to parceling that lib is there several times.
    (I can't help you exactly, as I haven't put it together myself yet, but loosely reading through this thread, I picked up that it absolutely has to be done to improve stability)
  • #1166 21545148
    nouki
    Level 25  
    Welcome.

    I have a question :) .
    I have been changing the look for a while and found that I wanted the day of the week.
    After adding it, the day appears to me but unfortunately not in the format I would like.
    I got it in the format of the number Saturday is 6. How do I change it to display for example: "Mon"

    Code: Arduino
    Log in, to see the code
    .

    Thanks.
  • #1167 21545165
    robgold
    Level 20  
    @nouki you have to build yourself a "case" for this. You have it in displayMode=1 (clock)

    code snippet:

    Code: C / C++
    Log in, to see the code
    .
  • #1168 21545174
    nouki
    Level 25  
    Unfortunately I do not use this design but another. In addition, I have not written anything for a long time :) .

    Thanks
  • #1169 21545180
    robgold
    Level 20  
    Welcome,

    I have uploaded on GitHub the update to 3.17.77 , ->: Link .

    What's new in 3.17.77 ?
    - I have changed a bit the layout of the radio's website
    - We have WebSockets, i.e. station data, volume and the added station string is transmitted in real time (e.g. by turning the encoder on the radio, the volume on the page will also change)
    - In the configuration there is now an option to extend the VOLUME range from 21 to 42. This is useful if someone wants to build the radio module together with the amplifier module.
    - I have added auto creation of the config file. If the radio does not find the config.txt file, it will create it automatically on first start-up
    - The code is written so that by replacing the SD entry. (SD dot) to SPIFFS. (SPIFFS dot) it is possible to use the SPIFFS memory instead of the SD card. Then you have to use the website to load the files from the SD card content directory (especially editor.html)
    - is MDNS, the radio reports itself on the network as host: http://esp32radio.local/ regardless of IP.

    Have fun testing.

    ESP32 web radio interface with Akadem. Radio Centrum selected and a list of radio stations. .
  • #1170 21545538
    hevet
    Level 16  
    @robgold thanks for the new version

    Observations from the new version (maybe only for me)
    - in Configuration on the page is Max Volume Extended [0] range 1-21 or [1] range 1-42, in the selection On/Off (for consistency should be Max Volume Extended [OFF] range 1-21 or [ON] range 1-42)
    - volume range change (works after radio restart), is this the way it should be?
    - if a station broadcasts a title with Polish characters, then after switching to this station there is no title in the window on the page, when switching to another station, the window does not refresh, you have to refresh the page. You have removed the processText for decoding Polish characters, if it is disabled, it displays Polish characters on the website, but does not display them on the radio.

Topic summary

The discussion centers on the development of an internet radio and audio file player based on the ESP32-S3-WROOM-1 module, featuring a custom-designed prototype PCB with OLED display and user controls including rotary encoders and buttons. Key challenges addressed include pin spacing discrepancies in the ESP32-S3 module footprint, integration of Wi-Fi connectivity with dynamic station list updates, and handling of Polish character encoding on the OLED display. The project uses Arduino IDE (version 2.3.2) with ESP-IDF support and requires enabling PSRAM. Audio playback supports MP3, AAC, and FLAC streams, with the ESP32-audioI2S library recommended over the incompatible Audio library. Users reported issues with SPI MISO pin assignment causing bootloader conflicts, resolved by reassigning MISO to pin 35. The project incorporates WiFiManager for network configuration, EEPROM and SD card storage for saving last played station and settings, and includes plans for tone control via an external KA2107 equalizer and a CS8673 amplifier module. Problems with encoder input stability and memory limitations for Bluetooth A2DP on ESP32-S3 were noted. The community suggested alternatives like KaRadio and ESP32-MiniWebRadio projects. Debugging tips include serial terminal logs for HTTP errors and flash memory erasure to resolve boot loops. The project is open-source on GitHub, encouraging forks and modifications. Additional features under development include browser-based updates, directory navigation, and potential audio recording to SD card.
Summary generated by the language model.
ADVERTISEMENT