logo elektroda
logo elektroda
X
logo elektroda

Internet radio and audio file player on ESP32-S3

MAJSTER XXL 106239 1246
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #31 21008657
    Tytus Kosiarski
    Level 16  
    Hello,

    When it comes to the problem of encoding Polish characters, I received a link from my colleague @Krzysztof LD:

    https://www.utf8-chartable.de/unicode-utf8-table.pl?start=1024

    (Thank you :) )

    Just select the appropriate page in the "go to other block" position at the top of the page. And now in the program, when you find Polish character codes, just replace them "on the fly" with the appropriate indexes in the font bitmap table in the glcdfont.c file, under which there are bitmaps of Polish characters, as I saw, my colleague @MAJSTER XXL did it

    Regards, KT
  • ADVERTISEMENT
  • #32 21009859
    MAJSTER XXL
    Level 29  
    @ytuskosiarski Thanks Tytus for the tips, I managed to handle it comprehensively on the switch, but I can already see that there will be more and more cases in the switch, probably depending on the character encoding standard when writing id3 tags using 2 bytes.

    Arduino IDE window with source code for ESP32 highlighting switch-case statements for ASCII character conversion. Audio player with LCD display playing a song by Urszula Sipińska. Electronic device with a display showing Radio MBOX, track Urszula - Malinowy Kr, and audio parameters.
  • #33 21010606
    Tytus Kosiarski
    Level 16  
    Now, @MAJSTER XXL, use the spaces between the words of the song title to properly display the title on two lines. For example:
    "There are days like this in...
    week"

    Whether

    "Urszula - Malinowy
    King"

    I see it like this:
    You count the number of characters in the title. When less than / equal to max characters in a line (this is some constant), the appropriate function does nothing.
    When larger, the function counts the characters entered into the first LCD line up to the space contained in the first line. Everything after this space will be displayed in the second line of the LCD by this function.

    I guess it will look better visually.

    Regards, KT
  • #34 21011234
    miroskop
    Level 23  
    While waiting for the delivery of the ordered components from China, I tried to compile the ESP32_radio_player.ino file in Arduino 2.3.2 but it gives me an error pointing to line no. 116:
    "Compilation error: `Audio` does not name a type" and earlier at the very beginning of the listing:
    "NOTE: the Audio library runs on the architecture(s) alone and may not be compatible with the current board that runs on the esp32 architecture(s). .
    What am I doing wrong? Help! I uploaded the attached libraries and chose the "ESP32S3 Dev Module" CD.
  • #35 21011298
    TCP/IP
    Level 13  
    Try this.
    Remove the Audio and SPI libraries included by the thread author. I don`t know why he included them.
    Install this "ESP32-audioI2S" here https://github.com/schreibfaul1/ESP32-audioI2S
    If you don`t have them installed, add Adafruit_GFX_Library and Adafruit_BusIO.
    It should compile. I haven`t tested whether this design works.
  • #36 21011450
    miroskop
    Level 23  
    Thank you, "TCP/IP" friend, for your quick and, most importantly, effective help. The program compiled without any problems. I`ll probably ask more questions when the components arrive ;)
  • #37 21018215
    Andrzej Ch.
    Level 33  
    First of all, I bow my head to the designer and the project. This is a very cool, successful and practical project and much more helpful than, without taking away from anyone`s credit, projects like "let`s take apart device X and see what we can use from it".
    I have a suggestion: could you expand the project with a built-in low-power amplifier, let`s assume 2x5W, and remote control (first come from Ali)? I think that, for example, in the kitchen it would work better instead of fiddling with knobs. Has this possibility been considered at all?

    Another thing that comes to my mind in order to free up the author`s dedicated station list is the possibility of saving addresses and data regarding radio stations in an agreed format on an SD card that this device could support. And access to the card itself could be via SSH.
  • ADVERTISEMENT
  • #38 21019229
    MAJSTER XXL
    Level 29  
    @Andrzej Ch. I made the radio player for my own needs, i.e. for my desk, where it is connected to the Technics amplifier. The project is "liberated", you can make such a small amplifier yourself. It`s similar with the station list - you can copy it, edit it, upload it anywhere on the Internet and link it in the program. I am currently optimizing the code and trying to find problems and eliminate them as best as I can or by trial and error. I made a count of files in each newly opened directory and after selecting it with the right buttons, it shows which file we are on and how many are available. By design, I don`t make a mess and don`t create subdirectories - after all, it`s a simple player, not a computer. It now works to restore directories in order, after the last file in the directory it goes to the first one in the next one. I also count the directories and after the last one it goes to the first one. The audio file format is displayed. When there is no data about the artist and title in the ID3 metadata, I display the file name. As for the remote control - I don`t need it, so I probably won`t buy it, I think you can try to choose an IR receiver and some simple library for it yourself.

    DIY radio player with a display on a desk.
  • #39 21021802
    miroskop
    Level 23  
    I managed to get this radio working!!! For now, on the breadboard to figure out what`s going on. Proof in the photo. I have one problem: when the card reader is connected, the system does not start. However, you only need to unplug MISO for the radio to work after the reset.
    Second thing: I don`t know if it`s supposed to be like this, but the radio doesn`t remember the last station set after turning it off. He always starts with "Mega Dance Radio" Bank 1, Station 6. Such a memory would be very useful.

    Breadboard with electronic components, a display screen, and wires.
  • #40 21022099
    MAJSTER XXL
    Level 29  
    @miroskop Show some better photos from both sides of this reader, because it is a more "active" module, mine only has 4 10k resistors and about 2 capacitors. Do you have any datasheet for this module?
  • #41 21022169
    miroskop
    Level 23  
    I am attaching a photo of only one side because there is nothing interesting on the other.
    This is quite a popular module. It contains a 3.3V stabilizer and the LVC125A system. I have two such readers, but replacing them does not solve the problem.

    Electronic module with an SD card slot and several components on a circuit board.

    The radio has been playing continuously for several hours and nothing bad is happening, but the card reader is disconnected. Thank you for the opportunity to use your project!
    I still have a question: what is the button on the volume encoder for?
    And while we`re talking about buttons. For me, when I press the left encoder button while listening to the radio, there is a pause of several seconds and during this time the name of the artist disappears from the display. After a while, everything returns to normal.
  • #42 21022686
    ArturAVS
    Moderator
    miroskop wrote:
    For me, when I press the left encoder button while listening to the radio, there is a pause of several seconds and during this time the name of the artist disappears from the display. After a while, everything returns to normal.

    No wonder with such cable technology. You made some great antennas and they catch interference.
  • #43 21022953
    MAJSTER XXL
    Level 29  
    miroskop wrote:
    And while we`re talking about buttons. For me, when I press the left encoder button while listening to the radio, there is a pause of several seconds and during this time the name of the artist disappears from the display. After a while, everything returns to normal.


    I don`t know which is your left encoder button, but it should become clear when your card reader starts working. Overall, I made some changes, so you can download the latest version from github. Currently, when I press the button on my left encoder, the audio stops for a second and the station info disappears, I`ll probably fix it. Generally, you use the left encoder knob to select what you want to run, whether the radio or the player, and then confirm with the left encoder button. The right one also needs to be slightly improved, because after the first boot from the power supply it does nothing, then when you play an audio file from the SD card, the right one will stop playback and exit to the menu again, when you press it again it will go to play the last folder .

    PS. my reader is an ordinary module:
    SD card reader module with a blue board and metal slot. SD card reader module with pin labels.
  • #44 21023001
    miroskop
    Level 23  
    Which encoder is left or right is specified in your program and I stick to it :) So the left one is the one with the source selection. I will buy a reader module like yours and that will probably be the end of the matter. Good luck in your further work!
  • #45 21023304
    MAJSTER XXL
    Level 29  
    @miroscope, you can test the MISO port assignment to pin 35, then connect, compile and run. In fact, I assigned pin 0 for MISO a bit risky. As my friend Tytus tells me: this adapter probably forces LOW on this pin and ESP32 then enters bootloader mode. During normal ESP32 boot, the BOOT pin should be on HIGH.
    https://docs.espressif.com/projects/esptool/e...sp32/advanced-topics/boot-mode-selection.html


    in line 17 of the program set:
    #define SPI_MISO 35
  • ADVERTISEMENT
  • #46 21023694
    miroskop
    Level 23  
    Changing the pin for MISO helped. Everything works! However, I still bought a reader like yours due to better mounting to the front panel.
    Now I have another problem ;) The RGB diode in the ESP32 module has turned on and I don`t know how to turn it off, but it gives a lot of white light to my eyes. Neither resetting nor reloading the program helps. Is there any other solution apart from covering the diode with "Scot" or desoldering it?
  • #48 21023747
    miroskop
    Level 23  
    It`s not like that... at first everything worked and the LED didn`t light up. Only then, probably when I unplugged the USB plug, did the LED light up and not immediately. Even though the RGB pad is unsoldered (the one next to the diode).

    A few hours later... :
    It turned out that the RGB diode was dead, so I desoldered it and the problem was solved :)
    My display probably has a different character set because it doesn`t display Polish letters correctly, but it doesn`t matter because this radio is supposed to be in my kitchen for listening, not for reading. I only changed the texts in the Menu to "DIRECTORY LIST" and "File Player" and it no longer hurts my eyes.
  • #50 21025189
    miroskop
    Level 23  
    You are reliable! I have Polish signs! Thank you!
  • #51 21027793
    MAJSTER XXL
    Level 29  
    We managed to download the time from the Internet, it is done once during setup, then the time is added using a 1 second timer and updated on the display every second. I also added free selection of stations from a given bank using the right encoder. It works like this:
    - while playing a station stream, press the right encoder button,
    - scroll up or down to the selected item from the list,
    - press the same button of the right encoder again, the program will start playing the selected station.

    I started doing the same to display a list of directories and freely select them with the left encoder - this still requires refinement.

    Small electronic device with a display in a casing, showing music information and settings. Front panel of an electronic device with a display showing radio stations and control knobs.
  • #52 21028221
    miroskop
    Level 23  
    I uploaded a new sketch to check if it`s not April Fool`s Day... It`s not!!! The changes are still going in the right direction and I`m waiting for the moment when these four buttons will no longer be needed, because I`m having trouble fitting it all sensibly on my front panel. Especially since I have two tone potentiometers and a switch. It seems to me that it would be convenient if the left encoder selected the bank directly and after pressing the button for a long time it went to the source selection.
  • #53 21028282
    gulson
    System Administrator
    Maybe replace the buttons with a knob, a bit like on an iPod? :) I`m glad that the project is developing. Good internet radio receivers are scarce, not to mention the lack of updates. You will spend PLN 400 and after a few years you will get a chapel with updates.
  • #54 21032868
    hevet
    Level 16  
    I assembled this radio, I haven`t connected the SD card yet, but all I see is the word Internet Radio and then Wifi connected and still nothing happens. In the Arduino IDE monitor, it shows that the playlist failed to download.
  • ADVERTISEMENT
  • #55 21032899
    miroskop
    Level 23  
    In the sketch, you need to enter your login and Wi-Fi password. Somewhere around 120 lines
  • #56 21032903
    hevet
    Level 16  
    Yes, I have it entered, but it only happens as I wrote above.
  • #57 21035265
    MAJSTER XXL
    Level 29  
    @hevet question do you get http error code on serial terminal? You can literally only connect the ESP32 module with the display and check then, it will at least give you an answer whether you have a problem with connections to the peripherals. For diagnostic purposes, you can paste something to print something on the terminal`s serial - which will help find the cause of the problem. I added it to the sketch - you can download it from github, then paste the event log.
    I already have support for switching banks with an encoder, I thought I would add Bluetooth audio, but unfortunately it won`t work, adding BT libraries exceeds the program memory and, secondly, the A2DP protocol cannot be supported by this ESP32 module.


    Screenshot of Arduino IDE environment showing code for ESP32 module with a display.
  • #58 21035275
    hevet
    Level 16  
    This is the entire log from the terminal

    ESP-ROM:esp32s3-20210327
    Build:Mar 27 2021
    rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
    SPIWP:0xee
    mode :D IO, clock div:1
    load:0x3fce3808,len:0x44c
    load:0x403c9700,len:0xbe4
    load:0x403cc700,len:0x2a68
    entry 0x403c98d4
    Connected to the WiFi network
    WiFi setup done
    Time downloaded from the Internet
    The timer has been started
    Error downloading stations. HTTP Code: -1
    Stations downloaded from the server
    Guru Meditation Error: Core 1 panic`ed (Double exception).

    Core 1 register dump:
    PC : 0x4037de12 PS : 0x00040736 A0 : 0x00000000 A1 : 0x3fcebe60
    A2 : 0x00040736 A3 : 0x00040026 A4 : 0x3fcebf46 A5 : 0x0000005d
    A6 : 0x3fc9d38c A7 : 0x3fcebf46 A8 : 0x3fcebf20 A9 : 0xff000000
    A10 : 0x3fc9cd8c A11 : 0x3c0d0728 A12 : 0x0000ff00 A13 : 0x00ff0000
    A14 : 0x3fc9d38c A15 : 0x00000006 SAR : 0x00000014 EXCCAUSE : 0x00000002
    EXCVADDR: 0xff000000 LBEG : 0x400556d5 LEND : 0x400556e5 LCOUNT : 0xfffffff9


    Backtrace: 0x4037de0f:0x3fcebe60


    Core 1 register dump:
    PC : 0x4037de12 PS : 0x00040736 A0 : 0x00000000 A1 : 0x3fcebe60
    A2 : 0x00040736 A3 : 0x00040026 A4 : 0x3fcebf46 A5 : 0x0000005d
    A6 : 0x3fc9d38c A7 : 0x3fcebf46 A8 : 0x3fcebf20 A9 : 0xff000000
    A10 : 0x3fc9cd8c A11 : 0x3c0d0718 A12 : 0x0000ff00 A13 : 0x00ff0000
    A14 : 0x3fc9d38c A15 : 0x00000006 SAR : 0x00000011 EXCCAUSE : 0x00000002
    EXCVADDR: 0xff000000 LBEG : 0x400556d5 LEND : 0x400556e5 LCOUNT : 0xfffffff9


    Backtrace: 0x4037de0f:0x3fcebe60




    ELF file SHA256: f6ca69c03f8539ce



    ELF file SHA256: f6ca69c03f8539ce
  • #59 21035291
    MAJSTER XXL
    Level 29  
    @hevet it`s hard to guess why your module is resetting, show us exactly what ESP32 board you have, compare the settings:

    Screenshot of Arduino IDE interface with highlighted board settings and ESP32 configuration.
  • #60 21035298
    hevet
    Level 16  
    ESP32-S3 DevKitC-1 WROOM-1 N16R8 16MB FLASH WiFi Bluetooth USB-C module such a module, I have the settings as you provided, I have also updated the log above, please look again. I only have a display with ESP32S3 connected.

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