logo elektroda
logo elektroda
X
logo elektroda

Internet radio and audio file player on ESP32-S3

MAJSTER XXL 109761 1254
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #511 21416048
    MAJSTER XXL
    Level 29  
    @robgold setting audioBuffer.changeMaxBlockSize(16384); has finally caused FLAC files to work properly, I will be listening often and thickly from the SD card. You see, I didn't poke around too much in those audio files, I didn't read what the author describes, because when everything worked before, I didn't look for anything by force. But I do wonder why it worked before and now crashes.

    @rp02 wiring diagram we rather have identical, except that I probably have additionally this joystick used, I do not know how colleague @robgold .
  • ADVERTISEMENT
  • #512 21416209
    hevet
    Level 16  
    @robgold, small cosmetic error, day of the week overlaps the hour.
    Electronic display showing time, date, and radio information .
  • #513 21416215
    DJCheester
    Level 26  
    That's why I have a JST 5pin connector on the PCB. If you need it, you can buy the joystick and plug it in; if not, you can always leave it free.

    Greetings ...
  • #514 21416313
    MAJSTER XXL
    Level 29  
    I love moments like this, however, I will substitute a new ESP32:

    Code: C / C++
    Log in, to see the code
    .
  • ADVERTISEMENT
  • #516 21416356
    MAJSTER XXL
    Level 29  
    @khoam thanks for the lead on the decoder, but it doesn't tell me much except that it points to:


    ESP stack trace decoder interface with loaded binary file and output trace code. .


    and this is related to the FreeRTOS task, the fragment pointing to port.c:139:

    Code: C / C++
    Log in, to see the code
    .
  • #517 21416379
    khoam
    Level 42  
    vPortTaskWrapper() is a fallback mechanism called when a task terminates in an unpredictable way, e.g. the task function returns control via return, instead of running in an infinite loop. If a task 'exits' from its function, vPortTaskWrapper() captures this state and automatically deletes the task to prevent undefined system behaviour.
  • ADVERTISEMENT
  • #519 21420065
    MAJSTER XXL
    Level 29  
    @hevet I added vorbis at my place today too, more out of curiosity to see how it works at all- well it works as expected. To find some radio streams broadcasting in Vorbis Ogg is an art. I've added a few at my end of bank #1 and #3 you can test. Most importantly, ESP32 reboots are now a thing of the past after adding one line to the main radio and player loop:
    vTaskDelay(1); // Short delay, gives up CPU time to other tasks .

    All FLAC and high-bitrate MP3 files go without stuttering.

    Code: C / C++
    Log in, to see the code
    .
  • #520 21420142
    khoam
    Level 42  
    MAJSTER XXL wrote:
    Most importantly, ESP32 reboots became a thing of the past after adding one line to the main radio and player loop:
    vTaskDelay(1); // Short delay, gives up CPU time to other tasks
    .
    Actually, the Idle Task may have been "starved" - it has a priority of 0, which is lower than loop(). Idle Task is responsible for cleaning up resources after completed tasks.
  • ADVERTISEMENT
  • #522 21420623
    MAJSTER XXL
    Level 29  
    At the end of the day I'm uploading a screen shot of the calendar card on the series, it will be displayed on the last line sequentially with the weatherman:


    Screenshot of Arduino IDE showing C++ code and output data related to messages sent to the ESP32S3 module. .
  • #523 21421481
    MAJSTER XXL
    Level 29  
    I have added some useful info from the site that serves the calendar. The data is extracted by looking for relevant phrases in the payload with html content. As long as these phrases in classes are fixed on the page, it will work. Maybe someone will find it useful- you can frequent. As a test, I assigned a joystick button and a button on the remote control to call this function.

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

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



    Screenshot of Arduino IDE showing code and output on the serial monitor. .
    Screen displaying date, sunrise and sunset times, and namedays. .
  • #524 21424698
    DJCheester
    Level 26  
    Hello as I'm down with the flu my board is delayed/ I wanted to do something useful and install myself an Arduino on my second Win7 32bit PC so I downloaded the Arduino IDE 1.8.19 last with the board manager I downloaded a set for ESP32 S3 I installed I have the possibility to choose the board I set the configuration as you give and the problem is that I have files downloaded from 64bit version of esptool - I ripped from the net compiled under 32bit and then another file gen_esp32part.exe also from 64bit version was so I ripped by someone compiled for 32bit and now such thing occurs ???

    usage: esptool merge_bin [-h] --output OUTPUT [--format {r,a,w}]

    [--flash_freq {keep,40m,26m,20m,80m}]

    [--flash_mode {keep,qio,qout,dio,dout}]

    [--flash_size FLASH_SIZE]

    [--spi-connection SPI_CONNECTION]

    [--target-offset TARGET_OFFSET].

    [--fill-flash-size FILL_FLASH_SIZE]

    <address> <filename> [<address> <filename> ...].

    esptool merge_bin: error: argument --flash_size/-fs: keep is not a known flash size. Known sizes: 512KB, 256KB, 1MB, 2MB, 4MB, 2MB-c1, 4MB-c1, 8MB, 16MB, 32MB, 64MB, 128MB

    exit status 2

    C:Program FilesArduino-builder returned 2

    Compile error for ESP32S3 Dev Module board.



    This report should contain more information if in
    File -> Preferences the option "Show
    detailed information during compilation"

    At the very end of the compilation - what it could be

    From what I have read someone here was running it and it worked for him with the 32 bit version ???

    What to do here to pass this ??

    Of course, we are talking all the time about compiling a sketch for the radio acct of Robgold's colleague but it probably doesn't matter much because I have something with the files.

    I downloaded the files from here
    https://github.com/espressif/arduino-esp32/issues/6012#issuecomment-1589090694

    Greetings...
  • #525 21425415
    DJCheester
    Level 26  
    Hello managed to compile the sketch under Win7 32bit + SP1
    Running on a clean system

    installation - Arduino 1.8.19
    in Arduino - board manager we install esp32 by espressive Systems v.2.0.17 kit (the latest from version 2)

    After attempting to compile, a version error pops up esptool.exe
    The file is for the 64 bit version of Windows I get this error

    Arduino:1.8.19 (Windows 7), Board: "ESP32S3 Dev Module, Disabled, OPI PSRAM, QIO 80MHz, 16MB (128Mb), Core 1, Core 1, Hardware CDC and JTAG, Disabled, Disabled, Disabled, UART0 / Hardware CDC, Huge APP (3MB No OTA/1MB SPIFFS), 240MHz (WiFi), 921600, None, Disabled".

    The version of the C:■******AppDataLocalArduino15.5.1.exe is not compatible with the version of Windows running. Check in the operating system information on this computer which version of the program is needed (x86 - 32-bit or x64 - 64-bit) and then contact the software publisher.

    exit status 1

    Compilation error for ESP32S3 Dev Module board.

    This report should contain more information if in
    File -> Preferences the option "Show
    detailed information during compilation"

    I have replaced the esptool.exe file for the 32bit version is here
    https://github.com/espressif/arduino-esp32/issues/6012#issuecomment-1589090694

    After that, the sketch compiles (of course, the libraries placed in the arduino/libraries folder should be included in the project)

    Compilation of a sketch in Arduino 1.8.19 on Windows 7. .

    Next, installation of the CH343 drivers for the ESP32 board in Windows

    Greetings...

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

    Hello ??

    robgold wrote:
    Receiver connected to GPIO15 instead of GPIO35 for test.


    Which IR receiver do you currently have plugged in - and will this one stay ?

    Greetings ...
  • #527 21426700
    DJCheester
    Level 26  
    Hi, I saw later because I had the earlier soft uploaded without the remote control and after the sketch I looked for the IR pin

    I have now downloaded the latest versions of the soft from robgold and the foreman

    I compiled the robgold soft yesterday and the master today, there was a problem on win7 32bit because it had too many libraries, I removed the ones that were duplicating from the libraries folder and added the missing arduinojson master I ripped from github.

    I will be digesting this pcb tomorrow

    Greetings...
  • #528 21430854
    Szaryczlowiek83
    Level 7  
    Such a question from the back of the body
    PCM5102A or GY-PCM5102?
    Unless you can recommend something else?
  • #529 21431086
    robgold
    Level 20  
    Welcome,

    Responding to a question that has arisen:

    The schematics will slowly differ for the moment but I am trying to maintain compatibility with Majster. E.g. in my version there is no joystick as well as the player is without the updates and changes that Majster has made. I just don't use it. Every now and then I download the Majster file and upload my test FLAC files. Until they start playing I skip the topic of the player.

    The IR receiver was clipped to GPIO15 on a test basis and has stayed that way and will stay that way at least in my version. The foreman seems to have left it on GPIO15 the same way too.

    The PCM5102 and PCM5102A are the same chip. As is customary at Texas Instruments (which took over Burr Brown at one time) the 'A' revision is always the newer one. In this case, the PCM5102A can operate at 1.8V and 3.3V. In our case, this is irrelevant because with us the PCM always works at 3.3V.
    However, I recommend the 5102A because such 5102 "digs" are not known where they come from.

    I have uploaded the latest version of the radio to GitHub - Evo v3.15 Link .
    Changes:
    - added a 3-point equalizer, for now a test version, without notation and "presets"
    - added numeric keypad functions for changing stations, banks ( resistive keypad on ADC1 GPIO9),
    - WiFi network signal level indicator added,
    - corrected PL fonts,
    - added scrolling in a loop of stations and banks, (thanks to Majster, I copied this solution)
    - new calendar view in the full-screen clock option,
    - corrected calculation of "streamtitle" length for the scroller (incorrect length at Polish characters in streamtitle)
    - added support for vorbis, VBR format
    - fix for additional screen refreshment
    - updated STL file for Hammond case
    - updated STL file for printed housing
    - upgrade of Sony tuners ST-110, ST-120 series

    Equalizer: .
    At the moment I have implemented what the Audio library allows, which is a 3-point equalizer.
    Since the settings are in the range of -40 to +6dB, in order to display it quite correctly the sliders below 0 move slower, above 0 they jump much faster. It's called up with the remote control command assigned to "rcCmdAud" We move with the arrows - up, down filter selection (Hi, Mid, Low), right, left boost-dampening change. Test.

    ADC keyboard: .
    I managed to obtain an old Sony ST-120 tuner as a "donor" for conversion. Consequently, the need arose to add keyboard support. As a test I built a matrix resistive keyboard based on reading from ADC and I can tell you that it works very stable. If there are problems, I will switch to PCF8575. On the schematic there is a place to connect the i2c keyboard. In the INO file the keyboard is disabled. You have to disable the comment in lines 3893-3897. The schematic of the keyboard and the resistor values can be seen in the pictures.

    Code: C / C++
    Log in, to see the code
    .
    The keypad has a specific connection matrix resulting directly from the solution that is in this Sony. In general, old Sony tuners are very cool because they have a minimum of buttons and a large knob under which either Sony already mounted a knob/button +/- for tuning or an encoder. So the conversion is simple. If anyone wants to, I can provide ready-made files for conversion for the OLED 3 display..12 and an IR receiver. The prices of these tuners as I looked are in the range of 80-100£ and you gain a housing and a ready-made 12V, 24V power supply. So a simple 3.3V inverter solves the problem.

    Wifi indicator: .
    The addition of the indicator has forced some changes to the display. The file format has been reduced to 3 letters i.e. we have: MP3, AAC, FLC, VBR. In addition, the Bank info is written without spaces as Bank01, Bank02 etc.... The indicator shows the network coverage in the form of 6 bars. You can move it anywhere on the display. The function that draws it is: drawSignalPower(194,63,0); The syntax is (X-coordinate, Y-coordinate, option whether to print signal level on serial 1 -yes, 0-no).

    Fonts PL: .
    I have added the missing letter "ź" for code 0xC5 0xBA

    Corrected Streamtitle length count: .
    When dealing with Polish characters, the ready-made function in u8g2 incorrectly counted Polish letters as 2 characters which caused it to "eat" some of the text. Now this is counted bypassing the dedicated u8g2 library functions and works correctly.

    Corrected additional screen refresh: .
    As some of you have already pointed out sometimes artefacts/ghosts appear on the display after changing stations. The streamtitle refresh function from the Audio library is to blame for this. It starts substituting the streamtitle variable when changing stations and sometimes spills the display buffer. In the VU meter's refresh loop I added an extra counter counting 4x65 and refreshing the screen once more. So far after this "prosthesis" I have not been able to catch the "artefacts" again.

    Schematics, images, pictures below. The schematics themselves in Eagle 6 format are on GitHub.


    Circuit diagram of an ESP32-based radio .
    Sony ST-120 tuner keypad connection schematic .
    Schematic of a resistive matrix keyboard circuit with resistors for ADC. .

    OLED display showing radio station and audio parameters. .
    Display showing equalizer with three sliders. .
    Digital clock display with music and date information. .
    Front panel of Sony ST-S120 tuner with visible buttons and display. .
    Front panel of a Sony tuner with display and buttons .
    OLED display module with casing. .
  • #530 21431464
    Szaryczlowiek83
    Level 7  
    >>21431086
    robgold wrote:
    PCM5102 and PCM5102A are the same chip. As is customary at Texas Instruments (which at one time acquired Burr Brown) the "A" revision is always the newer one. In this case, the PCM5102A can operate at 1.8V and 3.3V. In our case, this is irrelevant because with us the PCM always works at 3.3V.
    However, I recommend the 5102A because such 5102 "digs" are unknown where they come from.
    .
    I know that these are the same chips and I also know that the further away the letter, the newer they are. I also know that sometimes newer does not mean better and that is why I asked maybe someone had contact.
  • #531 21431542
    DJCheester
    Level 26  
    Welcome

    A pensioner has built a radio from my PCB.

    PCB board with mounted electronic components. .
    View of a custom-built radio on a PCB. .
    DIY radio on a PCB with a display and connectors. .

    And it even started up 😀

    Radio built from PCB with Internet Radio display.
    DIY internet radio with a display connected to a PCB.

    And now how to run it further.
    I have no experience with WiFi networks
    So please help (just like a cow on a ditch please)

    I don't have WiFi at home ie a router running 24 hours a day but I can share from my phone for radio listening and my computer.

    When I'm using my laptop and I'm on the net this is how I share the net.

    Now, how do I set up this radio for the first time, i.e. connect to my phone with a hotspot, i.e. network name and password and so I can play with it.

    Maybe the questions are layman's but I have no knowledge of WiFi

    Greetings and would appreciate your help.

    PS. The display is glowing beautifully.

    And also a question how to disable this big diode, is there such a jumper RGB it is enough to unsolder. Or desolder the diode ?

    Or is it possible to disable it by software ? Do you also have this ?

    So far I have been running without encoder the robgold soft and tsop31238 receiver installed on the PCB.

    Fellow robgold it looks beautiful in the case 😀.
    Question what is/will the SV2 3pin connector be for ?
    The keyboard at my place will not be useful remote control operation but for your version it will be like a factory.



    Greetings ...
  • #532 21431874
    robgold
    Level 20  
    @DJCheester

    You set up a WiFi router on your phone. This you already know from what you write how to do. You then search for a WiFi network called ESP32 Radio and connect to it. This is where the phone will 'rebel' that this network doesn't have internet and ask you to connect - yes, connect. You then open a browser and go to 192.168.4.1, as shown in the display. There is already a page there where you have to select your WiFi network (that is, in your case, the router created by your phone) and enter the password. You give "save" and manually have to reboot the module. Unplug its power supply or press the reset button.

    It worked out very nicely. You must have worked a bit hard to get it to work. Upload the Eagel files somewhere.
    SV2 is the IR receiver connector - GPIO15.
  • #533 21432056
    MAJSTER XXL
    Level 29  
    @robgold I have no idea why you can't play FLAC files? I added a small fix today regarding collecting the bitrate every second and putting that on the display, the problem was especially with FLAC files where the audio library info often returned 516b/s. Now the bitrate is almost in line with what MediaInfo shows with files on the computer, almost because the difference is often about 2kb/s, who is lying - we don't know. You can also see the bitrate variation of the MP3 files, I don't know how true this is, as the changes are within a small range from the reference set.
    I now do the bitrate reading in a function:

    Code: C / C++
    Log in, to see the code
    .
  • #534 21432536
    robgold
    Level 20  
    @MAJSTER XXL

    It's not quite the case that no FLAC files play back for me. The kind of standard ripped discs (20-30MB in size) I have in my archive play back perfectly. The problem I have is with those files of 100, 120, 140MB. I need to find some time and check more carefully what is going on there. So far I have focused on the radio itself plus a reasonably user-friendly GUI. This player topic will have to be examined.
  • #535 21432922
    boloteam 2.0
    Level 10  
    FLAC files of 100, 200, 140MB, if they are of similar length to FLAC files of 20 - 30MB, they are probably 24bit files, and these are not supported by the Audio.h library at the moment.
  • #536 21433415
    robgold
    Level 20  
    @boloteam 2.0

    I took a look at the mediainfo of these files and indeed. The files I had a problem with have 24-bit/96kHz encoding:

    Bit rate : 2 919 kb/s
    Sampling rate : 96.0 kHz
    Bit depth : 24 bits


    While the smaller (playback) ones:

    Bit rate : 1 050 kbps
    Sampling rate : 44.1 kHz
    Bit depth : 16 bits

    Thanks for the guidance. Topics we have solved :) .
  • #537 21433441
    DJCheester
    Level 26  
    robgold wrote:
    @DJCheester

    You set up a WiFi router on your phone. This you already know from what you write how to do. You then search for a WiFi network called ESP32 Radio and connect to it. This is where the phone will 'rebel' that this network doesn't have internet and ask you to connect - yes, connect. You then open a browser and go to 192.168.4.1, as shown in the display. There is already a page there where you have to select your WiFi network (that is, in your case, the router created by your phone) and enter the password. You give "save" and manually have to reboot the module. Unplug its power supply or press the reset button.

    It worked out very nicely. You must have worked a bit hard to get it to work. Upload the Eagel files somewhere.
    SV2 is the IR receiver connector - GPIO15.
    .


    Hi I will attach the eagle files in the topic because I don't have Github.
    For the time being I want to get this radio working first.

    And I already caught one mistake i.e. swapped pins CLK and DT i.e. GPIO / for now I swapped them in the sketch and the encoder works eventually I will change the PCB

    And now the effects I managed to connect to the ESP32 Radio network and there I typed in the Redmi SSID (that's the name of my network - it's not in the list because the phone can either work as a router or a hotspot together no) and Password I typed in the access password and clicked SAVE

    - it appeared on the next page saved

    and already satisfied I switch to the hotspot and nothing I reset the radio and will attach pictures and screenshots of what is happening from the phone shortly.

    meanwhile on the serial monitor with the ESP connected to the computer I get the log

    Code: Text
    Log in, to see the code


    And on the display I see first a graphic then connected and loading stream and it hangs like this

    As for the PCB was a bit of fun drilling and soldering, but the important thing is that something is working so far, I hope that today with your help I will be able to start the radio.

    Please help and best regards ...

    What I am doing wrong

    Added after 8 [minutes]:

    First, at the address given on the OLED was

    WiFiManager interface for ESP Internet Radio with configuration options.

    I clicked the wifi jam

    WiFi configuration form with SSID and password fields.

    After which my network was not there because I was in wifi mode with my phone and not hotspot mode so I typed in the network name and password.

    I clicked Dave and on the newly opened page it showed saved

    After a reset it was
    OLED screen displaying Internet Radio with green text Connecting to network and musical notes. .
    OLED display showing Internet Radio message and IP address 192.168.43.156. .
    Display showing Loading stream... .

    Please let me know what I am doing wrong or what I have done wrong.

    Greetings ...
  • #538 21433468
    robgold
    Level 20  
    Since you don't have the files on the card then do this "trick" press the encoder to go to bank selection, or on the remote select the bank menu and load Bank 01 from the network.
    I suspect you are stuck in a loop where the radio has connected but there is nowhere to download the stream from. I need to check this recently I tested the WiFi manager itself hard on a trip to make sure it always works correctly but the situation, with a fresh SD card I can see still needs further checking.

    Additionally, check that your phone is not blocking the connection in some way or requiring approval. I don't know how the Redmi does hotspot.
    I tested it on a Samsung and it goes through without a problem.

    What I always say is that the prototype called "sample A" and the software needs testing :) .
  • #539 21433480
    DJCheester
    Level 26  
    Hello I don't have the remote configured yet this will be the next stage.

    Normally I have only connected to my hotspot once now when it is on it hangs on connecting and thats it and when I turn it off it goes to IP

    Then by holding the encoder longer I enter the bank

    Display showing the text BANK 1 with a progress bar on a green background.

    But it doesn't pull anything then it's just this

    Electronic display with the text 01, Hz bit Kbps, and Bank 01.

    Is there no way to download these files to the card via the computer so that they are already there?

    Greetings ...
  • #540 21433485
    robgold
    Level 20  
    Of course it is. Here you have the bank files: https://github.com/dzikakuna/ESP32_radio_streams

    For this you need to create two txt files. One called station_nr.txt the other called bank_nr.txt in bank type in 1 and only that and in station_nr type in 4.
    One specifies the station the radio should start on and the other the bank. The station is Italo4You. It is the only station with a very reliable stream and allows the client to buffer as much as 230kB.
    bank_n..txt Download (3 bytes) .
    station...txt Download (4 bytes) .
    bank01.txt Download (8.43 kB)

    To me it looks like you have no connection to the net. Yes, the router on your phone has assigned you an IP because the router mechanism works, but you have no internet. If you had internet, you would see the clock, which is taken from the NTP server.

    const char *ntpServer1 = "pool.ntp.org";
    const char *ntpServer2 = "time.nist.gov";

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